From: <shi...@us...> - 2007-11-26 09:53:29
|
Revision: 2048 http://unicore.svn.sourceforge.net/unicore/?rev=2048&view=rev Author: shiraz_79 Date: 2007-11-26 01:53:03 -0800 (Mon, 26 Nov 2007) Log Message: ----------- - logging fixed - removed unnecessary fetching of security props Modified Paths: -------------- CommonInformationService/cis-core/trunk/src/main/conf/cis-beans.xml CommonInformationService/cis-core/trunk/src/main/conf/cis.config CommonInformationService/cis-core/trunk/src/main/conf/log4j.xml CommonInformationService/cis-core/trunk/src/main/conf/wsrflite.xml CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/CIS.java CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/aggregator/IPInvoker.java CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/dao/ExistDBManager.java CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/util/CISUtils.java CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/ws/TestRegistryStandalone.java Removed Paths: ------------- CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/dao/TestExistDB.java Modified: CommonInformationService/cis-core/trunk/src/main/conf/cis-beans.xml =================================================================== --- CommonInformationService/cis-core/trunk/src/main/conf/cis-beans.xml 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/conf/cis-beans.xml 2007-11-26 09:53:03 UTC (rev 2048) @@ -30,18 +30,18 @@ <property name="scheduledExecutorTasks"> <list> <ref bean="publishertask"/> - <!--<ref bean="aggregatortask"/>--> + <ref bean="aggregatortask"/> </list> </property> </bean> <bean id="publishertask" class="org.springframework.scheduling.concurrent.ScheduledExecutorTask"> - <property name="period" value="10"/> + <property name="period" value="3"/> <property name="delay" value="1"/> <property name="timeUnit" value="SECONDS"/> <property name="runnable" ref="infopublishing"/> </bean> <bean id="aggregatortask" class="org.springframework.scheduling.concurrent.ScheduledExecutorTask"> - <property name="period" value="10"/> + <property name="period" value="1"/> <property name="delay" value="1"/> <property name="timeUnit" value="SECONDS"/> <property name="runnable" ref="ipinvoker"/> Modified: CommonInformationService/cis-core/trunk/src/main/conf/cis.config =================================================================== --- CommonInformationService/cis-core/trunk/src/main/conf/cis.config 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/conf/cis.config 2007-11-26 09:53:03 UTC (rev 2048) @@ -11,7 +11,7 @@ #path for namespaces file cis.namespace.path=src/main/conf/cis.namespaces -#path for sring beans +#path for sring beans (should be relative to the application directory) cis.springbeans.path=src/main/conf/cis-beans.xml Modified: CommonInformationService/cis-core/trunk/src/main/conf/log4j.xml =================================================================== --- CommonInformationService/cis-core/trunk/src/main/conf/log4j.xml 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/conf/log4j.xml 2007-11-26 09:53:03 UTC (rev 2048) @@ -21,7 +21,7 @@ </appender>--> <logger name="de.fzj.unicore.cis" additivity="false"> - <level value="trace"> </level> + <level value="info"> </level> <appender-ref ref="CONSOLE"/> </logger> Modified: CommonInformationService/cis-core/trunk/src/main/conf/wsrflite.xml =================================================================== --- CommonInformationService/cis-core/trunk/src/main/conf/wsrflite.xml 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/conf/wsrflite.xml 2007-11-26 09:53:03 UTC (rev 2048) @@ -8,13 +8,13 @@ <!-- logical address, i.e. the URL to use in EPRs--> - <property name="unicore.wsrflite.baseurl" value="http://localhost:7775/services"/> + <property name="unicore.wsrflite.baseurl" value="http://localhost:7776/services"/> <!-- physical hostname (or IP address) and port --> <property name="unicore.wsrflite.host" value="localhost"/> - <property name="unicore.wsrflite.port" value="7775"/> + <property name="unicore.wsrflite.port" value="7776"/> <!-- Example security configuration. Modified: CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/CIS.java =================================================================== --- CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/CIS.java 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/CIS.java 2007-11-26 09:53:03 UTC (rev 2048) @@ -32,6 +32,7 @@ package de.fzj.unicore.cis; import java.io.ByteArrayInputStream; +import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; @@ -42,7 +43,6 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; - import de.fzj.unicore.cis.aggregator.IPInvoker; import de.fzj.unicore.cis.aggregator.U6Aggregator; import de.fzj.unicore.cis.impl.registry.RegistryImpl; @@ -67,7 +67,7 @@ public static final String UIService = "UISDiscoveryService"; - public static final String VERSION = "1.0-alpha1"; + public static final String VERSION = "1.0.0-SNAPSHOT"; public static final String UIS_SERVER_NAME = "uis.server.name"; @@ -80,20 +80,15 @@ public static final String CIS_MONITOR = "cis.enable.monitor"; - public static final String wsrfConfig = "<services>" - - - + "<service name=\"" + "RegistryService" + "\" wsrf=\"false\">" - + "<interface class=\"" + Registry.class.getName() - + "\"/>" + "<implementation class=\"" - + RegistryImpl.class.getName() + "\"/>" + "</service>" - - - - + "</services>"; + public static final String wsrfConfig = "<services>" - - + + "<service name=\"" + "RegistryService" + "\" wsrf=\"false\">" + + "<interface class=\"" + Registry.class.getName() + "\"/>" + + "<implementation class=\"" + RegistryImpl.class.getName() + + "\"/>" + "</service>" + + + "</services>"; + public static final String LOG_PROPERTIES_FILE = "src/main/conf/log4j.xml"; public static final String CIS_AGGREGATOR_DIR = "cis.aggregator.dir"; @@ -111,16 +106,14 @@ } private static void buildProperty(String fileName) { - logger.info("here is a properties path: " - + DEFAULT_CIS_CONFIG_PROPERTIES_PATH); FileInputStream fis = null; try { if (fileName == null || fileName.equalsIgnoreCase("")) { fis = new FileInputStream(DEFAULT_CIS_CONFIG_PROPERTIES_PATH); - logger.info("Loading default CIS configuration"); + logger.debug("Loading default CIS configuration"); } else { - fis = new FileInputStream(DEFAULT_CIS_CONFIG_PROPERTIES_PATH); - logger.info("Loading CIS configuration at" + fileName); + fis = new FileInputStream(fileName); + logger.debug("Loading CIS configuration at" + fileName); } if (properties == null) { @@ -143,9 +136,9 @@ public static String getProperty(Object key) { buildProperty(DEFAULT_CIS_CONFIG_PROPERTIES_PATH); - logger.info("the object is: " + key.toString()); + logger.debug("the object is: " + key.toString()); String ou = (String) properties.get(key); - logger.info("in getProperty and the value of property is: " + ou); + logger.debug("in getProperty and the value of property is: " + ou); return ou; } @@ -184,8 +177,7 @@ + wsrfConfigFile); deployServices(new FileInputStream(wsrfConfigFile)); } else { - System.out - .println("Deploying default services to WSRFlite."); + System.out.println("Deploying default services to WSRFlite."); deployDefault(); } @@ -202,7 +194,7 @@ // building properties System.out.println(writeHeader()); - + Thread t = new Thread(new Runnable() { public void run() { try { @@ -210,8 +202,7 @@ deployServices(); logger.debug("***** Before Jetty Start *****"); // JettyServer server = new JettyServer(); - ctx = new FileSystemXmlApplicationContext(CIS - .getProperty(CIS.CIS_SPRINGBEANS_PATH)); + ctx = new FileSystemXmlApplicationContext(CIS.getProperty(CIS.CIS_SPRINGBEANS_PATH)); addPublishers(ctx); WebServer server = (WebServer) getApplicationCtx().getBean( "webserver"); @@ -240,7 +231,9 @@ if (args.length == 0) { cis = new CIS(); logger.info("Loading default CIS configuration"); - }else{ + } else { + System.out.println("-------------------------------------" + + args[0]); cis = new CIS(args[0]); } cis.startSynchronous(); Modified: CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/aggregator/IPInvoker.java =================================================================== --- CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/aggregator/IPInvoker.java 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/aggregator/IPInvoker.java 2007-11-26 09:53:03 UTC (rev 2048) @@ -1,20 +1,13 @@ package de.fzj.unicore.cis.aggregator; -import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; -import java.util.Date; import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; import org.apache.log4j.Logger; import org.apache.xmlbeans.XmlException; @@ -28,12 +21,6 @@ import de.fzj.unicore.cisprovider.CISInfoProvider; import de.fzj.unicore.cisprovider.xmlbeans.GetInfoRequestDocument; import de.fzj.unicore.cisprovider.xmlbeans.GetInfoResponseDocument; -import de.fzj.unicore.uas.client.UASClientFactory; -import de.fzj.unicore.uas.security.DSigOutHandler; -import de.fzj.unicore.uas.security.DSigParseInHandler; -import de.fzj.unicore.uas.security.IUASSecurityProperties; -import de.fzj.unicore.uas.security.UASSecurityProperties; -import de.fzj.unicore.wsrflite.security.ISecurityProperties; import eu.unicore.unicore6.cis.aggregator.CIPRegistrantDocument; import eu.unicore.unicore6.cis.aggregator.CIPRegistrantDocument.CIPRegistrant; @@ -216,7 +203,6 @@ Map<String, String> map = mgr .queryWithId("for $x in collection('/db/cis') where $x//contains(*:Site/*:URL,'" + url + "') return $x//*:Site/*:URL"); - System.out.println("Query executed" + lst); if (map.size() > 0) return map; @@ -225,7 +211,7 @@ } public void fileChanged(File file) { - System.out.println("-------------" + file.getAbsolutePath() + logger.info("-------------" + file.getAbsolutePath() + "----------------- has been changed"); try { loadRegistrations(); Modified: CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/dao/ExistDBManager.java =================================================================== --- CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/dao/ExistDBManager.java 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/dao/ExistDBManager.java 2007-11-26 09:53:03 UTC (rev 2048) @@ -49,17 +49,14 @@ import org.exist.storage.DBBroker; import org.exist.xmldb.DatabaseInstanceManager; import org.exist.xmldb.XQueryService; -import org.exist.xupdate.test.XUpdateTestCases; import org.xmldb.api.DatabaseManager; import org.xmldb.api.base.Collection; import org.xmldb.api.base.Database; -import org.xmldb.api.base.Resource; import org.xmldb.api.base.ResourceIterator; import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.XMLDBException; import org.xmldb.api.modules.CollectionManagementService; import org.xmldb.api.modules.XMLResource; -import org.xmldb.api.modules.XPathQueryService; import de.fzj.unicore.cis.CIS; import de.fzj.unicore.cis.util.CISUtils; @@ -150,7 +147,6 @@ Collection root = DatabaseManager.getCollection(getDburl(), "admin", ""); - System.out.println(root); CollectionManagementService mgtService = (CollectionManagementService) root .getService("CollectionManagementService", "1.0"); collection = mgtService.createCollection("cis"); @@ -194,7 +190,7 @@ // register the instance DatabaseManager.registerDatabase(database); - System.out.println(DBBroker.ROOT_COLLECTION); + logger.debug("Name of root collection: "+DBBroker.ROOT_COLLECTION); // try to get collection if (col == null) { @@ -242,8 +238,8 @@ else throw new RuntimeException("Collection is closed"); - System.out.println("Collection name: " + col.getName()); - System.out.println("Number of doc's: " + col.getResourceCount()); + logger.debug("Collection name: " + col.getName()); + logger.debug("Number of doc's: " + col.getResourceCount()); docId = document.getDocumentId(); } catch (Exception e) { e.printStackTrace(); @@ -332,7 +328,7 @@ XQueryService service = (XQueryService) col.getService( "XQueryService", "1.0"); ResourceSet result = service.query("/*"); - System.out.println("Found " + result.getSize() + " results."); + logger.debug("Found " + result.getSize() + " results."); for (ResourceIterator i = result.getIterator(); i .hasMoreResources();) { // System.out.println(i.nextResource().getContent()); @@ -440,7 +436,7 @@ if (mgr == null) { System.err.println("service is not available"); } else if (mgr.isLocalInstance()) { - System.out.println("shutting down database..."); + logger.debug("shutting down database..."); mgr.shutdown(); } } catch (Exception e) { @@ -510,8 +506,8 @@ else throw new RuntimeException("Collection is closed"); - System.out.println("Collection name: " + col.getName()); - System.out.println("Number of doc's: " + col.getResourceCount()); +// System.out.println("Collection name: " + col.getName()); +// System.out.println("Number of doc's: " + col.getResourceCount()); } catch (Exception e) { e.printStackTrace(); @@ -676,8 +672,8 @@ else throw new RuntimeException("Collection is closed"); - System.out.println("Collection name: " + col.getName()); - System.out.println("Number of doc's: " + col.getResourceCount()); +// System.out.println("Collection name: " + col.getName()); +// System.out.println("Number of doc's: " + col.getResourceCount()); docId = document.getDocumentId(); } catch (Exception e) { e.printStackTrace(); Modified: CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/util/CISUtils.java =================================================================== --- CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/util/CISUtils.java 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/main/java/de/fzj/unicore/cis/util/CISUtils.java 2007-11-26 09:53:03 UTC (rev 2048) @@ -38,7 +38,6 @@ import java.io.FileReader; import java.io.IOException; import java.io.InputStream; -import java.net.MalformedURLException; import java.util.Calendar; import java.util.Date; import java.util.Properties; @@ -60,6 +59,7 @@ public class CISUtils { private static Logger logger = Logger.getLogger(CISUtils.class.getName()); private static UASClientFactory client = null; + private static UASSecurityProperties uasSecProps = null; // security settings... private static String sprops = ISecurityProperties.WSRF_SSL + "=false" + "\n" + ISecurityProperties.WSRF_SSL_CLIENTAUTH + "=false" + "\n" @@ -80,24 +80,37 @@ + DSigParseInHandler.class.getName() + "\n" ; + - public static IUASSecurityProperties getSecurityProperties() { - UASSecurityProperties uas = new UASSecurityProperties( - new ByteArrayInputStream(sprops.getBytes())); - uas.setSignMessage(true); - return uas; + if (uasSecProps == null) { + uasSecProps = new UASSecurityProperties(new ByteArrayInputStream(sprops + .getBytes())); + uasSecProps.setSignMessage(true); + return uasSecProps; + } + + return uasSecProps; } - - private static UASClientFactory getUASClient(){ + + private static UASClientFactory getSecureUASClient() { if (client == null) { - return new UASClientFactory(getSecurityProperties()); - }else{ + return new UASClientFactory(getSecurityProperties()); + } else { return client; } - + } + private static UASClientFactory getUASClient() { + if (client == null) { + return new UASClientFactory(getSecurityProperties()); + } else { + return client; + } + + } + public static String getXmlFileFromDirAsString(String filePath) { String xmlFile = null; char[] data; @@ -128,13 +141,10 @@ } public static Properties getNamespaces() { - CIS cis = null; Properties p = new Properties(); InputStream is; try { String path = CIS.getProperty(CIS.CIS_NAMESPACE_PATH); - // "src/main/conf/cis.namespaces" - System.out.println(path); File f = new File(path.trim()); if (!f.exists()) { throw new RuntimeException("File either doesnot exist"); @@ -142,7 +152,7 @@ is = new FileInputStream(f); p.load(is); if (!p.isEmpty()) { - logger.info("Number of namespaces found: " + p.size()); + logger.debug("Number of namespaces found: " + p.size()); } } catch (FileNotFoundException e) { throw new RuntimeException( @@ -231,34 +241,47 @@ */ public static CISInfoProvider getProxy(String service_url) { - UASClientFactory client = getUASClient(); CISInfoProvider info = null; try { - info = client.createPlainWSProxy(CISInfoProvider.class, - service_url, getSecurityProperties()); - } catch (MalformedURLException e) { + if (service_url.contains("https")) { + logger.debug("accessing info provider with security " + + service_url); + info = getSecureUASClient().createPlainWSProxy( + CISInfoProvider.class, service_url, + getSecurityProperties()); + } else { + info = getUASClient().createPlainWSProxy(CISInfoProvider.class, + service_url, null); + } + + } catch (Exception e) { e.printStackTrace(); } + return info; } - - /** Extract CIP Url from registration file - * @param file registration file - * */ - - public static String extractCIPURL(File file){ + + /** + * Extract CIP Url from registration file + * + * @param file + * registration file + */ + + public static String extractCIPURL(File file) { CIPRegistrantDocument regDoc = null; String cipUrl = null; try { regDoc = CIPRegistrantDocument.Factory.parse(file); - cipUrl = regDoc.getCIPRegistrant().getEndpointReference().getAddress().getStringValue(); + cipUrl = regDoc.getCIPRegistrant().getEndpointReference() + .getAddress().getStringValue(); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } return cipUrl; } Deleted: CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/dao/TestExistDB.java =================================================================== --- CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/dao/TestExistDB.java 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/dao/TestExistDB.java 2007-11-26 09:53:03 UTC (rev 2048) @@ -1,39 +0,0 @@ -package de.fzj.unicore.cis.dao; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.logging.Logger; - -import org.apache.xmlbeans.XmlException; -import org.w3.x2005.atom.FeedDocument; -import org.xmldb.api.base.Collection; - -import de.fzj.unicore.cis.dao.ExistDBManager; -import junit.framework.TestCase; - -public class TestExistDB extends TestCase { - Logger logger = Logger.getLogger(TestExistDB.class.getName()); - - public void testInsertXmlDocuments() throws XmlException, IOException { - System.out.println("hello in mainnn"); - DBManager hw = new ExistDBManager(); - - // inserting doc - String docName = hw.insert(FeedDocument.Factory.parse( - new File("src/test/resources/atomfeed.xml")).toString()); - System.out.println("Document Name: " + docName); - - } - - public void testXQuery() { - System.out.println("hello in mainnn"); - ExistDBManager hw = new ExistDBManager(); - Collection col = hw.getCollection(); - List<String> lst = hw.query("/"); - int nDocs = lst.size(); - logger.info(nDocs + "Number of documents found"); - assertTrue(nDocs != 0); - } - -} Modified: CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/ws/TestRegistryStandalone.java =================================================================== --- CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/ws/TestRegistryStandalone.java 2007-11-26 08:30:29 UTC (rev 2047) +++ CommonInformationService/cis-core/trunk/src/test/java/de/fzj/unicore/cis/ws/TestRegistryStandalone.java 2007-11-26 09:53:03 UTC (rev 2048) @@ -19,7 +19,7 @@ public class TestRegistryStandalone extends TestCase { //base URL of the server hosting cis - private static final String baseUrl = "http://localhost:7776/services"; + private static final String baseUrl = "http://localhost:8989/services"; Logger logger = Logger.getLogger(TestRegistryStandalone.class.getName()); @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |