Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6009 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar-java-sql- ma/src/main/java/org/perfsonar/service/measurementArchive/ sqlType/fetch perfsonar-java-sql-ma/src/main/java/org/perf sonar/service/measurementArchive/sqlType/store perfsonar-j ava-sql-ma/src/test/java/org/perfsonar/service/measurement Archive/sqlType perfsonar_base/src/main/java/org/perfson ar/base/auxiliary perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/authn perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/configur ation perfsonar_base/src/main/java/org/perfsonar/base/au xiliary/components/configuration/properties perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/c ontext perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/context/inMemory perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/logger p erfsonar_base/src/main/java/org/ perfsonar/base/auxiliar y/components/logger/log4j perfsonar_base/src/main/java/o rg/perfsonar/base/auxiliary/components/mapping perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/scheduler perfsonar_base/src/main/java/org/perfsonar /base/auxiliary/components/scheduler/actions perfsonar_b ase/src/main/java/org/perfsonar/base/auxiliary/components/ simplescheduler perfsonar_base/src/main/java/org/perfson ar/base/exceptions perfsonar_base/src/main/java/org/perf sonar/base/nmwg/owamp perfsonar_base/src/main/java/org/p erfsonar/base/util perfsonar_base/src/main/java/org/perf sonar/base/util/iptrie perfsonar_base/src/main/java/org/ perfsonar/client/axis perfsonar_base/src/main/java/org/p erfsonar/client/base/authn/saslca perfsonar_base/src/mai n/java/org/perfsonar/client/base/requests perfsonar_base /src/main/java/org/perfsonar/client/base/requests/authServ ice perfsonar_base/src/main/java/org/perfsonar/client/ba se/requests/lookupService perfsonar_base/src/main/java/o rg/perfson ar/client/base/xquery perfsonar_base/src/main /java/org/perfsonar/client/base/xquery/lookupService perfs onar_base/src/main/java/org/perfsonar/client/testHarness perfsonar_base/src/main/java/org/perfsonar/service/base /authn perfsonar_base/src/main/java/org/perfsonar/servic e/base/authn/tokens perfsonar_base/src/main/java/org/per fsonar/service/base/container/listeners perfsonar_base/s rc/main/java/org/perfsonar/service/base/engine perfsonar _base/src/main/java/org/perfsonar/service/base/measureme ntExecutor perfsonar_base/src/main/java/org/perfsonar/se rvice/base/messages perfsonar_base/src/main/java/org/per fsonar/service/base/registration perfsonar_base/src/main /java/org/perfsonar/service/base/storage perfsonar_base/ src/main/java/org/perfsonar/service/base/storage/xmldb per fsonar_base/src/main/java/org/perfsonar/service/base/sto rage/xmldb/exist perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/rest perfsonar_base /src/main/java/org/perfsonar/service/base/st orage/xmldb/e xist/xmlrpc perfsonar_base/src/main/java/org/perfsonar/s ervice/base/storage/xmlfile perfsonar_base/src/main/java /org/perfsonar/service/base/transport perfsonar_base/src /main/java/org/perfsonar/service/base/util perfsonar_bas e/src/main/java/org/perfsonar/service/base/web perfsonar _base/src/main/java/org/perfsonar/service/measurementArc hive/eventTypeConfig perfsonar_base/src/main/java/org/pe rfsonar/service/measurementArchive/metadataConfig perfsona r_base/src/main/java/org/perfsonar/service/measurementAr chive/metadataConfig/keyGenerator perfsonar_base/src/mai n/java/org/perfsonar/service/measurementArchive/metadataCo nfig/queryGenerator perfsonar_base/src/main/java/org/per fsonar/service/measurementArchive/register

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/ps-java-services] r6009 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar-java-sql- ma/src/main/java/org/perfsonar/service/measurementArchive/ sqlType/fetch perfsonar-java-sql-ma/src/main/java/org/perf sonar/service/measurementArchive/sqlType/store perfsonar-j ava-sql-ma/src/test/java/org/perfsonar/service/measurement Archive/sqlType perfsonar_base/src/main/java/org/perfson ar/base/auxiliary perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/authn perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/configur ation perfsonar_base/src/main/java/org/perfsonar/base/au xiliary/components/configuration/properties perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/c ontext perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/context/inMemory perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/logger p erfsonar_base/src/main/java/org/ perfsonar/base/auxiliar y/components/logger/log4j perfsonar_base/src/main/java/o rg/perfsonar/base/auxiliary/components/mapping perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/scheduler perfsonar_base/src/main/java/org/perfsonar /base/auxiliary/components/scheduler/actions perfsonar_b ase/src/main/java/org/perfsonar/base/auxiliary/components/ simplescheduler perfsonar_base/src/main/java/org/perfson ar/base/exceptions perfsonar_base/src/main/java/org/perf sonar/base/nmwg/owamp perfsonar_base/src/main/java/org/p erfsonar/base/util perfsonar_base/src/main/java/org/perf sonar/base/util/iptrie perfsonar_base/src/main/java/org/ perfsonar/client/axis perfsonar_base/src/main/java/org/p erfsonar/client/base/authn/saslca perfsonar_base/src/mai n/java/org/perfsonar/client/base/requests perfsonar_base /src/main/java/org/perfsonar/client/base/requests/authServ ice perfsonar_base/src/main/java/org/perfsonar/client/ba se/requests/lookupService perfsonar_base/src/main/java/o rg/perfson ar/client/base/xquery perfsonar_base/src/main /java/org/perfsonar/client/base/xquery/lookupService perfs onar_base/src/main/java/org/perfsonar/client/testHarness perfsonar_base/src/main/java/org/perfsonar/service/base /authn perfsonar_base/src/main/java/org/perfsonar/servic e/base/authn/tokens perfsonar_base/src/main/java/org/per fsonar/service/base/container/listeners perfsonar_base/s rc/main/java/org/perfsonar/service/base/engine perfsonar _base/src/main/java/org/perfsonar/service/base/measureme ntExecutor perfsonar_base/src/main/java/org/perfsonar/se rvice/base/messages perfsonar_base/src/main/java/org/per fsonar/service/base/registration perfsonar_base/src/main /java/org/perfsonar/service/base/storage perfsonar_base/ src/main/java/org/perfsonar/service/base/storage/xmldb per fsonar_base/src/main/java/org/perfsonar/service/base/sto rage/xmldb/exist perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/rest perfsonar_base /src/main/java/org/perfsonar/service/base/st orage/xmldb/e xist/xmlrpc perfsonar_base/src/main/java/org/perfsonar/s ervice/base/storage/xmlfile perfsonar_base/src/main/java /org/perfsonar/service/base/transport perfsonar_base/src /main/java/org/perfsonar/service/base/util perfsonar_bas e/src/main/java/org/perfsonar/service/base/web perfsonar _base/src/main/java/org/perfsonar/service/measurementArc hive/eventTypeConfig perfsonar_base/src/main/java/org/pe rfsonar/service/measurementArchive/metadataConfig perfsona r_base/src/main/java/org/perfsonar/service/measurementAr chive/metadataConfig/keyGenerator perfsonar_base/src/mai n/java/org/perfsonar/service/measurementArchive/metadataCo nfig/queryGenerator perfsonar_base/src/main/java/org/per fsonar/service/measurementArchive/register


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6009 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar-java-sql- ma/src/main/java/org/perfsonar/service/measurementArchive/ sqlType/fetch perfsonar-java-sql-ma/src/main/java/org/perf sonar/service/measurementArchive/sqlType/store perfsonar-j ava-sql-ma/src/test/java/org/perfsonar/service/measurement Archive/sqlType perfsonar_base/src/main/java/org/perfson ar/base/auxiliary perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/authn perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/configur ation perfsonar_base/src/main/java/org/perfsonar/base/au xiliary/components/configuration/properties perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/c ontext perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/context/inMemory perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/logger p erfsonar_base/src/main/java/org/ perfsonar/base/auxiliar y/components/logger/log4j perfsonar_base/src/main/java/o rg/perfsonar/base/auxiliary/components/mapping perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/scheduler perfsonar_base/src/main/java/org/perfsonar /base/auxiliary/components/scheduler/actions perfsonar_b ase/src/main/java/org/perfsonar/base/auxiliary/components/ simplescheduler perfsonar_base/src/main/java/org/perfson ar/base/exceptions perfsonar_base/src/main/java/org/perf sonar/base/nmwg/owamp perfsonar_base/src/main/java/org/p erfsonar/base/util perfsonar_base/src/main/java/org/perf sonar/base/util/iptrie perfsonar_base/src/main/java/org/ perfsonar/client/axis perfsonar_base/src/main/java/org/p erfsonar/client/base/authn/saslca perfsonar_base/src/mai n/java/org/perfsonar/client/base/requests perfsonar_base /src/main/java/org/perfsonar/client/base/requests/authServ ice perfsonar_base/src/main/java/org/perfsonar/client/ba se/requests/lookupService perfsonar_base/src/main/java/o rg/perfson ar/client/base/xquery perfsonar_base/src/main /java/org/perfsonar/client/base/xquery/lookupService perfs onar_base/src/main/java/org/perfsonar/client/testHarness perfsonar_base/src/main/java/org/perfsonar/service/base /authn perfsonar_base/src/main/java/org/perfsonar/servic e/base/authn/tokens perfsonar_base/src/main/java/org/per fsonar/service/base/container/listeners perfsonar_base/s rc/main/java/org/perfsonar/service/base/engine perfsonar _base/src/main/java/org/perfsonar/service/base/measureme ntExecutor perfsonar_base/src/main/java/org/perfsonar/se rvice/base/messages perfsonar_base/src/main/java/org/per fsonar/service/base/registration perfsonar_base/src/main /java/org/perfsonar/service/base/storage perfsonar_base/ src/main/java/org/perfsonar/service/base/storage/xmldb per fsonar_base/src/main/java/org/perfsonar/service/base/sto rage/xmldb/exist perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/rest perfsonar_base /src/main/java/org/perfsonar/service/base/st orage/xmldb/e xist/xmlrpc perfsonar_base/src/main/java/org/perfsonar/s ervice/base/storage/xmlfile perfsonar_base/src/main/java /org/perfsonar/service/base/transport perfsonar_base/src /main/java/org/perfsonar/service/base/util perfsonar_bas e/src/main/java/org/perfsonar/service/base/web perfsonar _base/src/main/java/org/perfsonar/service/measurementArc hive/eventTypeConfig perfsonar_base/src/main/java/org/pe rfsonar/service/measurementArchive/metadataConfig perfsona r_base/src/main/java/org/perfsonar/service/measurementAr chive/metadataConfig/keyGenerator perfsonar_base/src/mai n/java/org/perfsonar/service/measurementArchive/metadataCo nfig/queryGenerator perfsonar_base/src/main/java/org/per fsonar/service/measurementArchive/register
  • Date: Fri, 5 Oct 2012 10:22:42 +0100 (BST)

Author: nordunet.behrmann
Date: 2012-10-05 10:22:41 +0100 (Fri, 05 Oct 2012)
New Revision: 6009

Modified:

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java

trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java

trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java

trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryThreadedComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentNames.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentsConfigurationReader.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/DynamicCrypto.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/ConfigurationComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/properties/PropertiesConfigurationComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/PerfsonarContextComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/inMemory/InMemoryContext.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/LoggerComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/log4j/Log4jLoggerComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/mapping/ExpressionMapping.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageHandler.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageParser.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/Scheduler.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/GenericSchedulerAction.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/SchedulerAction.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/Scheduler.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerAction.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerTask.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/exceptions/PerfSONARException.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/nmwg/owamp/Parameters.java
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/MathUtil.java
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/NetUtil.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/StringBufferOutputStream.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/TimeDateUtil.java
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/XMLUtils.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Constants.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/HelperClass.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddress.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/InvalidIPAddressException.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrie.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrieNode.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/StringBufferUtilities.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/SummarizeIpAddrs.java
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Trie.java

trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/TrieNode.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/AxisClient.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClient.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClientConfiguration.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/RequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthNEERequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthREERequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/EchoRequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSDeregisterRequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSKeepaliveRequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSQueryRequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSRegisterRequestGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/XQueryExpression.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/lookupService/GenericXQueryExpression.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClient.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClientMulti.java

trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPUbCClient.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenSOAPManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngine.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngineFactory.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/measurementExecutor/MeasurementExecutor.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/DataRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/EchoRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSCleanupRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSDeregisterRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSKeepaliveRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSQueryRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRegisterRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LinkRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LookupInfoRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MeasurementRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandler.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandlerFactory.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/Request.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/TOPSRequest.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/GenericServiceLSRegistrator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationContextServiceContent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationExistDbXmlrpcServiceContent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationXMLFileServiceContent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSListAddresses.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSSummaryServiceContent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/PropertiesServiceDescription.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceContent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceDescription.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceLSRegistrator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/GenericXmlStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/NMWGStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/StorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbConstants.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbDataRepository.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbResult.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbFactory.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbGenericStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbErrorException.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHTTPAccess.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlDataRepository.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPAccess.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPResult.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlDataRepository.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileDataRepository.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransport.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransportFactory.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/Location.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/SSHFileTransport.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/util/ResultCodesUtil.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/MetadataConfigurationStorageManager.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/Transformations.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGeneratorFactory.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/IperfQueryGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGeneratorTMP.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGeneratorFactory.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java

trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
Log:
perfsonar_base, perfsonar-java-sql-ma: Strip trailing white space

Issue: PSSERVICES-588

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/BaseChainingMergerFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,7 +11,7 @@
import java.util.Set;

/**
- * Factory class which can be used to get the appropriate
+ * Factory class which can be used to get the appropriate
* object for merging the base chaining.
*
* @author romradz

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -269,7 +269,7 @@
+ "Empty ibatisConfig parameter in the key");


- // getting data from Datum
+ // getting data from Datum
try {

String resource = (String) ibatisParams.get("ibatisConfig");

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/SQLTypeMAServiceEngine.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -203,7 +203,7 @@
}


- public Message storeKey(Message request)
+ public Message storeKey(Message request)
throws PerfSONARException {

metadataConfig.store(request);

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/OwampResponseGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -12,7 +12,7 @@

/**
* Creates the response of service for owamp data.
- *
+ *
* @author fernandes
* @author <a
href="mailto:">Piotr
Pikusa</a>
*/

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/fetch/ResponseGeneratorFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,7 +17,7 @@


/**
- * Creates relevant ResponseGenerator object
+ * Creates relevant ResponseGenerator object
* according to the value of eventType.
*
* @author romradz
@@ -26,7 +26,7 @@



- public static ResponseGenerator getResponseGenerator(String
eventTypeName)
+ public static ResponseGenerator getResponseGenerator(String
eventTypeName)
throws PerfSONARException {


@@ -71,7 +71,7 @@

try {

- responseGenerator =
+ responseGenerator =
(ResponseGenerator)
Class.forName(className).newInstance();


Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/OwampStoreRequestProcess.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -13,7 +13,7 @@

/**
* Moves data from nmwg data element into ibatis map structure
- *
+ *
* @author fernandes
*/
public class OwampStoreRequestProcess extends StoreRequestProcess {
@@ -28,7 +28,7 @@

/**
* For test purposes only.
- *
+ *
* @param test
*/
public OwampStoreRequestProcess(String test) {

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcess.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -20,7 +20,7 @@
import org.perfsonar.base.exceptions.PerfSONARException;

/**
- * Abstract class for moving data from Data element into ibatis map
structure.
+ * Abstract class for moving data from Data element into ibatis map
structure.
*
* @author romradz
*/
@@ -59,7 +59,7 @@
}

}
-
+
/**
* For test purposes only. Otherwise UnitTests cannot be made with this
class because main constructor cannot find the logger
* @param test
@@ -74,7 +74,7 @@



- public void process(SqlMapClient sqlMap, Data data, Map ibatisParams)
+ public void process(SqlMapClient sqlMap, Data data, Map ibatisParams)
throws Exception {

Vector datumVector = data.getDatum();

Modified:
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/main/java/org/perfsonar/service/measurementArchive/sqlType/store/StoreRequestProcessFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,15 +17,15 @@


/**
- *
*
+ *
* @author romradz
*/
public class StoreRequestProcessFactory {



- public static StoreRequestProcess getStoreRequestProcess(String
eventTypeName)
+ public static StoreRequestProcess getStoreRequestProcess(String
eventTypeName)
throws PerfSONARException {


@@ -70,7 +70,7 @@

try {

- storeRequestProcess =
+ storeRequestProcess =
(StoreRequestProcess)
Class.forName(className).newInstance();


Modified:
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampResponseGeneratorTest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,7 +17,7 @@
public class OwampResponseGeneratorTest {

/**
- * This test should verify if returned Datum is valid.
+ * This test should verify if returned Datum is valid.
*/
@Test
public void shouldReturnDatum(){
@@ -25,7 +25,7 @@
Map<String, String> row = new HashMap<String, String>();
row.put("seqNum", "1");
row.put("sendTime", "1.0");
- row.put("sendSynchronized", "1");
+ row.put("sendSynchronized", "1");
row.put("sendTimeError", "1.0");
row.put("receiveTime", "1.0");
row.put("receiveTimeError", "1.0");
@@ -44,20 +44,20 @@

List<Map<String, String>> list = new
ArrayList<Map<String,String>>();
list.add(row);
-
+
String s = "";
java.util.Vector datumTest;
-
+
//when
try{
Data d = new OwampResponseGenerator("test").getResponse(list);
datumTest = d.getDatum();
s = datumTest.toString();
- s = s.substring(1, s.length() -1); //This is because
vector.toString() method begins and ends with "[]" brackets, while
Datum.toString() not.
+ s = s.substring(1, s.length() -1); //This is because
vector.toString() method begins and ends with "[]" brackets, while
Datum.toString() not.
}catch(Exception e){
e.printStackTrace();
}
-
+
//then
Assert.assertEquals(datum.toString(), s);

@@ -103,22 +103,22 @@

List<Map<String, String>> list = new
ArrayList<Map<String,String>>();
list.add(row);
-
+
String s = "";
java.util.Vector datumTest;
-
+
//when
try{
Data d = new OwampResponseGenerator("test").getResponse(list);
datumTest = d.getDatum();
s = datumTest.toString();
- s = s.substring(1, s.length() -1); //This is because
vector.toString() method begins and ends with "[]" brackets, while
Datum.toString() not.
+ s = s.substring(1, s.length() -1); //This is because
vector.toString() method begins and ends with "[]" brackets, while
Datum.toString() not.
}catch(Exception e){
e.printStackTrace();
}
-
+
//then
-
+
//System.out.println(datum.toString());
//System.out.println(s);
Assert.assertEquals(datum.toString(), s);
@@ -128,4 +128,3 @@


}
-
\ No newline at end of file

Modified:
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -50,7 +50,7 @@
}


- @Test
+ @Test
public void
shouldReturnIbatisParamsWhenOwampAggregationDatumIsGiven(){
OwampAggregationDatum datum = new OwampAggregationDatum();

datum.setSender("sender");
@@ -86,7 +86,7 @@
ibatisParams.put("jitter"
,Float.parseFloat(datum.getJitter()));
ibatisParams.put("jitterUnits" , datum.getJitterUnits());
ibatisParams.put("hops" , Integer.parseInt(datum.getHops()));
-
+
// when
Map<String, Object> ibatisParamsTest = new
OwampStoreRequestProcess("test").prepareStoreParameters(datum, new
HashMap<String, Object>());


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -5,31 +5,31 @@
/**
* AuxiliaryComponent is an interface for all components loaded and
* controlled by AuxiliaryComponentManager.
- *
+ *
* @author Maciej Glowiak
*
*/
public interface AuxiliaryComponent {
-
-
+
+
/**
- * Method used for initialize AuxiliaryComponent
+ * Method used for initialize AuxiliaryComponent
* @throws SystemException
*/
public void initComponent() throws PerfSONARException;
-
-
+
+
/**
* Get component name
* @return name as String
*/
public String getComponentName();
-
+
/**
* Set component name
* @param name name of component
*/
public void setComponentName(String name);

-
+
} //AuxiliaryComponent

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,10 +17,10 @@
* AuxiliaryComponentManager is a register for components - modules of
* the application. It loads components mapping from its configuration file,
* defined in components.properties system property.
- *
+ *
* AuxiliaryComponentManager may be either a standalone application or a
- * static, persistent part of Axis servlet
- *
+ * static, persistent part of Axis servlet
+ *
* @author Maciej Glowiak
* @author Uros Juvan (added componentsIterator)
* @author Michael Bischoff
@@ -39,7 +39,7 @@

private static volatile boolean initialised;
private static volatile boolean isInitialising;
-
+
// ----------------------------------------------------- Instance
variables
/**
* Map of components (component_name, component object reference)
@@ -49,14 +49,14 @@
private String webInfLocation;

private File tempDirectory;
-
+
// ------------------------------------------------------------
Constructor
/**
* Private constructor - object can be created by static getInstance()
* method (singleton pattern) only
*/
private AuxiliaryComponentManager() {}
-
+
// --------------------------------------------------------- Public
methods
/**
* Set up the manager. Load mappings from components.properties file
@@ -66,34 +66,34 @@
//read components from Configuration file and init them
//String configFileName =
"/projects/sonar/perfsonar/conf/components.properties";
File componentsProperties =
lookupFile("/perfsonar/conf/components.properties");
-
- if(componentsProperties==null) {
+
+ if(componentsProperties==null) {
throw new PerfSONARException(
"AuxiliaryComponentManager.initManager: " +
"Missing or unable to locate components.properties file.
Cannot continue"
);
}
-
+
logger.info("AuxiliaryComponentManager.initManager: Read config file
name as: "+componentsProperties);
try {
//read configfile into properties (name, value)
ArrayList<ComponentsConfigurationReader.Entry> properties = new
ComponentsConfigurationReader().readFile(componentsProperties.getCanonicalPath());
-
+
//for each entry in properties - create and initialize component
for (ComponentsConfigurationReader.Entry e : properties) {
- String componentName = e.getName();
+ String componentName = e.getName();
String componentClassName = e.getValue();
-
- try {
+
+ try {
logger.fine("AUX ComponentManager creating
["+componentName+"] = "+componentClassName);
AuxiliaryComponent component =
loadComponent(componentName, componentClassName);
logger.finer("AUX ComponentManager: init
["+componentName+"]");
- component.initComponent();
+ component.initComponent();
} catch (PerfSONARException ex) {

logger.throwing(AuxiliaryComponentManager.class.getName(), "initmanager()",
ex);
//do nothing - not critical exception, just load other
modules
- }
- }
+ }
+ }
} catch (FileNotFoundException e) {
throw new PerfSONARException(
"error.common.manager.no_configuration",
@@ -107,18 +107,18 @@
e
);
}
-
+
return true;
}
-

+
/**
* This method loads a component. It creates Component object, adds
* it to components map and initializes it.
- *
+ *
* @param componentName
* @param componentClassName
- * @throws PerfSONARException
+ * @throws PerfSONARException
*/
public AuxiliaryComponent loadComponent(String componentName, String
componentClassName) throws PerfSONARException {

@@ -128,31 +128,31 @@

AuxiliaryComponent component;

- try {
+ try {
//create component from classname
Class<?> componentClass = Class.forName(componentClassName);
component = (AuxiliaryComponent)componentClass.newInstance();
-
+
//set component name
component.setComponentName(componentName);
-
+
//add component to the list of components
setComponent(componentName, component);
} catch (ClassNotFoundException ex) {
String m = "AUXComponentManager: " +
"can't create component ["+componentName+"]. " +
"Encountered ClassNotFound Exception. Message: "+ex.getMessage();
- throw new
PerfSONARException("error.common.manager.cant_create_component", m);

+ throw new
PerfSONARException("error.common.manager.cant_create_component", m);
} catch (InstantiationException ex) {
String m = "AUXComponentManager: " +
"can't create component ["+componentName+"]. " +
"Encountered Instantiation Exception. Message: "+ex.getMessage();
- throw new
PerfSONARException("error.common.manager.cant_create_component", m);

+ throw new
PerfSONARException("error.common.manager.cant_create_component", m);
} catch (IllegalAccessException ex) {
String m = "AUXComponentManager: " +
"can't create component ["+componentName+"]. " +
"Encountered IllegalAccess Exception. Message: "+ex.getMessage();
- throw new
PerfSONARException("error.common.manager.cant_create_component", m);

+ throw new
PerfSONARException("error.common.manager.cant_create_component", m);
}

return component;
@@ -164,50 +164,50 @@
* @param name name of the component
* @param component object
*/
- protected void setComponent(String name, AuxiliaryComponent component) {

- components.put(name, component);
+ protected void setComponent(String name, AuxiliaryComponent component) {
+ components.put(name, component);
}
-
+
/**
* Return component for specified mapping
* @param name name of the component
* @return Auxiliary Component
*/
public AuxiliaryComponent getComponent(String name) {
- return components.get(name);
+ return components.get(name);
}
-
+
/**
* Return key,value pair iterator over components Map.
* @return iterator over pair Map.Entry<String, AuxiliaryComponent>
*/
public Iterator<Map.Entry<String, AuxiliaryComponent>>
componentsIterator() {
-
+
return components == null ? null : components.entrySet().iterator();
-
+
}
-
+
/**
* Should be set and thus this shouldn't return null
- * @return temp directory that exist can be read and written to or null
+ * @return temp directory that exist can be read and written to or null
* if this
{@link
AuxiliaryComponentManager} was incorrectly configured
*/
public File getTempDirectory() {
return tempDirectory;
}
-
+
// --------------------------------------------------------- static
methods
/**
* Method creates Auxiliary Component Manager and load all components.
* It's singleton pattern
- *
+ *
* TODO remove exception from signature.
*/
public static AuxiliaryComponentManager getInstance() throws
PerfSONARException {
// initialation must be lazy because of AxisMessageContext.
if(!initialised) {
synchronized (initialiseMutex) {
- // avoid other threads from also initialising
+ // avoid other threads from also initialising
// defend against endless loop. (calling
getInstance() within initManager();)
if(!initialised && !isInitialising) {
isInitialising = true;
@@ -223,10 +223,10 @@
* For stand-alone applications
*/
public static void main(String[] args) throws PerfSONARException {
-
+
//components.properties =
projects/sonar/perfsonar/conf/components.properties
AuxiliaryComponentManager.getInstance();
-
+
}

/**
@@ -266,11 +266,11 @@

// try absolute
File file = new File(location);
- return (file.exists()) ? file : null;
+ return (file.exists()) ? file : null;
}
-
+
/**
- * Set the WebInf Location, a application doesn't necessarily need to do
this.
+ * Set the WebInf Location, a application doesn't necessarily need to do
this.
* @param location
*/
public static void setWebInfLocation(String location) {
@@ -285,7 +285,7 @@
componentManager.webInfLocation = normalisedLocation;
}
}
-
+
/**
* Sets the temp directory of the application this needs to be set.
* @param directory
@@ -296,7 +296,7 @@
if(!directory.canWrite()) throw new IllegalArgumentException("Temp
directory can't be written to.");
componentManager.tempDirectory = directory;
}
-
+
private static String slashify(String path) {
String p = path;
if (File.separatorChar != '/')
@@ -305,5 +305,5 @@
p = "/" + p;
return p;
}
-
+
} //AuxiliaryComponentManager

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryThreadedComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryThreadedComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryThreadedComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -4,17 +4,17 @@
/**
* AuxiliaryThreadedComponent is extension of AuxiliaryComponent supporting
* stop method, causing threaded components to stop.
- *
+ *
* @author Uros Juvan
*
*/
public interface AuxiliaryThreadedComponent extends AuxiliaryComponent {
-
-
+
+
/**
* Method stopping the thread.
*/
public void stopThread();

-
+
} //AuxiliaryComponent

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentNames.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentNames.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentNames.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -2,18 +2,18 @@

/**
* Interface contains common component names
- *
+ *
* @author Maciej Glowiak
*
*/
public interface ComponentNames {
-
+
public static final String CONFIG = "config";
-
+
public static final String LOGGER = "logger";
-
+
public static final String SCHEDULER = "scheduler";
-
+
public static final String REGISTRATOR = "registrator";

public static final String AUTHN = "authn";
@@ -21,6 +21,6 @@
/** The context aux-component is a simple in-application map
* that allows sharing of data */
public static final String CONTEXT = "context";
-
-
+
+
} //ComponentNames

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentsConfigurationReader.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentsConfigurationReader.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentsConfigurationReader.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -6,10 +6,10 @@
import java.util.ArrayList;

/**
- * ComponentsConfigurationReader is simple reader of a config -
- * properties file.
- *
- * It parses file and stores property name and value as ordered
+ * ComponentsConfigurationReader is simple reader of a config -
+ * properties file.
+ *
+ * It parses file and stores property name and value as ordered
* ArrayList<ComponentsConfigurationReader.Entry>
* @author Maciej Glowiak
*
@@ -20,13 +20,13 @@
* Reads properties file and returns an ArrayList of Entry (pair of
* strings: name and value )
* @return ArrayList of Entry
- * @throws IOException
+ * @throws IOException
*/
public ArrayList<Entry> readFile(String filename) throws IOException {

ArrayList<Entry> listProperties = new ArrayList<Entry>();
BufferedReader input;
-
+
input = new BufferedReader(new FileReader(filename));
String line; // not declared within while loop
while ((line = input.readLine()) != null) {
@@ -45,21 +45,21 @@
}
input.close();
return listProperties;
-
+
}

// --------------------------------------------------- Inner class
-
+
public class Entry {
-
+
private String name;
private String value;
-
+
public Entry(String name, String value) {
this.name=name;
this.value=value;
}
-
+
public String getName() {
return name;
}
@@ -67,7 +67,7 @@
public String getValue() {
return value;
}
-
+
} //Entry
-
+
} //ComponentsConfig

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/DynamicCrypto.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/DynamicCrypto.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/DynamicCrypto.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -41,7 +41,7 @@
protected Properties properties = null;
protected KeyStore keystore = null;
static String SKI_OID = "2.5.29.14";
-
+
public DynamicCrypto() throws CredentialException {
properties=new Properties();
try {
@@ -52,7 +52,7 @@
throw new CredentialException(3, "cryptError00", e);
}
}
-
+
public DynamicCrypto(KeyStore ks) {
properties=new Properties();
this.keystore=ks;
@@ -492,7 +492,7 @@
} catch (GeneralSecurityException ex) {
throw new WSSecurityException(
WSSecurityException.FAILURE,
- "certpath",
+ "certpath",
new Object[] { ex.getMessage() },
ex
);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/ConfigurationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/ConfigurationComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/ConfigurationComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -8,13 +8,13 @@
/**
* Interface contains common functionality for all implementation
* of Configuration Components
- *
+ *
* @author Maciej Glowiak
*
*/
public interface ConfigurationComponent {

-
+
/**
* Operation which provides access to individual property
*
@@ -23,8 +23,8 @@
* @throws PerfSONARException when property couldn't be read
*/
public String getProperty(String name) throws PerfSONARException;
-
+
public Properties getProperties() throws PerfSONARException;
-
-
+
+
} //ConfigurationComponent
\ No newline at end of file

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/properties/PropertiesConfigurationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/properties/PropertiesConfigurationComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/properties/PropertiesConfigurationComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,7 +17,7 @@
* @author Maciej Glowiak
*
*/
-public class PropertiesConfigurationComponent
+public class PropertiesConfigurationComponent
implements AuxiliaryComponent, ConfigurationComponent {

private Logger logger =
Logger.getLogger(PropertiesConfigurationComponent.class.getName());
@@ -28,12 +28,12 @@
* Component Name
*/
private String componentName = null;
-
+
/**
* Properties
*/
private Properties properties = null;
-
+
/**
* File with properties
*/
@@ -44,16 +44,16 @@
public void initComponent() throws PerfSONARException {
// bootstrapped absolute file location in catalina.properties file
file =
AuxiliaryComponentManager.lookupFile("/perfsonar/conf/service.properties");
-
- if(file==null) {
+
+ if(file==null) {
logger.severe("PropertiesConfigurationComponent.initComponent:" +
" Missing or unable to locate service.properties file. Cannot
initialise PropertiesConfigurationComponent.");
-
+
throw new
PerfSONARException("PropertiesConfigurationComponent.initComponent:" +
" Missing or unable to locate service.properties file. Cannot
initialise PropertiesConfigurationComponent.");
}
logger.info("PropertiesConfigurationComponent.initComponent: Read
the file name as: "+file);
- // load configuration
+ // load configuration
this.loadConfiguration();
}

@@ -64,7 +64,7 @@
/**
* Operation which provides all the properties read from the file
*
- * @return Properties - static object containing all the properties
+ * @return Properties - static object containing all the properties
* in the property file
*
* @throws PerfSONARException when properties couldn't be read
@@ -76,7 +76,7 @@


/**
- * Operation which provides access to individual properties read
+ * Operation which provides access to individual properties read
* from the property file
*
* @param name of the parameter
@@ -98,18 +98,18 @@
"PropertiesConfigurationComponent.getProperty: "
+ "Requested Param: "+ name + "not found");
}
-
+
return property;
}

-
+
@Override
public String getComponentName() {
-
+
return componentName;
-
+
}
-
+
@Override
public void setComponentName(String componentName) {
this.componentName = componentName;
@@ -138,6 +138,6 @@
throw new PerfSONARException(e.getMessage());
}
}
-
-
+
+
} //PropertiesConfigurationComponent

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/PerfsonarContextComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/PerfsonarContextComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/PerfsonarContextComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -2,7 +2,7 @@

/**
* Provides a context in which data can be shared among components.
- *
+ *
* @author michael.bischoff
*
*/
@@ -15,7 +15,7 @@
Object get(Object key);

/**
- * @param key
+ * @param key
* @param value or null
*/
void put(Object key, Object value);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/inMemory/InMemoryContext.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/inMemory/InMemoryContext.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/context/inMemory/InMemoryContext.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -8,9 +8,9 @@
import org.perfsonar.base.exceptions.PerfSONARException;

/**
- * A in-memory implementation of
{@link
PerfsonarContextComponent}
+ * A in-memory implementation of
{@link
PerfsonarContextComponent}
* data doesn't survive restarts.
- *
+ *
* @author michael.bischoff
*/
public class InMemoryContext implements AuxiliaryComponent,
PerfsonarContextComponent {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/LoggerComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/LoggerComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/LoggerComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -1,14 +1,14 @@
package org.perfsonar.base.auxiliary.components.logger;
/**
- * Interface contains common methods for all
+ * Interface contains common methods for all
* Configuration Components
- *
+ *
* @author Maciej Glowiak
*
*/
public interface LoggerComponent {

-
+
/**
* Logs a message with debug log level.
*
@@ -16,7 +16,7 @@
*/
public abstract void debug(String message);

-
+
/**
* Logs a message with info log level.
*
@@ -24,7 +24,7 @@
*/
public abstract void info(String message);

-
+
/**
* Logs a message with warn log level.
*
@@ -32,7 +32,7 @@
*/
public abstract void warn(String message);

-
+
/**
* Logs a message with error log level.
*
@@ -40,7 +40,7 @@
*/
public abstract void error(String message);

-
+
/**
* Logs a message with fatal log level.
*
@@ -48,5 +48,5 @@
*/
public abstract void fatal(String message);

-
+
} //LoggerComponent
\ No newline at end of file

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/log4j/Log4jLoggerComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/log4j/Log4jLoggerComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/log4j/Log4jLoggerComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -18,10 +18,10 @@
* @author Roman Lapacz
* @author Maciej Glowiak
*/
-public class Log4jLoggerComponent
+public class Log4jLoggerComponent
implements AuxiliaryComponent, LoggerComponent {

-
+
private static final String CALLER_FQCN =
Log4jLoggerComponent.class.getName();

// ---------------------------------- class fields
@@ -40,7 +40,7 @@
ConfigurationComponent configuration;

// ---------------------------------- constructors
-
+
/* Default no arg constructor */
public Log4jLoggerComponent() { /* no arg constructor */
}
@@ -57,24 +57,24 @@
fatalLog = Logger.getLogger("sonar-fatal");

configuration =
(ConfigurationComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
-
+
String logconf =
configuration.getProperty("service.log.log4j.config");
File logConfiguration =
AuxiliaryComponentManager.lookupFile(logconf);
-
+
if(logConfiguration!=null) {

PropertyConfigurator.configure(logConfiguration.getAbsolutePath());
} else {
System.err.println("PerfSONAR:WARNING: perfsonar logging not
configured correctly. (specified logging properties file['"+logconf+"'] not
found.)");
- }
+ }
} catch(Exception ex) {
System.err.println("PerfSONAR:WARNING: perfsonar logging not
configured correctly.");
ex.printStackTrace();
}
-
+
}
-
-
-
+
+
+
/**
* Sets log4j congiguration file
*
@@ -84,7 +84,7 @@

PropertyConfigurator.configure(configFile);

- }
+ }

/* (non-Javadoc)
* @see
org.perfsonar.commons.auxiliary.components.logger.log4j.LoggerComponent#debug(java.lang.String)
@@ -135,5 +135,5 @@
public void setComponentName(String componentName) {
this.componentName = componentName;
}
-
+
} //Log4jLoggerComponent

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/mapping/ExpressionMapping.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/mapping/ExpressionMapping.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/mapping/ExpressionMapping.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -15,42 +15,42 @@

/**
* @author Maciej Glowiak
- *
+ *
*/
public class ExpressionMapping implements AuxiliaryComponent {
-
-
+
+
// -------------------------------------------- Instance variables
-
-
+
+
private String componentName = "expression_mapping";
-
+
private Map<String,String> mappings;
-
-
+
+
// --------------------------------------------------- Constructor
-
-
+
+
public ExpressionMapping() {
-
+
mappings = new HashMap<String,String>();
-
+
}
-
-
+
+
// ------------------------------------------------ Public methods
-
+
/**
- * Reads configuration mapping from file given as
+ * Reads configuration mapping from file given as
* component.ComponentName.mapping_file property
*/
@Override
public void initComponent() throws PerfSONARException {
-
+
LoggerComponent logger = ((LoggerComponent)
AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.LOGGER));
-
+
String filename = ((ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.CONFIG)).
@@ -58,11 +58,11 @@
"component."
+getComponentName()
+".mapping_file");
-
+
logger.debug(
"ExpressionMapping: read mapping config file:" + filename);
-
- ComponentsConfigurationReader confread =
+
+ ComponentsConfigurationReader confread =
new ComponentsConfigurationReader();

try {
@@ -70,34 +70,34 @@
mappings.put(e.getName(), e.getValue());
}
} catch (IOException e1) {
- logger.error("ExpressionMapping: read mapping config file:"
+ logger.error("ExpressionMapping: read mapping config file:"
+ filename);
}
-
+
}

-
+
@Override
public String getComponentName() {
-
+
return componentName;
-
+
}

-
+
@Override
public void setComponentName(String name) {
-
+
componentName = name;
-
+
}
-

+
/**
* Return mapping with applied replacements as Map
*/
public String getMapping(String mappingName, Map<String,String>
replacements) {
-
+
String out = mappings.get(mappingName);
if (replacements!=null && out!=null) {
for (String e : replacements.keySet()) {
@@ -106,25 +106,25 @@
}
}
return out;
-
+
}

/**
* Return mapping without any replacements
*/
public String getMapping(String mappingName) {
-
+
return getMapping(mappingName, null);
-
+
}
-

+
/**
* Replace mapping with one replacement
*/
public String getMapping(
- String mappingName,
- String pattern,
+ String mappingName,
+ String pattern,
String replacement) {
String out = mappings.get(mappingName);
if (pattern!=null & out!=null && replacement!=null) {
@@ -132,8 +132,8 @@
out.replaceAll(regexp,replacement);
}
return out;
-
+
}
-
-
+
+
} //ExpressionMapping

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageHandler.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageHandler.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageHandler.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,9 +17,9 @@


/**
- * Message Handler for scheduler which extends nmwg handler by adding the
+ * Message Handler for scheduler which extends nmwg handler by adding the
* capability to retrieve element objects and not just complete message
object
- *
+ *
* @author loukik
* @author Roman
*/
@@ -29,25 +29,25 @@

protected LoggerComponent logger;

-
+
// ------------------------------------ constructor

public ScheduleMessageHandler() throws PerfSONARException {
super();
-
+
this.logger =
(LoggerComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
-
-
+
+
}

// ------------------------------------ public methods
-
+
/**
* Returns an element object for the given name
- * @param elementName object of type String containing the given name
+ * @param elementName object of type String containing the given name
*/
public Object getElement(String elementName) {
-
+
Iterator it = ht.values().iterator();
Element element = null;
boolean found = false;
@@ -68,10 +68,10 @@

logger.debug("ScheduleMessageHandlerElement parsed in this XML
document");
return element;
-
+
}
-
+
} //SchedulerMessageHandler
-
-

+
+

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageParser.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageParser.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageParser.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -29,18 +29,18 @@
/**
* Message Parser for Scheduler. It provides the capability to parse a
string object
* It uses ScheduleMessageHandler as its default xml event handler
- *
+ *
* @author loukik
- *
+ *
*/
public class ScheduleMessageParser {

protected LoggerComponent logger;
-
+
protected ConfigurationComponent configurationComponent;
-
+
protected ScheduleMessageHandler handler;
-
+
/* feature ids */
public static final String NAMESPACES_FEATURE_ID =
"http://xml.org/sax/features/namespaces";;
public static final String NAMESPACE_PREFIXES_FEATURE_ID =
"http://xml.org/sax/features/namespace-prefixes";;
@@ -52,45 +52,45 @@

/**
* Constructor which initializes loggers, configuration components and
handlers
- *
+ *
* @throws PerfSONARException
*/
public ScheduleMessageParser() throws PerfSONARException {
-
+
logger =
(LoggerComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
-
+
configurationComponent =
(ConfigurationComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
-
+
handler = new ScheduleMessageHandler();
}
-
-
-
+
+
+
// ------------------------------------ public methods
-
+
/**
* Parses xml in a document in order to convert it into a message object
- *
+ *
* @param object of type org.w3c.dom.Document containing the given xml
* @throws PerfSONARException
* @throws RequestException
- *
+ *
*/
public void parse(Document document) throws PerfSONARException {
-
+
if(document==null) {
-
+
throw new PerfSONARException(
- "error.common.parse_error",
+ "error.common.parse_error",
"ScheduleMessageHandler.parse: Document object in request
is null. Nothing to parse");
-
+
}
-
+
XMLSerializer serializer = new XMLSerializer();
ByteArrayOutputStream boStream = new ByteArrayOutputStream();
-
+
serializer.setOutputByteStream(boStream);
-
+
try {
serializer.serialize(document);
} catch (IOException e) {
@@ -101,52 +101,52 @@
"ScheduleMessageHandler- IO exception encountered while "
+ "serializing request document@: "+ e.getMessage());
}
-
+
InputSource ipSrc = new InputSource(
new ByteArrayInputStream(boStream.toByteArray()));
-
+
this.parse(ipSrc);
}
-
-
+
+
/**
* Parses xml present in a string object in order to convert it into a
message object
- *
+ *
* @param requestString object of type string containing given xml
* @throws PerfSONARException
* @throws RequestException
*/
public void parse(String requestString) throws PerfSONARException {
-
+
if(requestString==null) {
-
+
throw new PerfSONARException(
"error.common.parse_error",
"ScheduleMessageHandler.parse: String object in request
is null. Nothing to parse");
-
+
}
-
+
StringReader reader = new StringReader(requestString);
-
+
InputSource ipSrc = new InputSource(reader);
-
+
this.parse(ipSrc);
-
+
}
-
+
/**
* Parses xml presented as an input source
- *
+ *
* @param inputSource object of type InputSource containing xml
* @throws PerfSONARException
* @throws RequestException
*/
public void parse(InputSource inputSource) throws PerfSONARException {
-
-


- String f =
+
+
+ String f =
configurationComponent.getProperty("service.sax_parser.config");

Handler.setConfigFile(f);
@@ -154,13 +154,13 @@

try {

- final javax.xml.parsers.SAXParserFactory saxParserFactory =
- javax.xml.parsers.SAXParserFactory.newInstance();
+ final javax.xml.parsers.SAXParserFactory saxParserFactory =
+ javax.xml.parsers.SAXParserFactory.newInstance();
//saxParserFactory.setValidating(true);
saxParserFactory.setNamespaceAware(true);

- final javax.xml.parsers.SAXParser saxParser =
- saxParserFactory.newSAXParser();
+ final javax.xml.parsers.SAXParser saxParser =
+ saxParserFactory.newSAXParser();
final org.xml.sax.XMLReader parser = saxParser.getXMLReader();

boolean namespaces = DEFAULT_NAMESPACES;
@@ -181,7 +181,7 @@
logger.fatal("ScheduleMessageHandler.parse: SAX Exception
occurred while "
+ "satisfying request. Error Message: "
+ e.getMessage());
- throw new PerfSONARException("error.common.parse_error",
+ throw new PerfSONARException("error.common.parse_error",
"Request could not be parsed because "
+ "of SAX exception. Error message: "
+ e.getMessage());
@@ -210,17 +210,17 @@
+ "Exception " + e.getMessage());

}
-
+
}
-
+
/**
* Returns element object for the given name
* @param elementName string object containing the name of the element
* @return element object for the given name
*/
public Object getElement(String elementName) {
-
+
return (this.handler.getElement(elementName));
}
-
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/Scheduler.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/Scheduler.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/Scheduler.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -26,120 +26,120 @@


/**
- * This class provides the capability to read and write schedules into an
xml database.
+ * This class provides the capability to read and write schedules into an
xml database.
* @author loukik
*
*/
public class Scheduler extends Thread implements AuxiliaryComponent {
-
-
+
+
// ----------------------------Member Variables

protected LoggerComponent logger;
-
+
protected ConfigurationComponent configurationComponent;
-
+
private String componentName = "SCHEDULER";
-
+
private boolean working = true;
-
+
// ----------------------------Constructor
-
+
@Override
public void initComponent() throws PerfSONARException {
-
+
try {
-
+
logger =
(LoggerComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
-
+
configurationComponent =
(ConfigurationComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
-
-
+
+
} catch (PerfSONARException e) {

System.out.println("Scheduler: ERROR! Scheduler could not be
initialized because " +
"either ServiceConfigurationManager or Log could not be
initialized. " +
"Scheduler cannot continue without these components");
-
- throw new PerfSONARException("error.common.scheduler.init",
+
+ throw new PerfSONARException("error.common.scheduler.init",
"Scheduler: ERROR! Scheduler could not be initialized
because " +
"either ServiceConfigurationManager or Log could not be
initialized. " +
"Scheduler cannot continue without these components.
Error message: "+e.getMessage());
-
+
}

//start Thread;
this.start();
-
+
}
-
-
+
+
@Override
public String getComponentName() {
-
+
return componentName;
-
+
}

-
+
@Override
public void setComponentName(String componentName) {
-
+
this.componentName = componentName;
-
+
}
-
-
+
+
public boolean isWorking() {
-
+
return working;
-
+
}


public void setWorking(boolean working) {
-
+
this.working = working;
-
+
}
-
-
+
+
@Override
public void run() {
-
+
while (working) { //infinite loop
try {
-
-
+
+
Thread.sleep(2000);
-
+
} catch (InterruptedException e) {
- logger.info("SCHEDULER: sleep error");
+ logger.info("SCHEDULER: sleep error");
}
-
+
}
}
-
-
+
+
// ---------------------------- Public Methods
-
+
public void readSchedules(String scheduleSeconds) throws
PerfSONARException {
-
+
logger.debug("Scheduler.readSchedules: Scheduler has been woken up
to read schedules");
-
+
String xmlDbURL;
String userName;
String password;
String community;
-
+
try{
xmlDbURL =
this.configurationComponent.getProperty("Scheduler.Database.XML.location");
userName =
this.configurationComponent.getProperty("Scheduler.Database.XML.login.username");
password =
this.configurationComponent.getProperty("Scheduler.Database.XML.login.password");
community =
this.configurationComponent.getProperty("Scheduler.Database.XML.community");
-
+
}catch(PerfSONARException e) {
-
+
logger.fatal("Scheduler.readSchedules: Scheduler is unable to
" +
"read configuration information required to
connect to " +
"an xml database. Scheduler cannot gather
schedules which are " +
@@ -150,13 +150,13 @@
"Scheduler.Database.XML.login.password =
Password for accessing database, " +
"Scheduler.Database.XML.community = Community
under which schedule resource " +
"should be looked up");
-
+
return;
-
+
}
-
+
if(xmlDbURL==null || xmlDbURL.isEmpty()) {
-
+
logger.fatal("Scheduler.readSchedules: Scheduler is unable to
" +
"read configuration information from
service.properties file " +
"required to connect to an xml database.
Scheduler cannot " +
@@ -165,11 +165,11 @@
"service.properties file contains value for
the property: " +
"Scheduler.Database.XML.location");
return;
-
+
}
-
+
if(userName==null || userName.isEmpty()) {
-
+
logger.fatal("Scheduler.readSchedules: Scheduler is unable to
" +
"read configuration information from
service.properties file " +
"required to connect to an xml database.
Scheduler cannot " +
@@ -178,11 +178,11 @@
"Please make sure service.properties file
contains value " +
"for the property:
Scheduler.Database.XML.login.username");
return;
-
+
}
-
+
if(password==null || password.isEmpty()) {
-
+
logger.fatal("Scheduler.readSchedules: Scheduler is unable to
" +
"read configuration information from
service.properties file " +
"required to connect to an xml database.
Scheduler cannot " +
@@ -191,11 +191,11 @@
"Please make sure service.properties file
contains value " +
"for the property:
Scheduler.Database.XML.login.password");
return;
-
+
}
-
+
if(community==null || community.isEmpty()) {
-
+
logger.fatal("Scheduler.readSchedules: Scheduler is unable to
" +
"read configuration information from
service.properties file " +
"required to connect to an xml database.
Scheduler cannot " +
@@ -204,42 +204,42 @@
"missing. Please make sure service.properties
file contains value " +
"for the property:
Scheduler.Database.XML.community");
return;
-
+
}
-
-
+
+
scheduleSeconds = "60";
-
+
// for now assume that the storage manager is ExistDb. Lets work
on the generalization later
-
+
ExistDbXmlrpcXmlDataRepository dbRepository = new
ExistDbXmlrpcXmlDataRepository(xmlDbURL, userName, password);
-
+
ExistDbXmlrpcXmlStorageManager storageManager = new
ExistDbXmlrpcXmlStorageManager();
-
+
storageManager.initStorage(dbRepository);
-
+
logger.debug("Scheduler.readSchedules: reading schedules from xml
db repository using XPath");
-
+
String queryForSchedules =
"//*:parameters/*:parameter[@name='Repetetion_Seconds'"
+
" and text()='" + scheduleSeconds + "']/ancestor::*:metadata";
-
+
logger.debug("Scheduler.readSchedules: reading schedules from " +
"xml db repository using XPath expression:
"+queryForSchedules);
-
+
//TODO: Put these schedules into an array of metadata objects?
-
+
String[] scheduleResults = (String[])
storageManager.fetch(queryForSchedules);
-
-
+
+
Calendar cal = GregorianCalendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
-
+
logger.debug("Scheduler: Executing schedules at
"+cal.get(Calendar.DAY_OF_MONTH)+"/" +

""+cal.get(Calendar.MONTH)+"/"+cal.get(Calendar.YEAR)+"-"+

cal.get(Calendar.HOUR_OF_DAY)+":"+cal.get(Calendar.MINUTE)+":"+cal.get(Calendar.SECOND)+"."
+
" Identified "+scheduleResults.length+" schedules to
execute " +
"at this time");
-
+
ScheduleMessageParser parser = new ScheduleMessageParser();
Vector<String> metadataIdVector = new Vector<String>();
for (String scheduleResult : scheduleResults) {
@@ -271,68 +271,68 @@


}
-
+
String[] leafMetadataIds = new String[metadataIdVector.size()];
-
+
for(int i = 0;i<metadataIdVector.size();i++) {
-
+
leafMetadataIds[i] = metadataIdVector.get(i);
}
-
+
// there can be many leaves, where each leaf is the end part of a
schedule
-
+
for(int itr=0;itr<leafMetadataIds.length;itr++) {

logger.debug("Scheduler.readSchedules: Schedule metadata
points " +
"to a metadata with id:
"+leafMetadataIds[itr]);
-
+
String queryForLeafMetadataContent =

"/*:message/*:metadata[@id='"
+ leafMetadataIds[itr] + "']";
//StringDataQuery queryForLeafMetadataContent = new
StringDataQuery("//*:metadata[@id='meta2']");
-
+
String[] metadataLeafResults = (String[])
storageManager.fetch(queryForLeafMetadataContent);
-
-
+
+
if(metadataLeafResults.length!=1) {
-
+
if(metadataLeafResults.length==0) {
logger.error("Scheduler.readSchedules: XML
configuration file is corrupt! " +
"Schedule links to a metadata element with id
"+leafMetadataIds[itr]+
" But the configuration file contains no
entry for elements with this id");
-
- }
+
+ }
else {
logger.error("Scheduler.readSchedules: XML configuration
file is corrupt! " +
"Schedule links to a metadata element with id
"+leafMetadataIds[itr]+
" But the configuration file returns
"+metadataLeafResults.length+" entries."+
- " Metadata element ids have to be unique.");

+ " Metadata element ids have to be unique.");
}
continue;
}
-
+
String[] scheduleChain = new String[1];
scheduleChain[0] = metadataLeafResults[0];
-
+
String nextNodeIdRef;
boolean moreNodesInChain;
-
-
+
+
try {
parser.parse(metadataLeafResults[0]);
-
+
Metadata metadataElement = (Metadata)
parser.getElement("metadata");
Subject subjectElement = metadataElement.getSubject();
String metadataIdRef = subjectElement.getMetadataIdRef();
-
+
if(!(metadataIdRef == null ||
metadataIdRef.equalsIgnoreCase(""))) {
nextNodeIdRef = metadataIdRef;
moreNodesInChain = true;
-
+
}
else {
nextNodeIdRef = null;
moreNodesInChain = false;
-
+
}

}
@@ -343,51 +343,51 @@
continue;
}

-
+
boolean errorInChain = false;
-
+
while(moreNodesInChain) {
-
+
if(nextNodeIdRef!=null) {
-
+
String queryForNextMetadataContent =
"/*:message/*:metadata[@id='"
+ nextNodeIdRef + "']";
-
+
String[] nextMetadataResults = (String[])
storageManager.fetch(queryForNextMetadataContent);
-
-
+
+
if(nextMetadataResults.length!=1) {
-
+
if(nextMetadataResults.length==0) {
logger.error("Scheduler.readSchedules: XML
configuration file is corrupt! " +
"A reference was found to a metadata
element with id: "+nextNodeIdRef+" " +
"but no metadata elements
were returned when queried");
- }
+ }
else {
logger.error("Scheduler.readSchedules: XML
configuration file is corrupt! " +
"A reference was found to a
metadata element with id: "+nextNodeIdRef+" " +
"but
"+nextMetadataResults.length+" metadata elements were returned when " +
- "queried. Metadata
elements should have unique ids. Ignoring this schedule");
+ "queried. Metadata
elements should have unique ids. Ignoring this schedule");
}
-
+
errorInChain=true;
break;
}
-
+
try {
parser.parse(nextMetadataResults[0]);
-
+
Metadata metadataElement = (Metadata)
parser.getElement("metadata");
-
+
Subject subjectElement =
metadataElement.getSubject();
String metadataIdRef;
metadataIdRef = subjectElement.getMetadataIdRef();
-
+
if(!(metadataIdRef == null ||
metadataIdRef.equalsIgnoreCase(""))) {
-
+
nextNodeIdRef = metadataIdRef;
moreNodesInChain = true;
// System.out.println("next in
chain:*"+metadataIdRef+"*");
-
+
}
else {
nextNodeIdRef = null;
@@ -401,61 +401,61 @@
"caught while parsing schedule entry.
" +
"Schedule entry is corrupt at
metadata with id: "+nextNodeIdRef);
errorInChain = true; break;
-
+
}
-
+
String[] newScheduleChain = new
String[scheduleChain.length+1];
// insert it above the current content in chain

System.arraycopy(scheduleChain, 0, newScheduleChain, 1,
scheduleChain.length);
-
+
scheduleChain = newScheduleChain;
-
+
scheduleChain[0]=nextMetadataResults[0];
-
+
}
-
+
else moreNodesInChain=false;
-
+
if(errorInChain) break;
-
-
+
+
}
if(errorInChain) continue;
-
+
//TODO: Decide which schedule action to call upon - this is
done based on the first event type in the chain
//call on action thread which should accept array of metadata
(or message?) objects
-
+
Metadata[] scheduleMetadataChain = new
Metadata[scheduleChain.length];
-
+
for(int i=0;i<scheduleChain.length;i++) {
-
+
parser.parse(scheduleChain[i]);
-
+
Metadata metadataElement = (Metadata)
parser.getElement("metadata");
-
- scheduleMetadataChain[i] = metadataElement;
+
+ scheduleMetadataChain[i] = metadataElement;
// System.out.println("Location "+i);
// System.out.println(scheduleChain[i]);
}
-
- // TODO: decide whether we need to call on generic or any
other type of SchedulerAction by using the
+
+ // TODO: decide whether we need to call on generic or any
other type of SchedulerAction by using the
// entry in service.properties file. If no entry is found,
use generic
-
+
EventType eventType = scheduleMetadataChain[0].getEventType();
-
+
String eventTypeString = eventType.getEventType();
-
+
if(eventTypeString == null || eventTypeString.equals(" ")) {
-
+
logger.error("Scheduler: Error in schedule entry. "+
- "The metadata element with Id: "
+ "The metadata element with Id: "
+scheduleMetadataChain[0].getId()+
"does not have an event type element. " +
"Scheduler cannot determine what to do with
it");
continue;
}
-
+
String schedulerActionType = null;
try{
schedulerActionType =
this.configurationComponent.getProperty(eventTypeString);
@@ -463,32 +463,32 @@
catch(Exception e) {
// TODO: do nothing here?
}
-
- if(schedulerActionType!=null
+
+ if(schedulerActionType!=null
&& (!schedulerActionType.equalsIgnoreCase("GENERIC"))
&& (!schedulerActionType.equalsIgnoreCase

("net.geant2.monitoring.nms.service.commons.auxiliary.GenericSchedulerAction")))
{
-
+
// use a custom schedulerAction
-
+
logger.debug("Scheduler.readSchedules: Configured to
calling on " +
"Custom Scheduler Action with classname:
"+schedulerActionType+
"for the metadata chain containing head with
event type: "+
eventTypeString);
-
+
Class<?> tempClass;
SchedulerAction schedulerActionClass;
-
+
try {
-
+
tempClass = Class.forName(schedulerActionType);
-
+
//TODO handle ClassCastException.
- schedulerActionClass =
+ schedulerActionClass =
(SchedulerAction)tempClass.newInstance();
-
+
schedulerActionClass.init(scheduleMetadataChain, itr);
-
+
} catch (ClassNotFoundException e1) {

logger.error("Scheduler: The configured SchedulerAction"
+
@@ -496,25 +496,25 @@
"associated with this class
is:"+eventTypeString+" The" +
" error message seen
is"+e1.getMessage());
continue;
-
+
} catch (InstantiationException e) {
-
+
logger.error("Scheduler: The configured SchedulerAction"
+
" class cannot be instantiated. The event
type " +
"associated with this class
is:"+eventTypeString+" The" +
" error message seen
is"+e.getMessage());
continue;
-
+
} catch (IllegalAccessException e) {
-
+
logger.error("Scheduler: The configured SchedulerAction"
+
" class cannot be instantiated because of
illegal" +
"Access. The event type associated with this
" +
"class is:"+eventTypeString+" The error
message seen is"+
e.getMessage());
-
+
continue;
-
+
} catch (Exception e) {
logger.error("Scheduler: The configured SchedulerAction"
+
" class cannot be invoked because of unknown"
+
@@ -523,9 +523,9 @@
e.getMessage());
continue;
}
-
+
}
-
+
else {
// use the generic schedulerAction
logger.debug("Scheduler.readSchedules: Calling on
GenericSchedulerAction" +
@@ -536,27 +536,27 @@
schedulerAction.init(scheduleMetadataChain, itr);
}

-
+
}// end of for(each leaf)
-
-
+
+
}
-

+
/**
* This is only for test purposes
- *
+ *
* @param args
* @throws RequestException
* @throws DataFormatException
* @throws PerfSONARException
*/
public static void main(String args[]) throws PerfSONARException {
-
+
Scheduler tester = new Scheduler();
-
+
tester.readSchedules("60");
-
+
}



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/GenericSchedulerAction.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/GenericSchedulerAction.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/GenericSchedulerAction.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,20 +11,20 @@
/**
* Generic scheduler action which exploits the capabilities which are
* already existing in the SchedulerAction abstract class
- *
+ *
* @author loukik
*
*/
public class GenericSchedulerAction extends SchedulerAction {

-
+
// ----------------------------Constructor
-
+
public GenericSchedulerAction() {
-
+
super();
}
-
+
}



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/SchedulerAction.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/SchedulerAction.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/SchedulerAction.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -27,7 +27,7 @@

/**
* Abstract SchedulerAction class
- *
+ *
* @author loukik
*/
public abstract class SchedulerAction implements Runnable {
@@ -36,47 +36,47 @@
// FIXME thread.stop is deathlock prone

// ----------------------------Member Variables
-
+
public Metadata[] metadataList = null;
-
+
public Thread thread;
-
+
int me = -1;
-
+
protected LoggerComponent logger;
-
+
protected ConfigurationComponent configurationComponent;
-
-
+
+
// ----------------------------Constructor
-
+
/**
* Initialize the Scheduler Action which forks off a thread
- *
+ *
* @param messageList
* @param me
* @throws SystemException
*/
public void init(Metadata[] metadataList, int me) throws
PerfSONARException {
-
+
this.me = me;
-
+
this.metadataList = metadataList;
-
+
logger =
(LoggerComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
-
+
configurationComponent =
(ConfigurationComponent)AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
-
+
this.thread = new Thread(this);
-
+
thread.start();
}
-
-
-
+
+
+
// ---------------------------- Public Methods
-
-
+
+
/**
* Implemented interface method which calls on the performAction method
* @see java.lang.Runnable#run()
@@ -86,40 +86,40 @@

System.out.println("SchedulerAction: SchedulerAction has been
invoked");
this.performAction();
-
+
}
-
-
+
+
/**
- * Executes the given set of well defined actions.
- * The actions are defined in steps and arranged sequentially
- * in the array object passed.
+ * Executes the given set of well defined actions.
+ * The actions are defined in steps and arranged sequentially
+ * in the array object passed.
* This method should be overridden if required
- *
- * @param messageList An array of Message objects
+ *
+ * @param messageList An array of Message objects
* containing well defined actions
* @throws PerfSONARException
*/
public void performAction() {
-
+
logger.debug("SchedulerAction: Generic Scheduler Action invoked");
-
-
+
+
Message requestMessage= new Message();
- // this is a message object which will be used to populate results
from one stage
+ // this is a message object which will be used to populate results
from one stage
// and feed it to the next stage
-
-
+
+
// set a blank data to start with. This will be changed with actual
data during
// the traversal of the chain
-
+
Data dataElement = new Data();
dataElement.setId("data1");
requestMessage.setData(dataElement);
-
- // we are not setting any metadata. It will be set to meta data
element found in the
- // schedule chain per iteration below.
-
+
+ // we are not setting any metadata. It will be set to meta data
element found in the
+ // schedule chain per iteration below.
+
// lets work on the given list in sequence
for (Metadata aMetadataList : metadataList) {

@@ -141,7 +141,7 @@

String eventTypeString = eventType.getEventType();

- // set the metadata idrefs in all data. set them all to the
same one now as
+ // set the metadata idrefs in all data. set them all to the
same one now as
// we don't support chaining in individual schedules yet

while (initialDataIterator.hasNext()) {
@@ -375,8 +375,8 @@
metadataIdref = metadataElements.getId();
}

- // set the request message for the next leg (if
any).
- // change its datablock into a datablock got from
the reply
+ // set the request message for the next leg (if any).
+ // change its datablock into a datablock got from
the reply

requestMessage.clearData();

@@ -446,22 +446,22 @@
// "class: " +handlerClassName+". But
SchedulerAction " +
// "(generic) encountered a Request
Exception:"+e.getMessage());
// return;
-//
+//
// } catch (DataFormatException e) {
// logger.error("SchedulerAction: The eventType in
the schedule: "+eventTypeString+" "+
// "has been configured to be handled by the
" +
// "class: " +handlerClassName+". But
SchedulerAction " +
// "(generic) encountered a DataFormat
Exception:"+e.getMessage());
// return;
-//
+//
// } catch (ResourceException e) {
// logger.error("SchedulerAction: The eventType in
the schedule: "+eventTypeString+" "+
// "has been configured to be handled by the
" +
// "class: " +handlerClassName+". But
SchedulerAction " +
// "(generic) encountered a Resource
Exception:"+e.getMessage());
// return;
-// }
-//
+// }
+//
}


@@ -469,22 +469,22 @@


} // end of for
-
-
-
+
+
+
}// end of performAction
-

+
// ---------------------------- Protected Methods
-
+
/**
- * Returns the Thread object which should help in controlling the object
+ * Returns the Thread object which should help in controlling the object
* @return Thread object which helps in controlling the current thread
*/
public Thread getThread() {
-
+
return this.thread;
-
+
}

}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/Scheduler.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/Scheduler.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/Scheduler.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -20,7 +20,7 @@

/**
* This class provides the capability to run an action each N seconds
- *
+ *
* @author Maciej Glowiak
* @author Uros Juvan (changed interface being implemented from
* AuxiliaryComponent to AuxiliaryThreadedComponent,
@@ -28,73 +28,73 @@
*
*/
public class Scheduler extends Thread implements AuxiliaryThreadedComponent {
-
-
+
+
// ----------------------------Member Variables

protected LoggerComponent logger;
-
+
protected ConfigurationComponent config;
-
+
private String componentName = "SCHEDULER";
-
+
private boolean working = true;
-
+
private boolean paused = false;
-
+
private int wakeupInterval = 10000; //milliseconds
-
+
private Set<SchedulerTask> tasks = Collections.synchronizedSet(new
HashSet<SchedulerTask>());
-
-
+
+
// -------------------------------------------------- Constructor
-
+
public Scheduler() {
-
+
setComponentName("SCHEDULER"); //temporary name
-
+
}
-
-
+
+
// ------------------------------------------------- Public methods
-
-
+
+
@Override
public void initComponent() throws PerfSONARException {
-
+
try {
-
+
logger = (LoggerComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.LOGGER);
-
+
config = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.CONFIG);
-
+
} catch (PerfSONARException e) {

String m = "Cannot initialize components: " +
"logger and configuration "+e.getMessage();
-
+
throw new PerfSONARException("error.common.no_configuration",m);
-
+
}
-
-
+
+
//start scheduler Thread
this.start();
-
+
}
-
-
+
+
/**
* Checks if scheduler is active and working
* @return
*/
public boolean isWorking() {
-
+
return working;
-
+
}


@@ -103,69 +103,69 @@
*
*/
public void stopScheduler() {
-
+
this.working = false;
-
+
}
-
-
+
+
@Override
public void run() {
-
+
paused = false;
-
+
while (working) { //infinite loop until stopScheduler()
try {
-
+
Thread.sleep(wakeupInterval);
//if paused - not schedule any tasks
if (!paused) {
-
+
// Let's protect iteration over tasks by
// corrupted iterator exception catcher,
// which prevents this thread from dieing
try {
for (SchedulerTask task : tasks) {
-
+
// run action in new thread
- task.runAction();
+ task.runAction();

}
-
+
} catch (ConcurrentModificationException cme) {}
-
+
}
-
+
} catch (InterruptedException e) {
- logger.info("SCHEDULER: sleep error");
+ logger.info("SCHEDULER: sleep error");
}
-
+
}
}
-
-
+
+
// ---------------------------- Public Methods

-
+
public int getWakeupInterval() {
-
+
return wakeupInterval;
-
+
}


public void setWakeupInterval(int wakeupInterval) {
-
+
this.wakeupInterval = wakeupInterval;
-
+
}


@Override
public String getComponentName() {
-
+
return componentName;
-
+
}


@@ -174,18 +174,18 @@
componentName = name;
}

-
+
public void addSchedulerTask(SchedulerTask t) {
-
+
tasks.add(t);
-
+
}
-
-
+
+
public void addSchedulerTask(int interval, SchedulerAction action) {
-
+
tasks.add(new SchedulerTask(interval, action));
-
+
}


@@ -202,14 +202,14 @@
}


-
- // ---------------------------- Private Methods
-
-
+
+ // ---------------------------- Private Methods
+
+
public static void main(String[] a) throws PerfSONARException {
-
+
new Scheduler().initComponent();
-
+
}


@@ -228,20 +228,20 @@
* @param paused
*/
public void setPaused(boolean paused) {
-
+
this.paused = paused;
-
+
}
-
+
/**
* Stop the thread by calling stopScheduler
*/
@Override
public void stopThread() {
-
+
stopScheduler();
-
+
}

-
+
} //Scheduler

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerAction.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerAction.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerAction.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,7 +7,7 @@
*
*/
public interface SchedulerAction {
-
+
public void runAction();

}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerTask.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerTask.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerTask.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -2,29 +2,29 @@


public class SchedulerTask {
-
+
private long MIN_INTERVAL = 100; //ms
-
+
// --------------------------------------------- private variables
-
- private long interval = MIN_INTERVAL;
+
+ private long interval = MIN_INTERVAL;
//minimal interval (in ms) between actions
-
+
private long timestamp = 0; // last timestamp when action was performed
-
+
private SchedulerAction action;
-
+
// --------------------------------------------------- constructor
-
-
+
+
public SchedulerTask(long interval, SchedulerAction action) {
-
+
if (interval<MIN_INTERVAL) this.interval = MIN_INTERVAL;
else this.interval = interval;
-
+
this.action = action;
this.timestamp = 0;
-
+
}


@@ -44,87 +44,87 @@

}

-
+
// ------------------------------------------------ public methods
-
+
/**
* Runs proper action as new Thread (only if time is out)
- */
+ */
public boolean runAction() {
-
+
long currentTimestamp = System.currentTimeMillis();

//if timestamp older than current - interval
if ((timestamp + interval - currentTimestamp) <= 0) {
-
+
timestamp = currentTimestamp;
-
+
//run action in thread
new Thread() {
@Override
public void run() {
super.run();
- action.runAction();
+ action.runAction();
}
}.start();
-
+
//if action is being performed return true
return true;
}
-
+
//otherwise false
return false;
}


public SchedulerAction getAction() {
-
+
return action;
-
+
}


public void setAction(SchedulerAction action) {
-
+
this.action = action;
-
+
}


-
+
/**
* Get interval between two subsequence runs of action
* @param interval
*/
public long getInterval() {
-
+
return interval;
-
+
}

-
+
/**
* Set interval between two subsequence runs of action
* @param interval
*/
public void setInterval(long interval) {
-
+
this.interval = interval;
-
+
}
-

+
/**
- * Returns timestamp of recent run of action
+ * Returns timestamp of recent run of action
* @return
*/
public long getTimestamp() {
-
+
return timestamp;
-
+
}

-
+
/**
* Set timestamp of recent run of action on the beginning of epoch
* (1970), so action should be run immediately (in the next cycle of
@@ -132,9 +132,9 @@
*
*/
public void resetTimestamp() {
-
+
this.timestamp = 0;
-
+
}


@@ -169,6 +169,6 @@
false;

}
-

+
} //SchedulerTask

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/exceptions/PerfSONARException.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/exceptions/PerfSONARException.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/exceptions/PerfSONARException.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -2,18 +2,18 @@

/**
* Common Exception class for all PerfSONAR Exceptions
- *
+ *
* All other Exception classes should be derived from this class.
- *
+ *
* @author Maciej Glowiak
*
*/
public class PerfSONARException extends Exception {
-
-
+
+
// ----------------------------------------------------- Constants
-
-
+
+
/**
* Serial ID
*/
@@ -24,123 +24,123 @@
* Default result code, used if no result code was set
*/
private static final String UNKNOWN_RESULT_CODE = "unknown";
-
-
+
+
// --------------------------------------------- Private variables
-
-
+
+
String resultCode = UNKNOWN_RESULT_CODE;
-
+
String resultDescription = "";

-
+
// -------------------------------------------------- Constructors
-
-
+
+
public PerfSONARException() {

super();
resetResult();
-
+
}

-
+
public PerfSONARException(String message) {
-
- super(message);
+
+ super(message);
setResult(message);
-
+
}
-
-
+
+
public PerfSONARException(String message, Throwable t) {
-
- super(message, t);
+
+ super(message, t);
setResult(message);
}
-

+
/**
* PerfSONAR Exception - result code support
* @param resultCode - textual result code
* @param message - textual result description (message)
*/
public PerfSONARException(String resultCode, String message) {
-
+
super(message);
setResult(resultCode, message);
-
+
}

-
+
/**
* PerfSONAR Exception - result code support
* @param resultCode - textual result code
* @param message - textual result description (message)
*/
public PerfSONARException(String resultCode, String message, Throwable
t) {
-
+
super(message,t);
setResult(resultCode, message);
-
+
}
-
-
+
+
// ------------------------------------------------ Public methods
-
-
+
+
@Override
public String getMessage() {
-
+
return "[" + resultCode + "]: "+super.getMessage();
-
+
}

-
+
/**
* Returns result code (or "unknown")
*/
public String getResultCode() {

return resultCode;
-
+
}

-
+
/**
* Return result code description (or empty String)
*/
public String getResultDescription() {
-
+
return resultDescription;
-
+
}
-
+
// ----------------------------------------------- private methods

-
+
private void setResult(String rc, String rd) {
-
+
resultCode = rc;
resultDescription = rd;
-
+
}

-
+
private void setResult(String desc) {
-
+
resultCode = UNKNOWN_RESULT_CODE;
resultDescription = desc;
-
+
}
-
-
+
+
private void resetResult() {
-
+
setResult(UNKNOWN_RESULT_CODE, "");
-
+
}

-
-
+
+
} //PerfSONARException

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/nmwg/owamp/Parameters.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/nmwg/owamp/Parameters.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/nmwg/owamp/Parameters.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -4,9 +4,9 @@
* @author Martin Swany
* @author Jason Zurawski
* @author Piotr Pikusa
- * @version $Id$
+ * @version $Id$
* @see org.ggf.ns.nmwg.base.v2_0.Element
- * @see org.ggf.ns.nmwg.base.v2_0.Parameter
+ * @see org.ggf.ns.nmwg.base.v2_0.Parameter
* @see org.w3c.dom.Document
* @see org.w3c.dom.Element
*/
@@ -38,11 +38,11 @@
public Parameter getParameterByName(String name) {
if(!(name.isEmpty())) {
if(name.equals("count") ||
- name.equals("dscp") ||
+ name.equals("dscp") ||
name.equals("phb") ||
- name.equals("wait") ||
+ name.equals("wait") ||
name.equals("timeOut") ||
- name.equals("padding") ||
+ name.equals("padding") ||
name.equals("endDelay") ||
name.equals("portRange") ||
name.equals("size") ||
@@ -52,14 +52,14 @@
return(p);
}
else {
- System.err.println("Error: " + getFileName()
+
+ System.err.println("Error: " + getFileName() +
"
'getParameterByName(String)' Unrecognized " +
" parameter: "+name+".");
return null;
}
}
else {
- System.err.println("Error: " + getFileName() +
+ System.err.println("Error: " + getFileName() +
" 'getParameterByName(String)' name
cannont be nil.");
return null;
}
@@ -72,34 +72,34 @@
public void addParameter(Parameter newParameter) {
if(newParameter != null) {
if(newParameter.getParameterName().equals("count") ||
-
newParameter.getParameterName().equals("dscp") ||
+
newParameter.getParameterName().equals("dscp") ||

newParameter.getParameterName().equals("phb") ||
-
newParameter.getParameterName().equals("wait") ||
+
newParameter.getParameterName().equals("wait") ||

newParameter.getParameterName().equals("timeOut") ||
-
newParameter.getParameterName().equals("padding") ||
+
newParameter.getParameterName().equals("padding") ||

newParameter.getParameterName().equals("direction") ||

newParameter.getParameterName().equals("size") ||

newParameter.getParameterName().equals("output") ||

newParameter.getParameterName().equals("portRange") ||

newParameter.getParameterName().equals("endDelay")) {

if(getParameterByName(newParameter.getParameterName())!=null){
- System.err.println("Error: " +
getFileName() +
+ System.err.println("Error: " +
getFileName() +
"
'setParameter(Parameter)' Duplicate parameter" +
- " name: " +
newParameter.getParameterName() +
+ " name: " +
newParameter.getParameterName() +
" for id: " +
newParameter.getId());
return;
}

parameterMap.put(newParameter.getParameterName(),newParameter);
}
else {
- System.err.println("Error: " + getFileName()
+
+ System.err.println("Error: " + getFileName() +
" 'addParameter(Parameter)'
Unrecognized " +
" parameter:
"+newParameter.getParameterName()+".");
return;
- }
+ }
}
else {
- System.err.println("Error: " + getFileName() +
+ System.err.println("Error: " + getFileName() +
" 'addParameter(Paramter)' Parameter cannont be
nil.");
return;
}
@@ -108,11 +108,11 @@
@Override
public void addParameter(String name, String value) {
if(!(name.isEmpty()) && !(value.isEmpty())) {
- if(name.equals("count") ||
- name.equals("dscp") ||
- name.equals("phb") ||
+ if(name.equals("count") ||
+ name.equals("dscp") ||
+ name.equals("phb") ||
name.equals("wait") ||
- name.equals("timeOut") ||
+ name.equals("timeOut") ||
name.equals("padding") ||
name.equals("endDelay") ||
name.equals("portRange") ||
@@ -125,14 +125,14 @@
this.addParameter(p);
}
else {
- System.err.println("Error: " + getFileName()
+
+ System.err.println("Error: " + getFileName() +
" 'addParameter(String,
String)' Unrecognized " +
" parameter: "+name+".");
return;
}
}
else {
- System.err.println("Error: " + getFileName() +
+ System.err.println("Error: " + getFileName() +
" 'addParameter(String, String)'
cannot have nil value" +
" for name or value.");
return;

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/MathUtil.java
===================================================================
--- trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/MathUtil.java
2012-10-05 09:22:39 UTC (rev 6008)
+++ trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/MathUtil.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -9,7 +9,7 @@

/**
* Class providing Mathematical functions
- *
+ *
* @author loukik
*
*/
@@ -17,12 +17,12 @@

public MathUtil() {
}
-
-
+
+
/**
* Operation which converts array of double values representing octet
values into
- * an array double values which represents bit values
- *
+ * an array double values which represents bit values
+ *
* @param octetValues array of double values which represent octet values
* @return array of double values which represent bit values converted
from octet values <br>
* returns null only if input is null
@@ -30,51 +30,51 @@
* @throws DataFormatException
*/
public double[] convertOctetsToBits (double[] octetValues) throws
PerfSONARException {
-
+
if(octetValues==null)
return null;
-
+
if(octetValues.length==0)
return octetValues;
-
- double[] bitValues = new double[octetValues.length];
-
+
+ double[] bitValues = new double[octetValues.length];
+
for(int itr=0;itr<octetValues.length;itr++) {
try {
-
+
bitValues[itr] = octetValues[itr] * 8;
-
+
}catch(Exception e) {
-
+
throw new PerfSONARException("MathUtil: Error converting
response octet values " +
"to bit values: "+e.getMessage(), e);
-
+
}
-
-
+
+
}
-
+
if (bitValues==null) {
throw new PerfSONARException("MathUtil: Error converting octet
values to bit values. Result was null");
-
+
}
-
+
if (bitValues.length==0) {
-
+
throw new PerfSONARException("Mathutil: Conversion of values in
" +
"octets to values in bits could not be completed.
Zero values " +
"were converted");
-
+
}
-
-
+
+
return bitValues;
}
-
+
/**
* Operation which converts array of long values representing octet
values into
- * an array long values which represents bit values
- *
+ * an array long values which represents bit values
+ *
* @param octetValues array of long values which represent octet values
* @return array of long values which represent bit values converted
from octet values <br>
* returns null only if input is null
@@ -82,44 +82,44 @@
* @throws DataFormatException
*/
public long[] convertOctetsToBits (long[] octetValues) throws
PerfSONARException {
-
+
if(octetValues==null)
return null;
-
+
if(octetValues.length==0)
return octetValues;
-
- long[] bitValues = new long[octetValues.length];
-
+
+ long[] bitValues = new long[octetValues.length];
+
for(int itr=0;itr<octetValues.length;itr++) {
try {
-
+
bitValues[itr] = octetValues[itr] * 8;
-
+
}catch(Exception e) {
-
+
throw new PerfSONARException("MathUtil: Error converting
response octet values " +
"to bit values: "+e.getMessage(), e);
-
+
}
-
-
+
+
}
-
+
if (bitValues==null) {
throw new PerfSONARException("MathUtil: Error converting octet
values to bit values. Result was null");
-
+
}
-
+
if (bitValues.length==0) {
-
+
throw new PerfSONARException("Mathutil: Conversion of values in
" +
"octets to values in bits could not be completed.
Zero values " +
"were converted");
-
+
}
-
-
+
+
return bitValues;
}
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/NetUtil.java
===================================================================
--- trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/NetUtil.java
2012-10-05 09:22:39 UTC (rev 6008)
+++ trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/NetUtil.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -6,42 +6,42 @@
package org.perfsonar.base.util;

/**Class containing Network related utilities
- *
+ *
* @author loukik
*
*/
public class NetUtil {
public NetUtil(){
-
+
}
-
+
/**
* Operation to check if a given IPv4 string is valid or not
* @param ipv4AddressString
- * @return True if it is valid, False otherwise
+ * @return True if it is valid, False otherwise
*/
public static boolean validateIPv4Address(String ipv4AddressString){
-
+
String[] splitByDot;
splitByDot = ipv4AddressString.split("[.]+");
-
+
if(splitByDot.length>4)
return false;
//TODO: complete work on IPv4 validation
-
+
return true;
}
-
+
/**
* Operation to check if a given IPv6 string is valid or not
* @param ipv6AddressString
- * @return True if it is valid, False otherwise
+ * @return True if it is valid, False otherwise
*/
public static boolean validateIPv6Address(String ipv6Address){
// TODO: work on IPv6 validation
return true;
-
+
}
-

+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/StringBufferOutputStream.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/StringBufferOutputStream.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/StringBufferOutputStream.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -9,29 +9,29 @@
*/
public class StringBufferOutputStream extends OutputStream {

-
+
/**
* Local StringBuffer
*/
private StringBuffer sb;
-
-
+
+
/**
* Constructor, needs to specify StringBuffer destination
* @param sb
*/
public StringBufferOutputStream (StringBuffer sb) {
-
+
this.sb = sb;
-
+
}
-

+
@Override
public void write(int b) throws IOException {

sb.append((char)b);
-
- }
-
+
+ }
+
} //StringBufferOutputStream

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/TimeDateUtil.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/TimeDateUtil.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/TimeDateUtil.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -20,7 +20,7 @@

/**
* This class contains methods that deal with time and date operations.
- *
+ *
* @author romradz
*
*/
@@ -44,7 +44,7 @@
* fraction = ('.' | ',') digit+
* offset = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' |
',') SSS]]])
*
- *
+ *
* @author romradz
*/
public static String getUnixTime(Parameter timeParemeter)

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/XMLUtils.java
===================================================================
--- trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/XMLUtils.java
2012-10-05 09:22:39 UTC (rev 6008)
+++ trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/XMLUtils.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -38,7 +38,7 @@

/**
* The class contains several methods for various text operations with the
XML
- *
+ *
* @author Maciej Glowiak
* @author romradz (contributor)
*
@@ -54,19 +54,19 @@
/* settings */
public static final String DEFAULT_PARSER_NAME =
"org.apache.xerces.parsers.SAXParser";
public static final boolean DEFAULT_NAMESPACES = true;
- public static final boolean DEFAULT_NAMESPACE_PREFIXES = true;
-
+ public static final boolean DEFAULT_NAMESPACE_PREFIXES = true;
+
// --------------------------------------------------------- public
methods
-
+
/**
* Converts XML entities \&lt\; and \&gt\; to characters "<" ">".
* @param input input string
- * @return ouput output string
+ * @return ouput output string
*/
public static String convertEntitiesToCharacters(String input) {
-
+
String output;
-
+
//&lt;
output = input.replaceAll("\\&lt\\;", "<");
//&gt;
@@ -77,16 +77,16 @@
output = output.replaceAll("\\&apos\\;", "'");
//&quot;
output = output.replaceAll("\\&quot\\;", "\"");
-
+
return output;
-
+
}

/**
* Serialize org.w3c.document
*/
public static String serializeDOM(Document doc) throws Exception {
-
+
OutputFormat format = new OutputFormat( doc );
StringWriter stringOut = new StringWriter();

@@ -95,9 +95,9 @@
serial.asDOMSerializer();
serial.serialize( doc.getDocumentElement() );
return stringOut.toString();
-
- }
-
+
+ }
+
/**
* Serialize schema element. It omits all comments, document type and XML
* declaration, so can be used to generate part of XML document
@@ -113,19 +113,19 @@
outputFormat.setOmitComments(true);
outputFormat.setOmitDocumentType(true);
outputFormat.setOmitXMLDeclaration(true);
-
+
StringBuffer outputBuffer = new StringBuffer();
XMLSerializer serializer = new XMLSerializer(
new StringBufferOutputStream(outputBuffer),
outputFormat);
-
+
try {
-
+
ContentHandler hd = serializer.asContentHandler();
NamespaceSupport nss = new NamespaceSupport();
element.toXML(hd, nss);
return outputBuffer.toString();
-
+
} catch (Exception e) {
String m = "XMLUtils.serializeXML: error while serializing XML:
"+
e.getMessage();
@@ -133,18 +133,18 @@
}

}
-
+
/**
* Converts Message into DOM Document
* @param m message object
* @return Document
* @throws PerfSONARException if something goes wrong
*/
- public static Document convertMessageToDOM(Message m)
+ public static Document convertMessageToDOM(Message m)
throws PerfSONARException{

try {
- DocumentBuilder builder =
+ DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
Document builtDoc = m.getDOM(doc);
@@ -154,14 +154,14 @@

} catch (Exception e) {
throw new PerfSONARException(
- "error.common.parse_error",
+ "error.common.parse_error",
"Cannot convert Message to DOM");
}

}


- public static Document convertMessageToDOM(String m)
+ public static Document convertMessageToDOM(String m)
throws PerfSONARException{

try {
@@ -174,7 +174,7 @@

} catch (Exception e) {
throw new PerfSONARException(
- "error.common.parse_error",
+ "error.common.parse_error",
"Cannot convert Message string to DOM");
}

@@ -188,76 +188,76 @@
* @return Message
* @throws Exception
*/
- public static Message convertToMessage(Document request, String f)
+ public static Message convertToMessage(Document request, String f)
throws PerfSONARException{
-
+
XMLSerializer serializer = new XMLSerializer();
ByteArrayOutputStream boStream = new ByteArrayOutputStream();

- org.ggf.ns.nmwg.base.v2_0.Handler handler =
+ org.ggf.ns.nmwg.base.v2_0.Handler handler =
new org.ggf.ns.nmwg.base.v2_0.MessageHandler();
-
+
Handler.setConfigFile(f);
-
+
try {
-
+
serializer.setOutputByteStream(boStream);
serializer.serialize(request);
-
- final javax.xml.parsers.SAXParserFactory saxParserFactory =
- javax.xml.parsers.SAXParserFactory.newInstance();
+
+ final javax.xml.parsers.SAXParserFactory saxParserFactory =
+ javax.xml.parsers.SAXParserFactory.newInstance();
//saxParserFactory.setValidating(true);
saxParserFactory.setNamespaceAware(true);
-
- final javax.xml.parsers.SAXParser saxParser =
- saxParserFactory.newSAXParser();
+
+ final javax.xml.parsers.SAXParser saxParser =
+ saxParserFactory.newSAXParser();
final org.xml.sax.XMLReader parser = saxParser.getXMLReader();
-
+
boolean namespaces = DEFAULT_NAMESPACES;
boolean namespacePrefixes = DEFAULT_NAMESPACE_PREFIXES;
-
+
parser.setFeature(NAMESPACES_FEATURE_ID, namespaces);
parser.setFeature(NAMESPACE_PREFIXES_FEATURE_ID,
namespacePrefixes);
// bad xml?
parser.setContentHandler(handler);
-
+
InputSource ipSrc = new InputSource(
new ByteArrayInputStream(boStream.toByteArray()));
-
+
try {
-
+
parser.parse(ipSrc);
-
+
} catch(SAXException e) {
-
+
throw new PerfSONARException("error.common.parse_error",
"Request couldnot be parsed because "
+ "of SAX exception. Error message: "
+ e.getMessage());
-
+
}
} catch (IOException e) {
- throw new PerfSONARException("error.common.parse_error",
+ throw new PerfSONARException("error.common.parse_error",
"IO exception: "
+ "encountered while reading schema file "
+ e.getMessage());
} catch (SAXException e) {
-
+
throw new PerfSONARException("error.common.parse_error",
"SAX Exception: "
+ e.getMessage());
} catch (ParserConfigurationException e) {
-
+
throw new PerfSONARException("error.common.parse_error", "Parser
Configuration "
+ "Exception " + e.getMessage());
-
+
}
-
- Message message =
+
+ Message message =
((org.ggf.ns.nmwg.base.v2_0.MessageHandler)handler).getMessage();

return message;
-
+
}

/**
@@ -271,7 +271,7 @@
Map<String, Element> elements = handler.getElement(tagNames);

return elements;
- }
+ }

public static Map<String, Element> getElementFromXML(
String xmlPart, String[] tagNames, String parserFile) {
@@ -287,9 +287,9 @@
* Remove HTML/XML tags from string
*/
public static String removeXMLTags(String xml) {
-
+
return xml.replaceAll("\\<[^\\>]+\\>","");
-
+
}

// --------------------------------------------------------- private
methods
@@ -318,7 +318,7 @@

try {
parser =
XMLReaderFactory.createXMLReader(DEFAULT_PARSER_NAME);
-
+
} catch (Exception e) {
e.printStackTrace();
}
@@ -353,27 +353,27 @@
}

public static String extractXMLTag(String str, String tag) {
-
- //trim from blank spaces
+
+ //trim from blank spaces
str = str.trim();
-
+
//find starting tag
int indexStartTag1 = str.indexOf("<"+tag);
if (indexStartTag1==-1) return null;
-
+
//find end of starting tag
int indexStartTag2 = str.indexOf(">", indexStartTag1);
if (indexStartTag2==-1) return null;
-
+
//find closing tag
int indexEndTag1 = str.indexOf("</"+tag, indexStartTag2);
if (indexEndTag1==-1) return null;

String substr = str.substring(indexStartTag2+1, indexEndTag1);
return substr;
-
+
}
-
+
/**
* Extracts attribute value from string
* @param a string
@@ -381,16 +381,16 @@
* @return
*/
public static String extractXMLAttributeValue(
- String str,
+ String str,
String attribute) {
-
+
try { //just in case of a RuntimeException
-
- int ind1 = str.indexOf(attribute);
-
+
+ int ind1 = str.indexOf(attribute);
+
if (ind1>-1) { ind1 = str.indexOf('\"', ind1); }
else return null; //attribute not found
-
+
if (ind1>-1) {
ind1+=1;
int ind2 = str.indexOf('\"',ind1);
@@ -398,15 +398,15 @@
return str.substring(ind1,ind2); //return value of
attribute
}
}
-
+
} catch (Exception ex) {}
-
+
return null; //bad xml?

}
-
+
// ---------------------------------------------------------- XML Files
parsing
-
+
/**
* Converts XML File into DOM Document
* @param file xml file in system
@@ -414,7 +414,7 @@
* @throws PerfSONARException if something goes wrong
*/
public static Document convertXMLFileToDom(String file) throws
PerfSONARException{
-
+
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document dom;
try {
@@ -423,7 +423,7 @@
dom = db.parse(file);

}catch (IOException e) {
- throw new PerfSONARException("error.common.parse_error",
+ throw new PerfSONARException("error.common.parse_error",
"IO exception: "
+ "encountered while reading xml file "
+ e.getMessage());
@@ -435,10 +435,10 @@
throw new
PerfSONARException("error.common.parse_error", "Parser Configuration "
+ "Exception " + e.getMessage());
}
-
+
return dom;
}
-
+
/**
* Gets the internal elements of nodes with a specific tag
* @param dom The document to get the elements from
@@ -482,7 +482,7 @@

return value;
}
-
+
// ---------------------------------------------------------- Inner class

/**

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Constants.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Constants.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Constants.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -2,7 +2,7 @@

/**
* Summarization code
- *
+ *
* @author swany
*
*/

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/HelperClass.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/HelperClass.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/HelperClass.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -3,7 +3,7 @@
import java.util.ArrayList;
/**
* Summarization code
- *
+ *
* @author swany
*
*/
@@ -25,7 +25,7 @@
}
return noOfNodes;
}
-
+
public String longToIP(Long ipInLong) {

String ipAddress = "";

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddress.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddress.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddress.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -4,7 +4,7 @@

/**
* Summarization code
- *
+ *
* @author swany
*
*/

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -2,7 +2,7 @@

/**
* Summarization code
- *
+ *
* @author swany
*
*/

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/InvalidIPAddressException.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/InvalidIPAddressException.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/InvalidIPAddressException.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -1,7 +1,7 @@
package org.perfsonar.base.util.iptrie;
/**
* Summarization code
- *
+ *
* @author swany
*
*/

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrie.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrie.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrie.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -12,8 +12,8 @@
* IP information and will provide iterator functionality
*/
public class IpTrie {
-
-
+
+
private Trie trie;
private ArrayList<IpTrieNode> nodelist;
IpTrieNode root;
@@ -89,7 +89,7 @@
for ( IpTrieNode node; it.hasNext(); ) {
node = it.next();
// evaluate what to return
- // here we say if the data pointer is null, but it
+ // here we say if the data pointer is null, but it
// has one child with data, then it is on the summary
front

// hackage for the root node, which might have a null
child
@@ -111,7 +111,7 @@
for ( IpTrieNode node; it.hasNext(); ) {
node = it.next();
// evaluate what to return
- // here we say if the data pointer is null, but it
+ // here we say if the data pointer is null, but it
// has one child with data, then it is on the summary
front

// hackage for the root node, which might have a null
child

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrieNode.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrieNode.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrieNode.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -3,7 +3,7 @@

/**
* @author swany
- * This class contains IP-specific references to a
+ * This class contains IP-specific references to a
* generic Trie
*/
public class IpTrieNode {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/StringBufferUtilities.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/StringBufferUtilities.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/StringBufferUtilities.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,7 +7,7 @@

/**
* Summarization code
- *
+ *
* @author swany
*
*/

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/SummarizeIpAddrs.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/SummarizeIpAddrs.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/SummarizeIpAddrs.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -9,7 +9,7 @@

/**
* Summarization code
- *
+ *
* @author swany
* @author mac
*
@@ -59,7 +59,7 @@
if (args.length > 0) {
inputFile = args[0];
} else {
- inputFile = "IPAddressList.txt";
+ inputFile = "IPAddressList.txt";
}

String[] splitIPAddressInString = StringBufferUtilities.getContents(

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Trie.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Trie.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Trie.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -8,7 +8,7 @@

/**
* Summarization code
- *
+ *
* @author swany
*
*/
@@ -30,7 +30,7 @@
public TrieNode getRootNode() {
return rootNode;
}
-
+
private long firstDigit(long key, long keyLength) {
return ((key >> (keyLength - 1)) & 1);
}
@@ -38,7 +38,7 @@
public Trie Add(long key, long keyLength, Object data) {
nodeCount++;
rootNode.incrementChildCount();
-
+
if (firstDigit(key, keyLength) == 1) {
if (rootNode.getChildOne() != null) {
rootNode.getChildOne().Add(key, keyLength, data);
@@ -217,7 +217,7 @@
if ((node.getChildOne() != null) && (node.getChildZero() != null))
keyList.add(new TrieNode(key, position));
}
-
+
public void printDot(String fileName) throws FileNotFoundException {
FileOutputStream file = new FileOutputStream(fileName);
PrintStream p = new PrintStream(file);
@@ -228,7 +228,7 @@
p.println("}");
p.close();
}
-
+
public ArrayList<String> listInternalNodes() {
long position = Constants.MAX_KEY_LENGTH;
long currentKey = 0;
@@ -236,7 +236,7 @@
rootNode.listInternalNodes(listOfNodes, position, currentKey);
return listOfNodes;
}
-
+
public ArrayList<String> listSummaryNodes() {
long position = Constants.MAX_KEY_LENGTH;
long currentKey = 0;

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/TrieNode.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/TrieNode.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/TrieNode.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -5,7 +5,7 @@

/**
* Summarization code
- *
+ *
* @author swany
*
*/
@@ -16,21 +16,21 @@
private long keyLength;

private long valueCount;
-
+
private long childCount;
-
+
private Object data;

private TrieNode childZero;

private TrieNode childOne;
-
+
HelperClass helper = new HelperClass();

public void incrementChildCount() {
this.childCount++;
}
-
+
public long getChildCount() {
return this.childCount;
}
@@ -137,7 +137,7 @@
long keyDiff;
long keyLengthDiff;
TrieNode newNode;
-
+
long[] commonKeyAndKeyLength =
getCommonPart(key, keyLength, this.key, this.keyLength);

@@ -169,7 +169,7 @@
this.childZero = newNode;
this.childOne = null;
}
-
+
if(newNode.childOne == null && newNode.childZero == null){
this.childCount++;
if(newNode.childCount > 1) {
@@ -200,7 +200,7 @@
this.childZero.setData(data);
}
}
- }
+ }
else {
this.valueCount = 1;
//this.data = data; //XXX
@@ -288,7 +288,7 @@

return clone;
}
-
+
public void printDotNode(PrintStream p, TrieNode node, long position,
long currentKey) {
TrieNode c0 = node.getChildZero();
TrieNode c1 = node.getChildOne();
@@ -299,7 +299,7 @@
if (key == -1) {
addrString = "\"" + "0.0.0.0/0" + "\"";
currentKey = 0;
- p.println(addrString + "
[shape=record,label=\"<f0>0.0.0.0/0|<f1>"
+ p.println(addrString + "
[shape=record,label=\"<f0>0.0.0.0/0|<f1>"
+ node.getChildCount()
+ "\"];" + " // COUNT: " +
node.getChildCount());
}
@@ -327,9 +327,9 @@
long c0Position = position - c0.getKeyLength();
long c0Mask = Constants.MAX_KEY_LENGTH - c0Position;
c0Key = c0Key | currentKey;
- p.println(addrString + " -> \""
+ p.println(addrString + " -> \""
+ helper.longToIP(c0Key) + "/" + c0Mask
- + "\"" + "[label=" + (c0Mask - mask)
+ + "\"" + "[label=" + (c0Mask - mask)
+ "];" + "// kl: " + c0.getKeyLength() + "
pos: " + position);
printDotNode(p, c0, c0Position, c0Key);
}
@@ -338,14 +338,14 @@
long c1Position = position - c1.getKeyLength();
long c1Mask = Constants.MAX_KEY_LENGTH - c1Position;
c1Key = c1Key | currentKey;
- p.println(addrString + " -> \""
+ p.println(addrString + " -> \""
+ helper.longToIP(c1Key) + "/" + c1Mask
+ "\"" + "[label=" + (c1Mask - mask)
+ "];" + "// kl: " + c1.getKeyLength() + "
pos: " + position);
printDotNode(p, c1, c1Position, c1Key);
}
}
-
+
public ArrayList<String> listInternalNodes(ArrayList<String>
listOfNodes, long position, long currentKey) {
TrieNode c0 = this.getChildZero();
TrieNode c1 = this.getChildOne();
@@ -381,11 +381,11 @@

return listOfNodes;
}
-
+
/**
- *
+ *
* This method returns all the nodes which are necessary to summarize
all inputs.
- *
+ *
* @param listOfNodes
* @param position
* @param currentKey

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/AxisClient.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/AxisClient.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/AxisClient.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,12 +17,12 @@
/**
* Simple client for AXIS Web Services connectivity
* Just pass Document and address as arguments
- *
+ *
* @author Maciej Glowiak
*
*/
public class AxisClient implements Client {
-
+
/* (non-Javadoc)
* @see org.perfsonar.client.axis.Client#sendRequest(java.lang.String,
org.w3c.dom.Document)
*/
@@ -31,75 +31,75 @@
throws Exception {

// build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
+ SOAPBodyElement requestMessage =
new SOAPBodyElement(requestDocument.getDocumentElement());

// get a timestamp.
-// double startTime =
+// double startTime =
// new Long(System.currentTimeMillis()).doubleValue();

// try {
- // prepare to call - set service elements
+ // prepare to call - set service elements
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(endPoint));
call.setOperationName(new
QName("http://soapinterop.org/","submit";));
-
- // call on the end point
+
+ // call on the end point
Object resultObject = call.invoke(new Object[] {requestMessage});
-
+
// get another timestamp
-// double endTime =
+// double endTime =
// new Long(System.currentTimeMillis()).doubleValue();
-
+
// result object is a vector - strange!!! But this is how the
world works :-D
// we will now extract the result from the vector
SOAPBodyElement resultSBE;
-
+
Document resultDocument;
-
+
resultSBE= (SOAPBodyElement)((Vector)resultObject).get(0);
-
- // change it to document - here is where validity
+
+ // change it to document - here is where validity
// can be checked..
- resultDocument = resultSBE.getAsDocument();
-
+ resultDocument = resultSBE.getAsDocument();
+
// DOMBuilder factory1 = new DOMBuilder();
// org.jdom.Document domResult = factory1.build(result);
// XMLOutputter outputter = new XMLOutputter();
// outputter.output(domResult,outWriter);
-
+
return resultDocument;
// } catch (Exception ex) {
-//
+//
// }
-
+
}
-
-
+
+
public Message sendRequest(String endPoint, Message message, String
parserFile) throws Exception {

- // create document
+ // create document
DocumentBuilder builder = DocumentBuilderFactory.
newInstance().newDocumentBuilder();
-
- Document requestDocument = builder.newDocument();
+
+ Document requestDocument = builder.newDocument();
requestDocument = message.getDOM(requestDocument);

//send request Document to url
AxisClient client = new AxisClient();
-
- Document responseDocument =
+
+ Document responseDocument =
client.sendRequest(endPoint, requestDocument);

//return response as Message
Message msg = XMLUtils.convertToMessage(
- responseDocument,
+ responseDocument,
parserFile);
-
+
return msg;
-
+
} //sendRequest

-
+
} //AxisClient

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClient.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClient.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClient.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -53,7 +53,7 @@

try {
edugainCSR = ClientProtocolHandler.generateCSR(
- StringConstants.edugainCertIdentifier,
+ StringConstants.edugainCertIdentifier,
eduGainKeyPair,
"SHA1withRSA"
);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClientConfiguration.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClientConfiguration.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClientConfiguration.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -126,7 +126,7 @@
if (s != null) {
this.cipherSuites = s.trim().split(" ");
}
-
+
s =
props.getProperty(OptionalPropertyNames.STARTTLS_PROTOCOLS);
if (s != null) {
this.tlsProtocols = s.trim().split(" ");
@@ -227,7 +227,7 @@
return serverPort;
}

- /**
+ /**
* Returns the JCE algorithm name for generating keypairs.
*/
public String getKeyAlgorithm() {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/RequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/RequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/RequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -9,23 +9,23 @@

/**
* @author Maciej Glowiak
- *
+ *
* Common interface for all classes that are able to generate requests as
* NMWG Message object
- *
+ *
*/
public interface RequestGenerator {

-
+
// --------------------------------------------------------- Public
methods
-
+
/**
- * Creates NMWG Message that contains particular request
+ * Creates NMWG Message that contains particular request
* @return NMWG Message containing Request
- *
+ *
* @throws SystemException
*/
public Message generateRequestMessage() throws PerfSONARException;
-
-
+
+
} //RequestGenerator
\ No newline at end of file

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthNEERequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthNEERequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthNEERequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -28,7 +28,7 @@
Data data = new Data();
data.setId(dataId);
data.setMetadataIdRef(metaId);
-
+
Message message = new Message();
message.setType(messageType);
message.setMetadata(meta);
@@ -49,7 +49,7 @@
Data data = new Data();
data.setId(dataId);
data.setMetadataIdRef(metaId);
-
+
Message message = new Message();
message.setType(messageType);
message.setMetadata(meta);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthREERequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthREERequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthREERequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -28,7 +28,7 @@
Data data = new Data();
data.setId(dataId);
data.setMetadataIdRef(metaId);
-
+
Message message = new Message();
message.setType(messageType);
message.setMetadata(meta);
@@ -49,7 +49,7 @@
Data data = new Data();
data.setId(dataId);
data.setMetadataIdRef(metaId);
-
+
Message message = new Message();
message.setType(messageType);
message.setMetadata(meta);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/EchoRequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/EchoRequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/EchoRequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -14,7 +14,7 @@

/**
* @author Maciej Glowiak
- *
+ *
* This class can generate simple LSKDeregisterRequest as a Message element
* The only parameter you must set is "ls key value"
*/
@@ -27,9 +27,9 @@
*/
private static final String MESSAGE_TYPE = "EchoRequest";

- private static final String LS_ECHO_EVENT_TYPE =
"http://schemas.perfsonar.net/tools/admin/echo/ls/2.0";;
+ private static final String LS_ECHO_EVENT_TYPE =
"http://schemas.perfsonar.net/tools/admin/echo/ls/2.0";;
private static final String YES = "yes";
-
+
// ----------------------------------------------------- Instance
variables


@@ -46,16 +46,16 @@
private boolean testDBConnection = true;

private boolean testDBSchema = true;
-
+
// --------------------------------------------------- Public
constructors

/**
* Sets query and query type
*/
public EchoRequestGenerator() {
-
+
super();
-
+
}

// ------------------------------------------- public methods
@@ -68,23 +68,23 @@

Metadata meta = new Metadata();
meta.setId(metaId);
-
+
EventType evt = new EventType();
evt.setId("query-type");
evt.setEventType(LS_ECHO_EVENT_TYPE);

Parameters params = new Parameters();
- params.setId("modifiers");
+ params.setId("modifiers");

if (testDBConnection)
params.addParameter("testDBConnection", YES);
if (testDBSchema)
params.addParameter("testDBSchema", YES);
-
+
Data data = new Data();
data.setId(dataId);
data.setMetadataIdRef(metaId);
-
+
Message message = new Message();
message.setType(MESSAGE_TYPE);
meta.setParameters(params);
@@ -125,19 +125,19 @@



-
- // -------------- TEST
---------------------------------------------------
-
+
+ // -------------- TEST
---------------------------------------------------
+
// public static void main(String[] args) throws PerfSONARException {
-//
-// EchoRequestGenerator request =
+//
+// EchoRequestGenerator request =
// new EchoRequestGenerator();
-//
+//
// String msgtxt =
XMLUtils.serializeXML(request.generateRequestMessage());
// System.out.println(msgtxt);
-//
+//
// }

-

+
} //EchoRequestGenerator

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSDeregisterRequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSDeregisterRequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSDeregisterRequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -15,7 +15,7 @@

/**
* @author Maciej Glowiak
- *
+ *
* This class can generate simple LSKDeregisterRequest as a Message element
* The only parameter you must set is "ls key value"
*/
@@ -26,7 +26,7 @@
/**
* Message Type
*/
- private static final String MESSAGE_TYPE = "LSKeepaliveRequest";
+ private static final String MESSAGE_TYPE = "LSKeepaliveRequest";

// ----------------------------------------------------- Instance
variables

@@ -50,17 +50,17 @@
* Default query
*/
private String lsKey = "";
-
+
// --------------------------------------------------- Public
constructors

/**
* Sets query and query type
*/
public LSDeregisterRequestGenerator(String lsKey) {
-
+
super();
setLsKey(lsKey);
-
+
}

// ------------------------------------------- public methods
@@ -126,19 +126,19 @@
this.lsKey = lsKey;
}

-
- // -------------- TEST
---------------------------------------------------
-
+
+ // -------------- TEST ---------------------------------------------------
+
// public static void main(String[] args) throws PerfSONARException {
-//
-// LSDeregisterRequestGenerator request =
+//
+// LSDeregisterRequestGenerator request =
// new
LSDeregisterRequestGenerator("http://reed.man.poznan.pl:8080/axis/services/MA";);
-//
+//
// String msgtxt = XMLUtils.serializeXML(request.generateRequestMessage());
// System.out.println(msgtxt);
-//
+//
//}

-

+
} //LSDeregisterRequestGenerator

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSKeepaliveRequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSKeepaliveRequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSKeepaliveRequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -14,7 +14,7 @@

/**
* @author Maciej Glowiak
- *
+ *
* This class can generate simple LSKeepaliveRequest as a Message element
* The only parameter you must set is "ls key value"
*/
@@ -25,7 +25,7 @@
/**
* Message Type
*/
- private static final String MESSAGE_TYPE = "LSDeregisterRequest";
+ private static final String MESSAGE_TYPE = "LSDeregisterRequest";

// ----------------------------------------------------- Instance
variables

@@ -49,17 +49,17 @@
* Default query
*/
private String lsKey = "";
-
+
// --------------------------------------------------- Public
constructors

/**
* Sets query and query type
*/
public LSKeepaliveRequestGenerator(String lsKey) {
-
+
super();
setLsKey(lsKey);
-
+
}

// ------------------------------------------- public methods
@@ -125,19 +125,19 @@
this.lsKey = lsKey;
}

-
- // -------------- TEST
---------------------------------------------------
-
+
+ // -------------- TEST ---------------------------------------------------
+
// public static void main(String[] args) throws PerfSONARException {
-//
-// LSKeepaliveRequestGenerator request =
+//
+// LSKeepaliveRequestGenerator request =
// new
LSKeepaliveRequestGenerator("http://reed.man.poznan.pl:8080/axis/services/MA";);
-//
+//
// String msgtxt =
XMLUtils.serializeXML(request.generateRequestMessage());
// System.out.println(msgtxt);
-//
+//
// }

-

+
} //LSKeepaliveRequestGenerator

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSQueryRequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSQueryRequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSQueryRequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -15,7 +15,7 @@

/**
* @author Maciej Glowiak
- *
+ *
* This class can generate simple LSQueryRequest as a Message element
* The only parameter you must set is "query"
*/
@@ -31,7 +31,7 @@
/**
* Message Type
*/
- private static final String MESSAGE_TYPE = "LSQueryRequest";
+ private static final String MESSAGE_TYPE = "LSQueryRequest";

// ----------------------------------------------------- Instance
variables

@@ -54,31 +54,31 @@
* Default query
*/
private String query = "";
-
+
// --------------------------------------------------- Public
constructors

/**
* Sets query and query type
*/
public LSQueryRequestGenerator(String query, String queryType) {
-
+
super();
setQuery(query);
setQueryType(queryType);
-
+
}

-
+
/**
* Sets query. Query type is set to default - see: DEFAULT_QUERY_TYPE
* @param query
*/
public LSQueryRequestGenerator(String query) {
-
+
super();
setQuery(query);
setQueryType(DEFAULT_QUERY_TYPE);
-
+
}

// ------------------------------------------- public methods
@@ -155,19 +155,19 @@
this.queryType = queryType;
}

-
- // -------------- TEST
---------------------------------------------------
-
+
+ // -------------- TEST ---------------------------------------------------
+
// public static void main(String[] args) throws PerfSONARException {
-//
-// LSQueryRequestGenerator request =
+//
+// LSQueryRequestGenerator request =
// new LSQueryRequestGenerator("Q U E R Y");
-//
+//
// String msgtxt =
XMLUtils.serializeXML(request.generateRequestMessage());
// System.out.println(msgtxt);
-//
+//
// }

-

+
} //LSQueryRequestGenerator

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSRegisterRequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSRegisterRequestGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSRegisterRequestGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -40,30 +40,30 @@
public final static String SUMMARY_EVENT_TYPE =
"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/summary/2.0";;

String eventType = SERVICE_EVENT_TYPE;
-
+
// ----------------------------------------------------- Instance
variables
-
+
/**
* Map of common parameters (in metadata)
*/
private Map<String,String> commonParameters;
-
+
/**
- * data blocks as Strings
+ * data blocks as Strings
*/
private String[] metadataElements;
-
-
+
+
private String parserFile = null;
-
+
// --------------------------------------------------------- Public
Methods

-
+
@Override
public Message generateRequestMessage() throws PerfSONARException {
-
+
//System.out.println("LSRegisterRequestGenerator: generateRequest");
-
+
//message
Message message = new Message();
message.setType("LSRegisterRequest");
@@ -85,7 +85,7 @@
evt.setEventType(eventType);
metadata.setEventType(evt);
}
-
+
Subject subject = new Subject();
subject.setId("commonParameters");
metadata.setSubject(subject);
@@ -103,7 +103,7 @@
"error.lsregistrator.no_accesspoint",
"AccessPoint parameter was empty. Registration failed");
AccessPoint ap = new AccessPoint();
- ap.setAccessPoint(accessPointString);
+ ap.setAccessPoint(accessPointString);
service.setAccessPoint(ap);

//service name -- mandatory
@@ -113,7 +113,7 @@
"ServiceName parameter was not found. Registration failed");
if (serviceNameString != null && serviceNameString.isEmpty()) throw
new PerfSONARException(
"error.lsregistrator.no_servicename",
- "ServiceName parameter was empty. Registration failed");

+ "ServiceName parameter was empty. Registration failed");
ServiceName sn = new ServiceName();
sn.setServiceName(serviceNameString);
service.setServiceName(sn);
@@ -125,7 +125,7 @@
"ServiceType parameter was not found. Registration failed");
if (serviceTypeString != null && serviceTypeString.isEmpty()) throw
new PerfSONARException(
"error.lsregistrator.no_servicename",
- "ServiceType parameter was empty. Registration failed");

+ "ServiceType parameter was empty. Registration failed");
ServiceType st = new ServiceType();
st.setServiceType(serviceTypeString);
service.setServiceType(st);
@@ -155,7 +155,7 @@
sv.setServiceVersion(param);
service.setServiceVersion(sv);
}
-
+
//contact-email - optional
param= commonParameters.get("contact_email");
if (param!=null) {
@@ -163,38 +163,38 @@
ce.setContactEmail(param);
service.setContactEmail(ce);
}
-
+
//add supported event types
param= commonParameters.get("supported_event_types");
if (param!=null) {
-
+
String[] supportedEventTypes = param.split("\\,\\ *");
-
+
Parameters eventTypes = new Parameters();
eventTypes.setId("supportedEventTypes");
-
+
for (int i=0; i<supportedEventTypes.length; i++) {
String et=supportedEventTypes[i];
if (!(et != null && et.isEmpty()))
eventTypes.addParameter("supportedEventType_"+i, et);
}
-
+
metadata.setParameters(eventTypes);
-
+
}
-
+
//data fields
-
+
//System.out.println("LSRegisterRequestGenerator: ");
-
+
//Create DATAs
-
+
if (metadataElements!=null) {

//if there are some metadata to be put inside data elements
//put them
-
- //TODO: get rid of getting parser file from CONFIG here
+
+ //TODO: get rid of getting parser file from CONFIG here
if (parserFile==null) {
parserFile = ((ConfigurationComponent)
AuxiliaryComponentManager.getInstance()

.getComponent(ComponentNames.CONFIG)).getProperty("service.sax_parser.config");
@@ -203,11 +203,11 @@
parserFile = file.getAbsolutePath();
}
}
-
+
for (int i=0; i<metadataElements.length; i++) {
-
+
//System.out.println("LSRegisterRequestGenerator: process
data "+i);
-
+
String xml =
"<nmwg:message
xmlns=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/\"; "
+
"xmlns:perfsonar=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/\"; "
@@ -215,15 +215,15 @@
+ "xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\"; "
+
"xmlns:nmwgtopo=\"http://ggf.org/ns/nmwg/topology/2.0/\"; "
+ ">\n"
-
+
+ "<nmwg:data id=\"data"+i+"\"
metadataIdRef=\"serviceLookupInfo\">\n"
+ metadataElements[i]
+ "</nmwg:data>\n"
-
+
+ "\n</nmwg:message>\n";
-
+
Map<String, Element> dataFromXML =
XMLUtils.getElementFromXML(
- xml, "data",
+ xml, "data",
parserFile);

if (dataFromXML!=null) {
@@ -236,44 +236,44 @@

}
}
-
+
}
-
- //finally if there are no data elements, create one
+
+ //finally if there are no data elements, create one
if (message.getDataArray().length==0) {
-
+
Data d = new Data();
d.setId("data");
d.setMetadataIdRef(METADATA_ID);
message.setData(d);
-
- }
+
+ }
return message;
-
- }
-
-
+
+ }
+
+
public void setCommonParameters(Map<String,String> commonParameters) {
-
+
this.commonParameters = commonParameters;
-
+
}

-
+
public String[] getMetadataElements() {

return metadataElements;
-
+
}

public void setMetadataElements(String[] metadata) {
-
+
this.metadataElements = metadata;
-
+
}

- public Map<String,String> getCommonParameters() {
- return commonParameters;
+ public Map<String,String> getCommonParameters() {
+ return commonParameters;
}

public String getParserFile() {
@@ -284,8 +284,8 @@
public void setParserFile(String parserFile) {
this.parserFile = parserFile;
}
-
-
+
+
public void setEventType(String evt) {
eventType = evt;
}
@@ -304,5 +304,5 @@
// Message m = g.generateRequestMessage();
// System.out.println(XMLUtils.serializeXML(m) );
// }
-
+
} //LSRegisterRequestGenerator

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/XQueryExpression.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/XQueryExpression.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/XQueryExpression.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,36 +7,36 @@

/**
* @author Maciej Glowiak
- *
+ *
* XQuery expression. Can generate specific XQuery expression string
*
*/
public interface XQueryExpression {
-
+
/**
* The name of the store collection (containing LS data/metadata
*/
public static final String LS_STORE_COLLECTION_TYPE = "LSStore";
-
-
+
+
/**
* The name of the control collection of LS
*/
public static final String LS_STORE_CONTROL_COLLECTION_TYPE =
"LSStore-control";

-
- public final static String DECLARE_NMWG_NAMESPACE =
+
+ public final static String DECLARE_NMWG_NAMESPACE =
"declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/'; \n";
-
+
/**
- * Namespaces declaration for perfSONAR
+ * Namespaces declaration for perfSONAR
*/
- public final static String XQUERY_DECLARE_NAMESPACES =
+ public final static String XQUERY_DECLARE_NAMESPACES =
"declare namespace
perfsonar='http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/'; \n"+
DECLARE_NMWG_NAMESPACE +
"declare namespace
psservice='http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/'; \n"+
- "declare namespace nmwgt='http://ggf.org/ns/nmwg/topology/2.0/';
\n"+
- "declare namespace
netutil='http://ggf.org/ns/nmwg/characteristic/utilization/2.0/'; \n";
+ "declare namespace nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; \n"+
+ "declare namespace
netutil='http://ggf.org/ns/nmwg/characteristic/utilization/2.0/'; \n";

public static final String SERVICE_TYPE = "psservice:serviceType";
public static final String SERVICE_NAME = "psservice:serviceName";
@@ -46,14 +46,14 @@
public static final String ORGANIZATION_NAME =
"psservice:organization_name";
public static final String SERVICE_VERSION =
"psservice:serviceVersion";
public static final String CONTACT_EMAIL = "psservice:contact_email";
-
+
public static final String EVENT_TYPE = "nmwg:eventType";
-
+
/**
* Method returns XQuery expression
* @return
*/
public String generateExpression();
-

+
} //XQueryExpression

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/lookupService/GenericXQueryExpression.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/lookupService/GenericXQueryExpression.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/lookupService/GenericXQueryExpression.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -12,95 +12,95 @@
*/
public class GenericXQueryExpression implements XQueryExpression {

-
+
//---------------------------------------------------------------
constants
-
-
+
+
public static final int RETURN_FULL_LOOKUP_INFO = 1;
public static final int RETURN_FULL_METADATA = 2;
public static final int RETURN_SERVICE_NAME = 3;
public static final int RETURN_SERVICE_URL = 4;
- public static final int RETURN_ACCESS_POINT = RETURN_SERVICE_URL;
-
+ public static final int RETURN_ACCESS_POINT = RETURN_SERVICE_URL;
+
protected static final String PSSERVICE_PREFIX =
"$m/perfsonar:subject/psservice:service/";
protected static final String DATA_PREFIX = "$d/nmwg:metadata//";
-
+
// ---------------------------------------------------- instance
variables
-
- private HashMap<String,Condition> conditions
+
+ private HashMap<String,Condition> conditions
= new HashMap<String,Condition>();

private int resultType = RETURN_SERVICE_URL;
-
+
private boolean isLetData = false;
-
- // ------------------------------------------------------------
constructor
-
+
+ // ------------------------------------------------------------
constructor
+
public GenericXQueryExpression() {
}
-
-
+
+
// --------------------------------------------------------- public
methods
-
-
+
+
@Override
public String generateExpression() {
-
+
StringBuffer xq = new StringBuffer();
-
+
addDeclarations(xq);
-
+
addForExpression(xq);

if (isLetData) {
//resultType == RETURN_FULL_LOOKUP_INFO) {
//LET expression /if necessary/
addLetDataExpression(xq);
- }
+ }

- addWhereExpression(xq, conditions.values());
-
+ addWhereExpression(xq, conditions.values());
+
addReturnExpression(xq, resultType);
-
+
return xq.toString();
}

-
-
+
+
protected StringBuffer addLetDataExpression(StringBuffer xq) {
-
+
xq.append(
- "let $d :=
/nmwg:store[@type='LSStore']/nmwg:data[@metadataIdRef=$m/@id]");

+ "let $d :=
/nmwg:store[@type='LSStore']/nmwg:data[@metadataIdRef=$m/@id]");
return xq;
-
+
}


protected StringBuffer addDeclarations(StringBuffer xq) {
-
+
//DECLARE expression - namespace declaration
-
+
xq.append(XQUERY_DECLARE_NAMESPACES);
return xq;
-
+
}


protected StringBuffer addForExpression(StringBuffer xq) {
-
+
//FOR expression
-
+
xq.append("for $m in
/nmwg:store[@type='LSStore']/nmwg:metadata\n");
return xq;
-
+
}


protected StringBuffer addWhereExpression(
StringBuffer xq, Collection<Condition> conditions) {
-
+
//WHERE expression
-
+
if (!conditions.isEmpty()) {
xq.append("where\n");
int i=0;
@@ -120,9 +120,9 @@

protected StringBuffer addReturnExpression(StringBuffer xq, int
resultType) {
//RETURN expression
-
+
xq.append("return ");
-
+
if (resultType == RETURN_FULL_LOOKUP_INFO) {
xq.append("<nmwg:message>{$m} {$d}</nmwg:message>");
} else if (resultType == RETURN_FULL_METADATA) {
@@ -140,129 +140,129 @@
}
return xq;
}
-
+
public void addMetadataCondition_Is(String name, String value) {
-
+
conditions.put(
- name,
+ name,
new Condition(
PSSERVICE_PREFIX+name,
value,
Condition.IS));
}
-
-
+
+
public void addMetadataCondition_Contains(String name, String value) {
-
+
conditions.put(
- name,
+ name,
new Condition(
PSSERVICE_PREFIX+name,
value,
Condition.CONTAINS));
-
+
}
-

+
public void addMetadataCondition_Prefix(String name, String value) {
-
+
conditions.put(
- name,
+ name,
new Condition(
PSSERVICE_PREFIX+name,
value,
Condition.PREFIX));
-
+
}

-
+
public void addMetadataCondition_Suffix(String name, String value) {
-
+
conditions.put(
- name,
+ name,
new Condition(
PSSERVICE_PREFIX+name,
value,
Condition.SUFFIX));
-
+
}
-

+
public void addDataCondition_Is(String name, String value) {
-
+
isLetData = true;
conditions.put(
- name,
+ name,
new Condition(
DATA_PREFIX+name,
value,
Condition.IS));
}
-
-
+
+
public void addDataCondition_Contains(String name, String value) {
-
+
isLetData = true;
conditions.put(
- name,
+ name,
new Condition(
DATA_PREFIX+name,
value,
Condition.CONTAINS));
-
+
}
-

+
public void addDataCondition_Prefix(String name, String value) {
-
+
isLetData = true;
conditions.put(
- name,
+ name,
new Condition(
DATA_PREFIX+name,
value,
Condition.PREFIX));
-
+
}

-
+
public void addDataCondition_Suffix(String name, String value) {
-
+
isLetData = true;
conditions.put(
- name,
+ name,
new Condition(
DATA_PREFIX+name,
value,
Condition.SUFFIX));
-
+
}
-
-
-
+
+
+
public void setResultType(int resultType) {

if (resultType==RETURN_FULL_LOOKUP_INFO) isLetData = true;

this.resultType = resultType;
-
+
}

-
+
// ------------------------------------------------------------ Inner
class
-
-
+
+
protected class Condition {
-
+
public final static int IS = 0;
public final static int PREFIX = 1;
public final static int SUFFIX = 2;
public final static int CONTAINS = 3;

private String name;
- private String value;
+ private String value;
private int conditionType = 0;
-
+
public Condition(String name, String value, int conditionType) {
this.name = name;
this.value = value;
@@ -280,11 +280,11 @@
public String getValue() {
return value;
}
-
+
public String getXQueryCondition() {
return getXQueryCondition(null);
}
-
+
public String getXQueryCondition(String prefix) {
StringBuilder sb = new StringBuilder();
if (getConditionType() == IS) {
@@ -319,7 +319,7 @@
sb.append("'");
sb.append(value);
sb.append("')");
- }
+ }
return sb.toString();
}

@@ -327,7 +327,7 @@


// ----------------------------------------------------------- Main -
test
-
+
public static void main (String[] s) {
GenericXQueryExpression g = new GenericXQueryExpression();
g.addMetadataCondition_Is(SERVICE_TYPE, "MA");
@@ -336,7 +336,7 @@
//g.setResultType(RETURN_FULL_LOOKUP_INFO);
String xquery = g.generateExpression();
System.out.println(xquery);
- }
-
-
+ }
+
+
} //GenericXQueryExpression

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClient.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClient.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClient.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -28,7 +28,7 @@


/**
- * Class which provides the basic web service (Doc/Lit) client capability
+ * Class which provides the basic web service (Doc/Lit) client capability
* without stubs.
*
* @author loukik
@@ -66,14 +66,14 @@
System.out.println("Request file: " + inputFile);
System.out.println("Response file: " + outputFile);

- // prepare to call - set service elements
+ // prepare to call - set service elements
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(endPoint));
call.setOperationName(new
QName("http://soapinterop.org/","submit";));


- // read the request into a org.w3c.DOM.Document
+ // read the request into a org.w3c.DOM.Document

Document request;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
@@ -85,20 +85,20 @@

// build a SOAPBodyElement from the document

- SOAPBodyElement requestMessage =
+ SOAPBodyElement requestMessage =
new SOAPBodyElement(request.getDocumentElement());


// get a timestamp.
- double startTime =
+ double startTime =
new Long(System.currentTimeMillis()).doubleValue();

- // call on the end point
+ // call on the end point

Object resultObject = call.invoke(new Object[] {requestMessage});

// get another timestamp
- double endTime =
+ double endTime =
new Long(System.currentTimeMillis()).doubleValue();

// result object is a vector - strange!!! But this is how the
world works :-D
@@ -111,9 +111,9 @@

resultSBE= (SOAPBodyElement)((Vector)resultObject).get(0);

- // change it to document - here is where validity
+ // change it to document - here is where validity
// can be checked..
- result = resultSBE.getAsDocument();
+ result = resultSBE.getAsDocument();

// output it to a file
File response = new File(outputFile);
@@ -123,11 +123,11 @@
format.setIndent(4);
format.setIndenting(true);
format.setLineSeparator("\n");
-
+
XMLSerializer serial = new XMLSerializer(outWriter, format );
serial.asDOMSerializer();
serial.serialize( result.getDocumentElement() );
-
+
outWriter.close();



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClientMulti.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClientMulti.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClientMulti.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -25,7 +25,7 @@


/**
- * Class which provides the basic web service (Doc/Lit) client capability
+ * Class which provides the basic web service (Doc/Lit) client capability
* without stubs, which is capable of sending multiple requests to different
* locations at once using threading mechanism with synchronization
* so all the runs are done simultaneously.
@@ -124,14 +124,14 @@
println("Request file: " + this.inputFile);
println("Response file: " + this.outputFile);

- // prepare to call - set service elements
+ // prepare to call - set service elements
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(this.endPoint));
call.setOperationName(new
QName("http://soapinterop.org/","submit";));


- // read the request into a org.w3c.DOM.Document- this is read
+ // read the request into a org.w3c.DOM.Document- this is read
// from c:\work\xmlFile2.xml
Document request;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
@@ -144,20 +144,20 @@

// build a SOAPBodyElement from the document

- SOAPBodyElement requestMessage =
+ SOAPBodyElement requestMessage =
new SOAPBodyElement(request.getDocumentElement());


// get a timestamp.
- double startTime =
+ double startTime =
new Long(System.currentTimeMillis()).doubleValue();

- // call on the end point
+ // call on the end point

Object resultObject = call.invoke(new Object[] {requestMessage});

// get another timestamp
- double endTime =
+ double endTime =
new Long(System.currentTimeMillis()).doubleValue();

// result object is a vector - strange!!! But this is how the
world works :-D
@@ -170,14 +170,14 @@

resultSBE= (SOAPBodyElement)((Vector)resultObject).get(0);

- // change it to document - here is where validity
+ // change it to document - here is where validity
// can be checked..
- result = resultSBE.getAsDocument();
+ result = resultSBE.getAsDocument();

// output it to a file
File response = new File(this.outputFile);
FileWriter outWriter = new FileWriter(response);
-
+
OutputFormat format = new OutputFormat( result );
format.setIndent(4);
format.setIndenting(true);
@@ -186,7 +186,7 @@
XMLSerializer serial = new XMLSerializer(outWriter, format );
serial.asDOMSerializer();
serial.serialize( result.getDocumentElement() );
-
+
outWriter.close();

} catch (ClassCastException e) {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPUbCClient.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPUbCClient.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPUbCClient.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -157,7 +157,7 @@
WSSecHeader secHeader = new WSSecHeader();
secHeader.setActor("test");
secHeader.insertSecurityHeader(doc);
-
+
PrivateKey privateKey=keyPair.getPrivate();
X509Certificate cert = client.getCertficate(keyPair);
ks.setKeyEntry("xmlsec", privateKey, "security".toCharArray(),
new Certificate[]{cert});
@@ -204,7 +204,7 @@
// change it to document - here is where validity
// can be checked..
result = resultSBE.getAsDocument();
-
+
// output it to a string
StringWriter outWriter = new StringWriter();


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -208,12 +208,12 @@
e.printStackTrace();
String m = "AADispatchSOAPProtocol.getAuthentication:
We didn't get a Vector of SOAPBodyElements!";
System.out.println(m);
- throw new PerfSONARException("error.as.body",m);
+ throw new PerfSONARException("error.as.body",m);
} catch (Exception e) {
e.printStackTrace();
String m="AADispatchSOAPProtocol.getAuthentication:
General exception while retrieving report";
System.out.println(m);
- throw new PerfSONARException("error.as.query",m);
+ throw new PerfSONARException("error.as.query",m);
}

return resp;
@@ -255,12 +255,12 @@
e.printStackTrace();
String m = "AADispatchSOAPProtocol.getAuthorization:
We didn't get a Vector of SOAPBodyElements!";
System.out.println(m);
- throw new PerfSONARException("error.as.body",m);
+ throw new PerfSONARException("error.as.body",m);
} catch (Exception e) {
e.printStackTrace();
String m="AADispatchSOAPProtocol.getAuthorization:
General exception while retrieving report";
System.out.println(m);
- throw new PerfSONARException("error.as.query",m);
+ throw new PerfSONARException("error.as.query",m);
}

}
@@ -284,12 +284,12 @@
e.printStackTrace();
String m = "AADispatchSOAPProtocol.getAttributes: We
didn't get a Vector of SOAPBodyElements!";
System.out.println(m);
- throw new PerfSONARException("error.as.body",m);
+ throw new PerfSONARException("error.as.body",m);
} catch (Exception e) {
e.printStackTrace();
String m="AADispatchSOAPProtocol.getAttributes:
General exception while retrieving report";
System.out.println(m);
- throw new PerfSONARException("error.as.query",m);
+ throw new PerfSONARException("error.as.query",m);
}



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenSOAPManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenSOAPManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenSOAPManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -118,7 +118,7 @@
WSSecurityEngine secEngine = new
WSSecurityEngine();
// If there is any problem validating the
SOAP header, it throws an exception
secEngine.processSecurityHeader(doc, null,
null, crypto);
-
+
XPathFactory factory =
XPathFactory.newInstance();
XPath xpath = factory.newXPath();
xpath.setNamespaceContext(new
WSSENamespaceContext());

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -22,7 +22,7 @@
*
*/
public class StartupInitializer implements ServletContextListener {
- // --------------------------------------------------------- Public
methods
+ // --------------------------------------------------------- Public
methods
/**
* Context initialized event handler.
*
@@ -41,12 +41,12 @@
} catch (Exception e) {
System.err.println("Error initializing perfSONAR: " + e);
e.printStackTrace();
- }
+ }
}
/**
* Context uninitialized event handler.
- *
*
+ *
* @param sce servlet context event
*/
@Override
@@ -55,15 +55,15 @@
// They should implement AuxiliaryThreadedComponent instead of
// AuxiliaryComponent
try {
-
+
Iterator<Map.Entry<String, AuxiliaryComponent>> it =
AuxiliaryComponentManager.getInstance().componentsIterator();
-
+
while (it != null && it.hasNext()) {
-
+
Map.Entry<String, AuxiliaryComponent> e = it.next();
-
+
if (e.getValue() instanceof AuxiliaryThreadedComponent) {
-
+
System.out.println(
"Stopping perfSONAR component thread for "
+ e.getKey()
@@ -71,10 +71,10 @@
((AuxiliaryThreadedComponent)e.getValue()).stopThread();
}
}
-
- } catch (Exception e) {
- System.err.println("Error stopping perfSONAR threaded
components: " + e);
+
+ } catch (Exception e) {
+ System.err.println("Error stopping perfSONAR threaded
components: " + e);
}
-
+
}
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -79,11 +79,11 @@
/**
* Action type to LS Cleanup
*/
- public static final String LS_CLEANUP = "LS_CLEANUP";
+ public static final String LS_CLEANUP = "LS_CLEANUP";


/**
- * Action type for LS Control
+ * Action type for LS Control
*/
public static final String LS_CONTROL = "LS_CONTROL";

@@ -101,7 +101,7 @@


/**
- * Action type to request information set of the service
+ * Action type to request information set of the service
*/
public static final String GET_LOOKUP_INFO = "GET_LOOKUP_INFO";


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngine.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngine.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngine.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -27,15 +27,15 @@
/**
* Executes an action.
*
- * @param actionType Parameter from the static list defined in
ActionType
- * which specifies the necessary action to be taken
- * @param request Message object containing the request
+ * @param actionType Parameter from the static list defined in
ActionType
+ * which specifies the necessary action to be taken
+ * @param request Message object containing the request
* @return Message final result of of performed action
*
- * @throws PerfSONARException if the system encountered an internal
error
+ * @throws PerfSONARException if the system encountered an internal
error
* while satisfying this request
- *
- * @see org.perfsonar.service.commons.engine.ActionType
+ *
+ * @see org.perfsonar.service.commons.engine.ActionType
* @see org.perfsonar.service.commons.engine.ServiceEngineRequest
* @see org.perfsonar.service.commons.engine.ServiceEngineResponse
*

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngineFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngineFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngineFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -27,7 +27,7 @@
*
* @return String type of Service Engine
*
- * @throws PerfSONARException if an error was encountered while
+ * @throws PerfSONARException if an error was encountered while
* getting the instance
*/
public static ServiceEngine getServiceEngine(String engineClassName)
throws PerfSONARException {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/measurementExecutor/MeasurementExecutor.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/measurementExecutor/MeasurementExecutor.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/measurementExecutor/MeasurementExecutor.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -10,7 +10,7 @@

/**
* This is an interface specification for MeasurementExecutor
- *
+ *
* @author Loukik
*
*/
@@ -25,9 +25,9 @@

/**
* Operation which takes in a Message and gives out a Message.
Implementations
- * should implement this definition to make measurements and return
data or handle or
- * anything else appropriate
- *
+ * should implement this definition to make measurements and return
data or handle or
+ * anything else appropriate
+ *
* @param request MeasurementExecutorRequest object containing the
request
* @return MeasurementExecutorResponse object containing response
from MeasurementExecutor
* @throws SystemException

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/DataRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/DataRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/DataRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -100,7 +100,7 @@
*/
protected Message metaToKey(
Message reqMessage,
- Message respMessage)
+ Message respMessage)
throws PerfSONARException {

/*
@@ -176,7 +176,7 @@
logger.debug("DataRequest.metaToKey: Back from GET_KEY action");

// pull out data and metadata elements from atomResp
- // and put them in the response message.
+ // and put them in the response message.

int hasData = 0;
for (Iterator j = atomResp.getDataIterator(); j.hasNext();
hasData++) {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/EchoRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/EchoRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/EchoRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -80,7 +80,7 @@
//if no metadata inside, print error
if (respMessage.getMetadataMap().values().isEmpty()) {
ResultCodesUtil.createResultCodeMetadata(
- respMessage,
+ respMessage,
new PerfSONARException(
"warning.common.no_metadata",
"No output metadata was returned by MessageHandler."+

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSCleanupRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSCleanupRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSCleanupRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -13,16 +13,16 @@
*
*/
public class LSCleanupRequest extends LSRequest {
-
+
/**
* @throws SystemException
*/
public LSCleanupRequest() throws PerfSONARException {
-
+
super();
logger.debug("LSCleanupRequest: MessageHandler created");
setType(ActionType.LS_CLEANUP);
-
+
}

}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSDeregisterRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSDeregisterRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSDeregisterRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -13,16 +13,16 @@
*
*/
public class LSDeregisterRequest extends LSRequest {
-
+
/**
* @throws SystemException
*/
public LSDeregisterRequest() throws PerfSONARException {
-
+
super();
logger.debug("LSDeRegisterRequest: MessageHandler created");
setType(ActionType.LS_DEREGISTER);
-
+
}

}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSKeepaliveRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSKeepaliveRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSKeepaliveRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -13,16 +13,16 @@
*
*/
public class LSKeepaliveRequest extends LSRequest {
-
+
/**
* @throws SystemException
*/
public LSKeepaliveRequest() throws PerfSONARException {
-
+
super();
logger.debug("LSKeepaliveRequest: MessageHandler created");
setType(ActionType.LS_KEEPALIVE);
-
+
}

}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSQueryRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSQueryRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSQueryRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -20,12 +20,12 @@
/**
* @throws SystemException
*/
- public LSQueryRequest() throws PerfSONARException {
+ public LSQueryRequest() throws PerfSONARException {
super();
logger.debug("LSQueryRequest: MessageHandler created");
- setType(ActionType.LS_LOOKUP);
+ setType(ActionType.LS_LOOKUP);
}
-
+
@Override
public Map<String,Metadata> mergeAllMetadata(Map<String,Metadata>
metadatas) {


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRegisterRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRegisterRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRegisterRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -19,66 +19,66 @@
/**
* @author Maciej Glowiak
* MessageHandler for LS Regiser Request
- *
- * Note: It doesn't use Request class because of not clear use data
+ *
+ * Note: It doesn't use Request class because of not clear use data
* triggers. Generic Request class splits message into separate
- * "requests" by data triggers. LSRegisterRequest has always one
+ * "requests" by data triggers. LSRegisterRequest has always one
* metadata and a lot of data elements belonging to it. They're not
* actually data triggers, and the message shouldn't be splitted
* into separate requests!
- *
+ *

*/
public class LSRegisterRequest extends LSRequest {
-
+
/**
* @throws SystemException
*/
public LSRegisterRequest() throws PerfSONARException {
-
+
super();
logger.debug("LSRegisterRequest: MessageHandler created");
setType(ActionType.LS_REGISTER);
-
+
}

@Override
protected List<Message> extractMultipleRequests(Message reqMessage) {
-
+
ArrayList<Message> messagesList = new ArrayList<Message>();
-
+
//data chains container <String metadataIdRef, ArrayList<Data>>
- HashMap<String,Message> dataChains = new HashMap<String,Message>();
-
+ HashMap<String,Message> dataChains = new HashMap<String,Message>();
+
//get input data elements
Collection<Data> dataTriggers = reqMessage.getDataMap().values();
-
+
//for all data elelemtns
for (Data data : dataTriggers) {
-
+
//put all data having the same metadataIdRef to the same
container
String metaref = data.getMetadataIdRef();
- if (dataChains.get(metaref)==null)
+ if (dataChains.get(metaref)==null)
dataChains.put(metaref, new Message());
Message m = dataChains.get(metaref);
m.setData(data);
//System.out.println("## data ["+data.getId()+"] ->
["+metaref+"]");
-
+
}
-
- //for each data elements set find chaining
+
+ //for each data elements set find chaining
for (Map.Entry<String, Message> e : dataChains.entrySet()) {

try {

//get previously added message with data elements
Message message = e.getValue();
-
+
//get reference to metadata
String metadataIdRef = e.getKey();

//System.out.println("## metadata chain for
["+metadataIdRef+"]");
-
+
//find metadata chaining
Map<String,Metadata> metadatas = new
HashMap<String,Metadata>();
getChaining(reqMessage, metadataIdRef, metadatas);
@@ -88,12 +88,12 @@
}

//copy id, type from request
- message.setId(reqMessage.getId());
+ message.setId(reqMessage.getId());
message.setType(reqMessage.getType());

//add to result set
messagesList.add(message);
-
+
// System.out.println(" --
["+message.getMetadataArray().length+"] metadatas");
// System.out.println(" --
["+message.getDataArray().length+"] datas");
// try {
@@ -104,15 +104,15 @@
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
-
+
} catch (NoSuchMetadataException e1) {
logger.error("LSRegisterRequest: no such metadata, cannot
find chain!");
}
-
- }
-
+
+ }
+
return messagesList;
-
- }
-
+
+ }
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,7 +11,7 @@

/**
* General MessageHangler for LS
- *
+ *
* @author Maciej Glowiak
*
*/
@@ -21,12 +21,12 @@
* @throws SystemException
*/
public LSRequest() throws PerfSONARException {
-
+
super();
setType("LSRequest");
-
+
}
-
+
/**
* Merge chained metadata elements
* @param metadatas map of metadata elements
@@ -43,50 +43,50 @@

Metadata mergedMetadata = new Metadata();
mergedMetadata.setId("merged-metadata-block");
-
+
for (Metadata m : metadatas.values()) {
-
+
//copy metadata's elements: eventType, Subject, Key
-
+
if (mergedMetadata.getEventType() == null)
mergedMetadata.setEventType(m.getEventType());
-
+
if (mergedMetadata.getSubject() == null)
mergedMetadata.setSubject(m.getSubject());
-
+
if (mergedMetadata.getKey() == null)
mergedMetadata.setKey(m.getKey());
-
+
//copy parameters
-
+
if (mergedMetadata.getParameters() == null)
mergedMetadata.setParameters(m.getParameters());
- else {
- for (Parameter p :
+ else {
+ for (Parameter p :
(Collection<Parameter>)m.getParameters().
getParameterMap().values()) {
-
+
mergedMetadata.addParameter(p);
-
+
}
}
-
+
//copy other elements
-
- for (Element e :
+
+ for (Element e :
(Collection<Element>)m.getChildMap().values()) {
-
+
mergedMetadata.setChild(e);
-
+
}
-
+
}
-
+
return mergedMetadata;
-
+
}
*/

-

+
} //LSRequest

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LinkRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LinkRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LinkRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -42,7 +42,7 @@

@Override
protected Map<String,Metadata> getChaining(
- Message inputMessage, String metadataId, Map<String,Metadata>
metadatas)
+ Message inputMessage, String metadataId, Map<String,Metadata>
metadatas)
throws NoSuchMetadataException {

// node's nodeIdRef might points to a metadata which does not exist
@@ -88,7 +88,7 @@

//get other chain, prevent endless loop
if (!(chainedMetadataId != null && chainedMetadataId.isEmpty())&&
- !(metadata.getId().equals(chainedMetadataId))) {
+ !(metadata.getId().equals(chainedMetadataId))) {
getChaining(inputMessage, chainedMetadataId, metadatas);
}


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LookupInfoRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LookupInfoRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LookupInfoRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -89,17 +89,17 @@
ResultCodesUtil.createResultCodeMetadata(
null, e));

- }
+ }

}

- //do one message from all result messages
+ //do one message from all result messages
Message respMessage = mergeMultipleResponses(output);

//if no metadata inside, print error
if (respMessage.getMetadataMap().values().isEmpty()) {
ResultCodesUtil.createResultCodeMetadata(
- respMessage,
+ respMessage,
new PerfSONARException(
"warning.common.no_metadata",
"No output metadata was returned by MessageHandler."+
@@ -186,7 +186,7 @@
if (accessPointString == null)
accessPointString = "";
AccessPoint ap = new AccessPoint();
- ap.setAccessPoint(accessPointString);
+ ap.setAccessPoint(accessPointString);
service.setAccessPoint(ap);

//service name

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MeasurementRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MeasurementRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MeasurementRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -30,19 +30,19 @@
super();
logger.debug("MeasurementRequest: MessageHandler created");
setType(ActionType.MAKE_MEASUREMENT);
-
+
}

// ---------------------------------- public methods

-
+
@Override
public Map<String,Metadata> mergeAllMetadata(Map<String,Metadata>
metadatas) {

return metadatas;

}
-
-
-
+
+
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandler.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandler.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandler.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -31,7 +31,7 @@
* Runs the correct ServiceEngine for the given request message
* and returns the result.
*/
- public Message execute(Message reqMessage)
+ public Message execute(Message reqMessage)
throws PerfSONARException;



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandlerFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandlerFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandlerFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -32,7 +32,7 @@
if (m2c.isEmpty()){
init();
}
-
+
if (m2c.isEmpty()){
logger.error("MessageHandlerFactory: no known allowed Message
Types");
}
@@ -40,7 +40,7 @@
// get the classname for this message type
String className = m2c.get(messageType);
logger.debug("MessageHandlerFactory: classname asked for is " +
className);
-
+
if (className == null) {
throw new PerfSONARException(
"error.common.action_not_supported",
@@ -59,7 +59,7 @@
logger.fatal("MessageHandlerFactory: Unable to Instantiate
messageHandler for: " + messageType);
logger.fatal("MessageHandlerFactory: because of Instatiation
Problems " + e.getMessage());
throw new PerfSONARException(
- "error.common.action_not_supported",
+ "error.common.action_not_supported",
"MessageHandlerFactory: Unable to create messageHandler
for: " + messageType + " because: " + e.getMessage()
);
} catch (IllegalAccessException e) {
@@ -81,7 +81,7 @@
if (handler == null) {
logger.fatal("MessageHandlerFactory: Unable to create
messageHandler for: " + messageType);
throw new PerfSONARException(
- "error.common.action_not_supported",
+ "error.common.action_not_supported",
"MessageHandlerFactory: Unable to create messageHandler
for: " + messageType
);
}
@@ -94,7 +94,7 @@
if(!m2c.isEmpty()) return; // if the lock was
blocking a other thread then make the second thread do nothing here.

ConfigurationComponent configManager =
(ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
-
+
String serviceType =
configManager.getProperty("service.r.type");
String messageTypes =
configManager.getProperty("service." + serviceType + ".message_types");
String[] allowedMesgTypes =
messageTypes.split("\\s*,\\s*");

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/Request.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/Request.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/Request.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -137,7 +137,7 @@
//if no metadata inside, print error
if (respMessage.getMetadataMap().values().isEmpty()) {
ResultCodesUtil.createResultCodeMetadata(
- respMessage,
+ respMessage,
new PerfSONARException(
"warning.common.no_metadata",
"No output metadata was returned by MessageHandler."+
@@ -211,15 +211,15 @@
* subject chaining reference
* if there is metadata/subject with
* metadataRefId, it should be changed
- *
+ *
* perhaps some metadata-id mapping table
* should be prepared and then all metadata
- * should be iterated and subjects changed?
- *
+ * should be iterated and subjects changed?
+ *
* something like:
- *
+ *
* mapping.add(oldId, newId);
- *
+ *
*/

//put metadata to new common response message
@@ -242,7 +242,7 @@
dataid++;

} //if
- } //datas
+ } //datas
} //metadatas
} //messages
return respMessage;
@@ -308,15 +308,15 @@

/**
* Find metadata chain for metadata ID (the last metadata in chain)
- *
+ *
* @param inputMessage message to process (won't be changed)
* @param lastMetadataId id of metadata which is last in chain
* @return map <id,metadata>
* @throws NoSuchMetadataException thrown if there is no metadata with
given ID
*/
protected Map<String,Metadata> getChaining(
- Message inputMessage, String metadataId, Map<String,Metadata>
metadatas)
- throws NoSuchMetadataException {
+ Message inputMessage, String metadataId, Map<String,Metadata>
metadatas)
+ throws NoSuchMetadataException {

if (metadataId == null) throw new NoSuchMetadataException();

@@ -343,7 +343,7 @@

//get other chain, prevent endless loop
if (!(chainedMetadataId != null && chainedMetadataId.isEmpty())&&
- !(metadata.getId().equals(chainedMetadataId))) {
+ !(metadata.getId().equals(chainedMetadataId))) {
getChaining(inputMessage, chainedMetadataId, metadatas);
}

@@ -372,10 +372,10 @@


/**
- * Exception thrown when Metadata could not be found. It's internal
+ * Exception thrown when Metadata could not be found. It's internal
* Message Handler
* exception.
- *
+ *
* @author Maciej Glowiak
*
*/

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/TOPSRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/TOPSRequest.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/TOPSRequest.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,17 +17,17 @@
*/
public abstract class TOPSRequest extends Request {

-
+
/**
* @throws PerfSONARException
*/
public TOPSRequest() throws PerfSONARException {
-
+
super();
setType("TOPSRequest");
-
+
}
-
+
/**
* Merge chained metadata elements
* @param metadatas map of metadata elements

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/GenericServiceLSRegistrator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/GenericServiceLSRegistrator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/GenericServiceLSRegistrator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -16,90 +16,90 @@
import
org.perfsonar.client.base.requests.lookupService.LSRegisterRequestGenerator;

/**
- * Generic Service LS Registrator.
- *
+ * Generic Service LS Registrator.
+ *
* @author Maciej Glowiak
*/
public class GenericServiceLSRegistrator implements ServiceLSRegistrator {
-
+
// ----------------------------------------------------- Constants
-
+
// -------------------------------------------- Instance variables
-
- protected LoggerComponent logger;
+
+ protected LoggerComponent logger;
protected ConfigurationComponent configuration;
protected ServiceDescription serviceDescription;
protected ServiceContent serviceContent;
private boolean ls;
-
-
-
+
+
+
// -------------------------------------------------- Constructors
-
+
public GenericServiceLSRegistrator() {}
-
+
public GenericServiceLSRegistrator(ServiceDescription sd, ServiceContent
sc) {
- serviceDescription = sd;
- serviceContent = sc;
+ serviceDescription = sd;
+ serviceContent = sc;
}
-
+
// ------------------------------------------------ Public methods
-
+
/**
* Initializes Registrator
*/
@Override
public void initRegistrator() throws PerfSONARException {
-
+
logger = (LoggerComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.LOGGER);
configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
- getComponent(ComponentNames.CONFIG);
-
+ getComponent(ComponentNames.CONFIG);
+
//get service.r.type - test if ls
try {
String typeStr = configuration.getProperty("service.r.type");
if ("ls".equalsIgnoreCase(typeStr))
ls=true;
-
+
} catch (Exception ex) {
ls=false;
- }
-
-
-
-
+ }
+
+
+
+
}
-
+
@Override
public Message register(String lsUrl) throws PerfSONARException {
if (lsUrl==null) {
throw new PerfSONARException(
- "error.lsregistrator.no_ls_url",
+ "error.lsregistrator.no_ls_url",
"GenericServiceLSRegistrator: Lookup Service URL is null"
);
}
if (lsUrl != null && lsUrl.isEmpty()) {
throw new PerfSONARException(
- "error.lsregistrator.no_ls_url",
+ "error.lsregistrator.no_ls_url",
"GenericServiceLSRegistrator: Lookup Service URL is empty"
);
}
-
- logger.info("GenericServiceLSRegistrator: register to ["+lsUrl+"]");

+
+ logger.info("GenericServiceLSRegistrator: register to ["+lsUrl+"]");
Message message = getLSRegisterRequestMessage();
logger.debug("GenericServiceLSRegistrator: sending via Axis");
//send request Document to url
try {
- logger.debug("GenericServiceLSRegistrator: Getting parser
configuration");
+ logger.debug("GenericServiceLSRegistrator: Getting parser
configuration");
//return response as Message
String parserFile =
configuration.getProperty("service.sax_parser.config");
File file = AuxiliaryComponentManager.lookupFile(parserFile);
if(file!=null) {
parserFile = file.getAbsolutePath();
- }
- logger.debug("GenericServiceLSRegistrator: Creating Axis Client
and sending request");
+ }
+ logger.debug("GenericServiceLSRegistrator: Creating Axis Client
and sending request");
AxisClient client = new AxisClient();
Message responseMsg = client.sendRequest(lsUrl,message,
parserFile);
return responseMsg;
@@ -115,43 +115,43 @@
}
}

-
+
@Override
public Message deregister(String lsUrl, String key) throws
PerfSONARException {
throw new PerfSONARException("error.common.action_not_implemented",
"Action not implemented");
}

-
+
@Override
public Message update(String lsUrl, String key) throws
PerfSONARException {
throw new PerfSONARException("error.common.action_not_implemented",
"Action not implemented");
}

-
+
@Override
public Message keepalive(String lsUrl, String key) throws
PerfSONARException {
throw new PerfSONARException("error.common.action_not_implemented",
"Action not implemented");
}
-
+
/**
- *
- * Obtains configuration parameters (service description) and
+ *
+ * Obtains configuration parameters (service description) and
* service content metadata (service content)
* returms LS Registration Request as NMWG Message
- *
+ *
* @return Message NMWG
*/
public Message getLSRegisterRequestMessage() throws PerfSONARException {
-
- if (serviceDescription==null) {
+
+ if (serviceDescription==null) {
throw new PerfSONARException(
"error.common.lsregistrator.no_service_description",
"No service description"
);
}
-
+
Map<String, String> commonParameters =
serviceDescription.getServiceDescription();
-
+
LSRegisterRequestGenerator lsRegisterGenerator = new
LSRegisterRequestGenerator();
lsRegisterGenerator.setCommonParameters(commonParameters);

@@ -174,28 +174,28 @@
}

Message message = lsRegisterGenerator.generateRequestMessage();
-
- return message;
+
+ return message;
}
-
- public ServiceContent getServiceContent() {
- return serviceContent;
+
+ public ServiceContent getServiceContent() {
+ return serviceContent;
}
-
- public void setServiceContent(ServiceContent serviceContent) {
+
+ public void setServiceContent(ServiceContent serviceContent) {
this.serviceContent = serviceContent;
}
-
+
public ServiceDescription getServiceDescription() {
-
+
return serviceDescription;
-
+
}
-
+
public void setServiceDescription(ServiceDescription serviceDescription)
{
-
+
this.serviceDescription = serviceDescription;
-
- }
-
+
+ }
+
} //GenericServiceLSRegistrator

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationContextServiceContent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationContextServiceContent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationContextServiceContent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,9 +7,9 @@
import org.perfsonar.base.exceptions.PerfSONARException;

/**
- *
{@link
ServiceContent} implementation that looks for a property in the
+ *
{@link
ServiceContent} implementation that looks for a property in the
* ServletContext.
- *
+ *
* @author Michael.Bischoff
*/
public class InformationContextServiceContent implements ServiceContent {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationExistDbXmlrpcServiceContent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationExistDbXmlrpcServiceContent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationExistDbXmlrpcServiceContent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -48,7 +48,7 @@
"component.ma.xmldb.db_username",
"component.ma.xmldb.db_password");

- XmlDbStorageManager storageManager =
+ XmlDbStorageManager storageManager =
ExistDbFactory.getXMLStorageManager(
ExistDbFactory.EXIST_XMLRPC, dataRepository);

@@ -61,7 +61,7 @@
throw new PerfSONARException(
"warning.ls.register",
"InformationExistDbXmlrpcServiceContent.fetch: "
- + "Fetch method of storage manager returned null");
+ + "Fetch method of storage manager returned null");

if (results.length == 0)
throw new PerfSONARException(

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationXMLFileServiceContent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationXMLFileServiceContent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationXMLFileServiceContent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -6,9 +6,9 @@

/**
* Get metadatas from XML Information File
- *
+ *
* @author Maciej Glowiak
- *
+ *
*/
public class InformationXMLFileServiceContent implements ServiceContent {

@@ -30,7 +30,7 @@

/**
* Get metadata blocks from RRD information file
- *
+ *
* @return array of Strings
*/
public String[] getServiceContent(String filename) throws
PerfSONARException {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSListAddresses.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSListAddresses.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSListAddresses.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,13 +11,13 @@

/**
* This class populates list of LS urls to register to
- *
+ *
* @author Maciej Glowiak
*
*/
public class LSListAddresses {

-
+
/**
* Populates urls collection with multiple urls from list separated by
comma sign , )
* @param urls
@@ -35,8 +35,8 @@
}
} catch (RuntimeException ex) { }
}
-
-
+
+
/**
* Populates urls collection with multiple remote resources (list in
multiUrlString separated by comma sign , )
* @param urls
@@ -56,7 +56,7 @@
}
} catch (RuntimeException rex) {}
}
-
+
/**
* Populates urls collection with urls/lines downloaded from urlString
* @param urls
@@ -65,7 +65,7 @@
* @throws IOException
*/
public void addFromURL(Collection<String> urls, String urlString) throws
MalformedURLException,IOException {
-
+
URL rootHintsUrl = new URL(urlString);
URLConnection rhc = rootHintsUrl.openConnection();
BufferedReader in = new BufferedReader(
@@ -84,6 +84,6 @@
in.close();

}
-
-
+
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -18,10 +18,10 @@

/**
* Action for simple Scheduler that registers with the LS
- *
+ *
* @author Maciej Glowiak (main author)
* @author romradz (contributor)
- *
+ *
*/
public class LSRegistrationComponent implements SchedulerAction,
AuxiliaryComponent {
@@ -33,19 +33,19 @@
private static final int MINIMAL_RUN_INTERVAL = 300000; //ms

/**
- * Posible values: <empty> "xmldb" "context" or "file"
+ * Posible values: <empty> "xmldb" "context" or "file"
* Where <empty> defaults to file and if the value of
- * service.ls.registration_file is empty or whitespace
- * don't use a
{@link
ServiceContent} this is for backward
+ * service.ls.registration_file is empty or whitespace
+ * don't use a
{@link
ServiceContent} this is for backward
* compatibility
*/
private static final String SERVICE_CONTENT_TYPE =
"service.ls.service_content_type";

private enum ContentType {
- EMPTY(null),
- FILE("file"),
- XMLDB("xmldb"),
- LSSUMMARY("lssummary"),
+ EMPTY(null),
+ FILE("file"),
+ XMLDB("xmldb"),
+ LSSUMMARY("lssummary"),
CONTEXT("context");

private String name;
@@ -107,7 +107,7 @@
throw new PerfSONARException("error.common.no_configuration",
"LSRegistrationComponent.initComponent: Cannot get
config component");
}
-
+
}


@@ -130,17 +130,17 @@
content = getXMLFileContent();
}
break;
-
+
case XMLDB: {
content = getXMLDBContent();
}
break;
-
+
case CONTEXT: {
content = getContextContent();
}
break;
-
+
case LSSUMMARY: {
content = getLSSummaryContent();
}
@@ -150,7 +150,7 @@

ServiceLSRegistrator registrator = new
GenericServiceLSRegistrator(
new PropertiesServiceDescription(), content);
-
+
//initialize Registration
registrator.initRegistrator();
responseMessages.clear(); //clear content of array list.
@@ -162,9 +162,9 @@
//if no LS to register with throw exception
if ((localLsUrls == null)&&(rootHints == null))
throw new
PerfSONARException("error.lsregistration.no_ls_url");
-
+
logger.debug("LSRegistrationComponent.runAction: register to
gLS-es");
-
+
//register to all explicit LSes from service.r.ls_url

LSListAddresses list = new LSListAddresses();
@@ -178,17 +178,17 @@
i++;
}
}
-
+
if (rootHints != null) {
//register to one of LSes from root.hints (
service.r.root_hints prop.)
ArrayList<String> remoteUrls = new ArrayList<String>();
list.addFromMultipleURLs(remoteUrls, rootHints);
for (String url : remoteUrls) {
logger.debug("LSRegistrationComponent send to gLS url
from roots.hints: [" + url + "]: ");
- if (registerToLS(registrator, url) == true)
+ if (registerToLS(registrator, url) == true)
break; //break after first success
}
- }
+ }
} catch (PerfSONARException e) {
logger.error("LSRegistrationComponent.runAction: Error while
registration: " + e.getMessage());
}
@@ -229,12 +229,12 @@
logger.error(errorMsg);
}
return false;
-
+
}

-


+
private ServiceContent getLSSummaryContent() {

return new LSSummaryServiceContent();
@@ -290,7 +290,7 @@

/**
* Inits compontnt
- * Takes interval in seconds from config file
+ * Takes interval in seconds from config file
*/
@Override
public void initComponent() throws PerfSONARException {
@@ -302,7 +302,7 @@
try {
//get interval in seconds
String intervalVal = configuration.getProperty("component."
- + componentName + ".interval");
+ + componentName + ".interval");
interval = Integer.parseInt(intervalVal) * 1000; //multiply to
have it in ms
} catch (RuntimeException e) {
// possibly not an integer - keep default interval
@@ -315,7 +315,7 @@

logger.debug("LSRegistrationComponent.initComponent: parameter
RUN_INTERVAL="
+ interval+" smaller than
MINIMAL="+LSRegistrationComponent.MINIMAL_RUN_INTERVAL);
-
+
interval = LSRegistrationComponent.MINIMAL_RUN_INTERVAL;
}


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSSummaryServiceContent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSSummaryServiceContent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSSummaryServiceContent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -33,45 +33,45 @@
private static final int DOMAIN = 200;
private static final int EVENT_TYPE = 300;
private static final int KEYWORD = 400;
-
- private static final String XMLNS_DEF =
+
+ private static final String XMLNS_DEF =
" xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"; "+
"
xmlns:nmtb=\"http://ogf.org/schema/network/topology/base/20070828/\"; " +
"
xmlns:nmtl3=\"http://ogf.org/schema/network/topology/l3/20070828/\"; " +
"
xmlns:summary=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/summarization/2.0/\";
";
-
+
private static final int XMLRPC = 0;
private static final int HTTP = 1;
-
+
private LoggerComponent logger;
private ConfigurationComponent config;

private String dbCollection = null;
private String dbUsername = null;
private String dbPassword = null;
-
+
//private ExistDbHttpXmlStorageManager storage = null;
//private ExistDbXmlrpcXmlStorageManager storage = null;
private ExistDbGenericStorageManager storage = null;
private int connectionType = HTTP; //XMLRPC or HTTP
-
-
+
+
// ----------------------------------------------------------------------
-
+
public LSSummaryServiceContent() {
-
+
try {
this.logger = (LoggerComponent) AuxiliaryComponentManager
.getInstance().getComponent(ComponentNames.LOGGER);
} catch (PerfSONARException e) { }
-
+
try {
this.config = (ConfigurationComponent) AuxiliaryComponentManager
.getInstance().getComponent(ComponentNames.CONFIG);
- } catch (PerfSONARException e) { }
-
+ } catch (PerfSONARException e) { }
+
}
-
+
/**
* Translate to HTTP uri if necessary
*/
@@ -94,38 +94,38 @@
uri = uri.replace("/exist/rest/", "/exist/xmlrpc/");
}
return uri;
- }
-
+ }
+
/**
* Initializes Database access (from configuration)
* @throws PerfSONARException
*/
private void init() {

- //wait 60 sec; to avoid first failed registration (when service is
+ //wait 60 sec; to avoid first failed registration (when service is
//starting)

long time = 60000;
- if (LSSummaryServiceContent.counter==0)
-
+ if (LSSummaryServiceContent.counter==0)
+
logger.debug("LSSummaryServiceContent: Wait ["+
(time/1000)+
"] seconds until other components are initialized...");
-
+
synchronized (this) {
try {
Thread.sleep(60000);
} catch (InterruptedException e) {
-
+
}
}

LSSummaryServiceContent.counter++;
-
+
// ----
-
+
try {
- //get data from configuration
+ //get data from configuration
switch (connectionType) {
case HTTP:
logger.debug("Connection type for
LSSUmmaryServiceContent is HTTP");
@@ -136,7 +136,7 @@
dbCollection =
getXMLRPCUri(config.getProperty("service.ls.db_uri"));
break;
}
-
+
dbUsername = config.getProperty("service.ls.db_username");
dbPassword = config.getProperty("service.ls.db_password");

@@ -144,11 +144,11 @@
throw new PerfSONARException();
logger.debug(
"LSSummaryServiceContent: database access details: "+
- "(url="+dbCollection+", username="+dbUsername+",
"+dbPassword+")");
+ "(url="+dbCollection+", username="+dbUsername+",
"+dbPassword+")");

switch (connectionType) {
case HTTP:
- ExistDbHttpXmlDataRepository httpDataRepository =
+ ExistDbHttpXmlDataRepository httpDataRepository =
new ExistDbHttpXmlDataRepository(dbCollection,
dbUsername, dbPassword);
//initialize storage manager
storage = new ExistDbHttpXmlStorageManager();
@@ -160,27 +160,27 @@
ExistDbXmlrpcXmlDataRepository xmlrpcDataRepository
= new ExistDbXmlrpcXmlDataRepository(
dbCollection, dbUsername, dbPassword);
- storage = (ExistDbGenericStorageManager)
+ storage = (ExistDbGenericStorageManager)
ExistDbFactory.getXMLStorageManager(
ExistDbFactory.EXIST_XMLRPC,
xmlrpcDataRepository);

storage.setResultType(XmlDbStorageManager.STRING_ARRAY_TYPE);
-
+
logger.debug("XML RPC initialized");

break;
}
-
+
logger.debug("LSSummaryServiceContent: storage initiated");
-
+
} catch (PerfSONARException e) {
logger.error("LSSummaryServiceContent: Wrong XML DB settings
(url="+
dbCollection+", username="+dbUsername+", "+dbPassword+
") or cannot instantiate StorageManager");
}
-
+
}
-
-
+
+
/**
* Method that is executed by Registration component, MAIN method of the
class
*/
@@ -189,65 +189,65 @@

//initialize
logger.debug("LSSummaryServiceConetent: init");
-
+
init();
-
+
//get all topology information (IPs)

logger.debug("LSSummaryServiceConetent: get services info from DB");

Map<String, ServiceSummary> summaries = getAllServicesSummaries();
-
+
//now having all data in "summaries" structure and need to summarize
// IPs, domains separately. EventTypes will remain the same.
-
+
//So, summarize information
logger.debug("LSSummaryServiceContent: Summarize...");
-
- //boolean doIPSummarization =
config.getProperty("service.ls.do_ip_summarization");
-
+
+ //boolean doIPSummarization =
config.getProperty("service.ls.do_ip_summarization");
+
//work on the same data - summarize and store in "summaries"
structure
for (ServiceSummary s :summaries.values()) {
-
+
//summarize IPs
logger.debug("Summarize domains");
s.ipAddresses = summarizeIPAddresses(s.ipAddresses);
-
+
//summarize domains
logger.debug("Summarize domains");
s.domains = summarizeDomains(s.domains);

//summarize eventTypes
- //no summarization, just store
-
+ //no summarization, just store
+
//summarize keywords
- //no summarization, just store
+ //no summarization, just store
}
-
+
//TODO: TEMPORARY:
showSummary(summaries);
-
+
String[] resultArray = new String[summaries.size()];

int i=0;
//for every single summary get XML
for (ServiceSummary s :summaries.values()) {
-
+
StringBuilder sb = new StringBuilder();
-
+
sb.append("<nmwg:metadata id=\"summmary.md.1\" ");
sb.append(XMLNS_DEF); //add namespace definition (important!)
sb.append(">\n");
sb.append(" <summary:subject id=\"summmary.md.1\">\n");

for (String ip : s.ipAddresses) {
-
+
//split results - ip/netmask or assume 32 as netmask if
wrong format
String[] ipvals = ip.split("/",2);
if(ipvals .length != 2) {
ipvals = new String[] {ip, "32"};
}
-
+
sb.append(" <nmtl3:network>\n");
sb.append(" <nmtl3:subnet>\n");
sb.append(" <nmtl3:address
type=\"ipv4\">").append(ipvals[0]).append("</nmtl3:address>\n");
@@ -255,23 +255,23 @@
sb.append(" </nmtl3:subnet>\n");
sb.append(" </nmtl3:network>\n");
}
-
+
for (String dom : s.domains) {
sb.append(" <nmtb:domain>\n");
sb.append(" <nmtb:name
type=\"dns\">").append(dom).append("</nmtb:name>\n");
sb.append(" </nmtb:domain>\n");
}
-
+
sb.append(" </summary:subject>\n");
-
+
//TODO: not supported multiple EventTypes!!!!!!!!!!1
//multiple eventTypes
// for (String evt : s.eventTypes) {
// sb.append("
<nmwg:eventType>"+evt+"</nmwg:eventType>\n");
// }
-
-
- //get sum of parameters to determine whether there is any
parameter
+
+
+ //get sum of parameters to determine whether there is any
parameter
//to be printed
int paramsSum = s.eventTypes.size() + s.keywords.size();
//if it is at least one, put it.
@@ -291,66 +291,66 @@

//convert StringBuffer to String
String res = sb.toString();
-
+
logger.debug("LSSummaryServicecontent: Summary data is:\n"+res);

//store in array
resultArray[i] = res;
i++;
}
-
+
return resultArray;
-
+
}
-
+
/**
* Get topology data and eventTypes from all services
* store it in Map<String, ServiceSummary>
* @return
*/
private Map<String, ServiceSummary> getAllServicesSummaries() throws
PerfSONARException {
-
+
Map<String, ServiceSummary> summaries = new HashMap<String,
ServiceSummary>();

String[] ipResults = queryIpResults();
String[] domainResults = queryDomainResults();
String[] eventTypeResults = queryEventTypeResults();
String[] keywordResults = queryKeywordResults();
-
+
logger.debug("LSSummaryServiceContent.getAllServicesSummaries: got
summary from database. Number of: " );
try { logger.debug(" - IP: ["+ipResults.length+"]"); } catch
(Exception ex) {}
try { logger.debug(" - domains:
["+domainResults.length+"]"); } catch (Exception ex) {}
try { logger.debug(" - eventvTypes:
["+eventTypeResults.length+"]"); } catch (Exception ex) {}
-
+
populateSummary(summaries, ipResults, IP);
populateSummary(summaries, domainResults, DOMAIN);
populateSummary(summaries, eventTypeResults, EVENT_TYPE);
populateSummary(summaries, keywordResults, KEYWORD);
-
- return summaries;
-
+
+ return summaries;
+
}
-

+
/**
* Get subdomains for domain. For example for input string
"www.man.poznan.pl"
- * and limit=3 it will return collection of "pl", "poznan.pl" and
"man.poznan.pl"
+ * and limit=3 it will return collection of "pl", "poznan.pl" and
"man.poznan.pl"
* @param domain input domain e.g. "www.man.poznan.pl"
- * @param limit number of subdomains to be returned. Value -1 means
"all"
+ * @param limit number of subdomains to be returned. Value -1 means "all"
* @param list collection where results are to be added
* @return updated Collection
*/
public Collection<String> getSubDomains(String domain, int limit,
Collection<String> list) {
-
+
if (domain==null) return null;
-
+
int last = domain.length();
-
+
for (int current=last-1; current>=0; current--) {
-
+
if (limit==0) break;
-
- if (domain.charAt(current) == '.') {
+
+ if (domain.charAt(current) == '.') {
String subdomain = domain.substring(current+1);
if (subdomain != null && !subdomain.isEmpty())
list.add(subdomain);
@@ -358,9 +358,9 @@
}
}
return list;
- }
+ }

-
+
/**
* Do IPs summarization. Returns new, summarized set of data
* Input data is not changed.
@@ -368,9 +368,9 @@
* @return
*/
private HashSet<String> summarizeIPAddresses(HashSet<String>
ipAddresses) {
-
+
HashSet<String> result;
-
+
try {
result = SummarizeIpAddrs.getSummary(ipAddresses);
} catch (Exception ex) {
@@ -379,10 +379,10 @@
result = ipAddresses;
}
return result;
-
- }
-
-
+
+ }
+
+
/**
* Do domains summarization. Returns new, summarized set of data
* Input data is not changed.
@@ -396,7 +396,7 @@
getSubDomains(s, 3, summarizedData);
}
return summarizedData;
-
+
}

/**
@@ -410,26 +410,26 @@

//split and store results
for (String line : lines) {
-
+
//split result
String[] params = line.split(",",2);
-
+
if(params.length != 2) {
logger.debug("LSSummaryServiceContent: suppressing line;
invalid format(value='"+line+"')");
break;
}
-
+
String key = params[0];
String content = params[1];
//System.out.println(" -- parse results: "+key+" : "+content);
-
+
//get or create summary for the service
ServiceSummary summary = summaries.get(key);
- if (summary==null) {
+ if (summary==null) {
summary = new ServiceSummary();
- summaries.put(key, summary);
+ summaries.put(key, summary);
}
-
+
//fill the right field
switch (type) {
case IP:
@@ -447,44 +447,44 @@
}

}
-
+
}

-
+
/**
* Perform XQuery with storage manager
* @param xq
* @return
*/
private String[] xquery(String xq) throws PerfSONARException{
-
+
try {
String[] s = (String[]) storage.fetch(xq);
return s;
} catch (Exception e) {
logger.error("LSSummaryServiceContent: Cannot perform xquery
["+xq+"]: "+e.getMessage()+"\n"+e.toString());
if (e instanceof PerfSONARException) throw (PerfSONARException)e;
- else
+ else
throw new
PerfSONARException("error.lsregistration.db_error", "Cannot perform xquery
["+xq+"] : "+e.getLocalizedMessage());
}
-
-
+
+
}
-
+
/**
* Return set of IP addresses used by services
* @return
*/
private String[] queryIpResults() throws PerfSONARException {

- String xq =
+ String xq =
" declare namespace nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; \n"+
" for $d in
/nmwg:store[@type='LSStore']/nmwg:data
\n"+
" let $metaIdRef := data($d/@metadataIdRef) \n"+
" for $val in $d/nmwg:metadata/*:subject//*:ifAddress/text() \n"+
" return if (empty($val)) then $val else concat($metaIdRef,',',$val)
\n";
return xquery(xq);
-
+
}

/**
@@ -493,15 +493,15 @@
*/
private String[] queryDomainResults() throws PerfSONARException {

- String xq =
+ String xq =
" declare namespace nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";;
\n"+
" for $d in
/nmwg:store[@type='LSStore']/nmwg:data
\n"+
" let $metaIdRef := data($d/@metadataIdRef) \n"+
" for $val in $d/nmwg:metadata/*:subject//*:hostName/text()
\n"+
" return if (empty($val)) then $val else
concat($metaIdRef,',',$val) \n";
-
+
return xquery(xq);
- }
+ }

/**
* Return set of eventTypes used by services
@@ -509,40 +509,40 @@
*/
private String[] queryEventTypeResults() throws PerfSONARException {

- String xq =
- " declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/';
\n"+
- " declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/';\n"+
+ String xq =
+ " declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/'; \n"+
+ " declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/';\n"+
" for $d in
/nmwg:store[@type='LSStore']/nmwg:data
\n"+
" let $metaIdRef := data($d/@metadataIdRef) \n"+
" for $e in $d/nmwg:metadata/nmwg:eventType \n"+
" let $val := $e/text() \n"+
- " return concat($metaIdRef,',',$val)\n";
+ " return concat($metaIdRef,',',$val)\n";
return xquery(xq);
- }
-
-
-
+ }
+
+
+
/**
* Return set of keywords
- * Takes either //nmwg:parameter/@value or //nmwg:parameter/text()
+ * Takes either //nmwg:parameter/@value or //nmwg:parameter/text()
* @return
*/
private String[] queryKeywordResults() throws PerfSONARException {

String xq =
- " declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/';
"+
- " declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; "+
- " for $d in
/nmwg:store[@type='LSStore']/nmwg:data
"+
- " for $p in
$d/nmwg:metadata/*:parameters/nmwg:parameter[@name='keyword']
"+
- " let $val1 := $p/text() "+
- " let $val2 :=$p/@value "+
- " let $metaIdRef := data($d/@metadataIdRef) "+
- " return "+
- " if (empty($val1)) then
concat($metaIdRef,',',data($val2)) "+
+ " declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/';
"+
+ " declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; "+
+ " for $d in
/nmwg:store[@type='LSStore']/nmwg:data
"+
+ " for $p in
$d/nmwg:metadata/*:parameters/nmwg:parameter[@name='keyword']
"+
+ " let $val1 := $p/text() "+
+ " let $val2 :=$p/@value "+
+ " let $metaIdRef := data($d/@metadataIdRef) "+
+ " return "+
+ " if (empty($val1)) then
concat($metaIdRef,',',data($val2)) "+
" else concat($metaIdRef,',', $val1)";
return xquery(xq);
- }
-
+ }
+
private void showSummary(Map<String, ServiceSummary> summaries) {
for (Entry<String, ServiceSummary> e : summaries.entrySet()) {
logger.debug("\n==== " + e.getKey() + " ====\n");
@@ -550,58 +550,58 @@

}
}
-
-
+
+
// ----------------------------------------------------------------------
-
+
/**
* Contains summary from a single service
* @author Maciej Glowiak
*
*/
class ServiceSummary {
-
+
public HashSet<String> eventTypes = new HashSet<String>();
public HashSet<String> domains = new HashSet<String>();
public HashSet<String> ipAddresses = new HashSet<String>();
public HashSet<String> keywords = new HashSet<String>();

public String toString() {
-
+
StringBuilder sb = new StringBuilder();
-
+
sb.append("1. eventTypes:\n");
- for (String s:eventTypes) {
+ for (String s:eventTypes) {
sb.append(" -- ");
sb.append(s);
sb.append("\n");
}
sb.append("2. domains:\n");
- for (String s:domains) {
+ for (String s:domains) {
sb.append(" -- ");
sb.append(s);
sb.append("\n");
}
sb.append("3. IPs:\n");
- for (String s:ipAddresses) {
+ for (String s:ipAddresses) {
sb.append(" -- ");
sb.append(s);
sb.append("\n");
}
sb.append("4. Keywords:\n");
- for (String s:keywords) {
+ for (String s:keywords) {
sb.append(" -- ");
sb.append(s);
sb.append("\n");
}
return sb.toString();
}
-
+
} //ServiceSummary
-
-
+
+
// public static void main(String[] s) {
//
// }
-
+
}//LSSummaryServiceContent

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/PropertiesServiceDescription.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/PropertiesServiceDescription.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/PropertiesServiceDescription.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,35 +17,35 @@
*/
public class PropertiesServiceDescription implements ServiceDescription {

-
+
// ----------------------------------------------------- Constnats
-
+
/**
* Prefix of all parameters that are used in the registration
*/
- private static final String DEFAULT_REGISTRATION_PREFIX =
- "service.r.";
-
+ private static final String DEFAULT_REGISTRATION_PREFIX =
+ "service.r.";
+
// -------------------------------------------- Instance variables
-
-
+
+
private String registrationPrefix = DEFAULT_REGISTRATION_PREFIX;
-
-
+
+
// ------------------------------------------------ Public methods
-
+
@Override
public Map<String,String> getServiceDescription() throws
PerfSONARException{

ConfigurationComponent configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
- getComponent(ComponentNames.CONFIG);
-
+ getComponent(ComponentNames.CONFIG);
+
Enumeration<?> paramNames =
configuration.getProperties().propertyNames();
Map<String,String> serviceDesc = new HashMap<String,String>();
-
+
while (paramNames.hasMoreElements()) {
-
+
String paramName = (String)paramNames.nextElement();

if (paramName.startsWith(registrationPrefix)) {
@@ -53,7 +53,7 @@
registrationPrefix.length()),
configuration.getProperty(paramName));
}
-
+
}
return serviceDesc;

@@ -61,17 +61,17 @@


public String getRegistrationPrefix() {
-
+
return registrationPrefix;
-
+
}


public void setRegistrationPrefix(String registrationPrefix) {
-
+
this.registrationPrefix = registrationPrefix;
-
+
}

-
+
} //PropertiesServiceDescription

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceContent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceContent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceContent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -5,5 +5,5 @@
public interface ServiceContent {

String[] getServiceContent() throws PerfSONARException;
-
+
} //ServiceContent

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceDescription.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceDescription.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceDescription.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,5 +7,5 @@
public interface ServiceDescription {

Map <String,String> getServiceDescription() throws PerfSONARException;
-
+
} //ServiceDescription

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceLSRegistrator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceLSRegistrator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceLSRegistrator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,27 +7,27 @@

/**
* Service LS Registrator
- *
+ *
* @author Maciej Glowiak
*/
public interface ServiceLSRegistrator {

public abstract void initRegistrator() throws PerfSONARException;
-
-
- public abstract Message register(String lsUrl)
+
+
+ public abstract Message register(String lsUrl)
throws PerfSONARException;

-
- public abstract Message deregister(String lsUrl, String key)
+
+ public abstract Message deregister(String lsUrl, String key)
throws PerfSONARException;


- public abstract Message update(String lsUrl, String key)
+ public abstract Message update(String lsUrl, String key)
throws PerfSONARException;
-
-
- public abstract Message keepalive(String lsUrl, String key)
+
+
+ public abstract Message keepalive(String lsUrl, String key)
throws PerfSONARException;



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/GenericXmlStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/GenericXmlStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/GenericXmlStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -9,7 +9,7 @@


/**
- * This interface declares methods to have
+ * This interface declares methods to have
* an access to a data storage.
*
* @author Roman Lapacz

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/NMWGStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/NMWGStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/NMWGStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,7 +11,7 @@


/**
- * This interface declares methods to have
+ * This interface declares methods to have
* an access to a data storage.
*
* @author Roman Lapacz
@@ -23,21 +23,21 @@
/**
* Inits an object of this class with data repository object.
*/
- public void initStorage(Key dataRepository)
+ public void initStorage(Key dataRepository)
throws PerfSONARException;


/**
* Fetches data from a data repository.
*/
- public Message fetch(Message dataQuery)
+ public Message fetch(Message dataQuery)
throws PerfSONARException;


/**
* Stores data in a data repository.
*/
- public Message store(Message dataSet)
+ public Message store(Message dataSet)
throws PerfSONARException;



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/StorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/StorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/StorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -9,7 +9,7 @@


/**
- * This interface declares methods to have
+ * This interface declares methods to have
* an access to a data storage.
*
* @author Roman Lapacz
@@ -17,25 +17,25 @@
*/
public interface StorageManager {

-
+
/**
* Inits an object of this class with data repository object.
*/
- public void initStorage(DataRepository dataRepository)
+ public void initStorage(DataRepository dataRepository)
throws PerfSONARException;


/**
* Fetches data from a data repository.
*/
- public Object fetch(Object dataQuery)
+ public Object fetch(Object dataQuery)
throws PerfSONARException;


/**
* Stores data in a data repository.
*/
- public Object store(Object dataSet)
+ public Object store(Object dataSet)
throws PerfSONARException;



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbConstants.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbConstants.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbConstants.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -6,7 +6,7 @@
* Return results as XmlDbResult
*/
public static final int RETURN_XML_DB_RESULT = 0x0100;
-
+
/**
* Return results as XmlDbResult
*/
@@ -15,7 +15,7 @@
/**
* Return results as String
*/
- public static final int RETURN_STRING = 0x0400;
+ public static final int RETURN_STRING = 0x0400;


} //XmlDbConstants

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbDataRepository.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbDataRepository.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbDataRepository.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -21,34 +21,34 @@
* Database username
*/
protected String dbUsername;
-
-
+
+
/**
* Database password
*/
protected String dbPassword;
-
-
+
+
/**
* Database URI
*/
protected String dbUri;

-
+
/**
* The object to log control/debugging messages
*/
protected LoggerComponent logger = null;
-
-
+
+
protected int resultTypeFlag = RETURN_STRING_ARRAY; //by default
-
-
+
+
// ----------------------------------- Constructor --------------------
-
-
+
+
protected XmlDbDataRepository() {
-
+
try {
logger = (LoggerComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.LOGGER);
@@ -56,50 +56,50 @@
}

logger.debug("XmlDbDataRepository: created");
-
+
}


public String getDbPassword() {
-
+
return dbPassword;
-
+
}


public void setDbPassword(String dbPassword) {
-
+
this.dbPassword = dbPassword;
-
+
}


public String getDbUri() {
-
+
return dbUri;
-
+
}


public void setDbUri(String dbUri) {
-
+
this.dbUri = dbUri;
-
+
}


public String getDbUsername() {
-
+
return dbUsername;
-
+
}


public void setDbUsername(String dbUsername) {
-
+
this.dbUsername = dbUsername;
-
+
}
-
-
+
+
} //XmlDbDataRepository

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbResult.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbResult.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbResult.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -6,68 +6,68 @@
* Result from XML database. The class contain
* counter of total hits, first element returned (start) and
* number of returned elements (count)
- *
+ *
* @author Maciej Glowiak
- *
+ *
*/
public class XmlDbResult {

// ----------------------------------------------------- Constants
-
+
// -------------------------------------------- Instance variables
-
- private String[] results;
+
+ private String[] results;
private int total = 0; //total results
private int start = 0; //number of first result returned
private int count = 0; //number of total results returned
-
+
// --------------------------------------------------- Constructor
-
-
+
+
public XmlDbResult(
String[] results, int total, int start, int count) {
-
+
this.results = results;
this.total = total;
this.start = start;
- this.count = count;
+ this.count = count;
}

-
+
public XmlDbResult(
String result, int total, int start, int count) {
-
+
String[] s = {result};
this.results = s;
this.total = total;
this.start = start;
this.count = count;
-
- }
-
+
+ }
+
// ------------------------------------------------ Public methods
-

-
+
+
public String getResultAsString() {
-
+
if (results.length==1) return results[0];
else {
StringWriter sw = new StringWriter();
for (String result : results) sw.append(result);
return sw.toString();
- }
+ }
}

-
+
public String[] getResultAsStringArray() {
-
+
return results;
-
+
}
-
-

+
+
@Override
public String toString() {
String s = getResultAsString();
@@ -93,8 +93,8 @@
public int getTotal() {
return total;
}
-
-
-
-
+
+
+
+
} //XmlDbResult

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,16 +7,16 @@
* @author Maciej Glowiak
*/
public interface XmlDbStorageManager extends StorageManager {
-
+
public final static String STRING_ARRAY_TYPE = "String[]";
-
+
public final static String XML_DB_RESULT_TYPE = "XmlDbResult";
-
+
/**
* set result type of query
- *
+ *
* @param type
*/
public void setResultType(String type);
-
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,115 +11,115 @@
import
org.perfsonar.service.base.storage.xmldb.exist.xmlrpc.ExistDbXmlrpcXmlDataRepository;

public class ExistDbFactory {
-
+
// ----------------------------------------------------- Constants
-
+
public static final String EXIST_XMLRPC = "XMLRPC";
-
+
public static final String EXIST_HTTP = "HTTP";
-
+
// ------------------------------------------------ Static methods
-
-
+
+
public static XmlDbDataRepository getDataRepositoryByProperties(
- String type,
- String uriPropName,
- String usernamePropName,
+ String type,
+ String uriPropName,
+ String usernamePropName,
String passwordPropName) throws PerfSONARException {
-
+
LoggerComponent logger = getLogger();
ConfigurationComponent configuration = getConfig();
-
+
String uri = configuration.getProperty(uriPropName);
String username = configuration.getProperty(usernamePropName);
String password = configuration.getProperty(passwordPropName);

XmlDbDataRepository dataRepository;
-
+
if (type.equalsIgnoreCase(EXIST_XMLRPC)) {

logger.debug("ExistDbFactory: Creating XML RPC Data Repository:
("
+ uri + ", " + username + ", " + password + ")");
- dataRepository =
- new ExistDbXmlrpcXmlDataRepository( uri, username, password
);
+ dataRepository =
+ new ExistDbXmlrpcXmlDataRepository( uri, username, password
);
return dataRepository;
-
+
} else if (type.equalsIgnoreCase(EXIST_HTTP)) {
-
+
logger.debug("ExistDbFactory: Creating HTTP/REST Data
Repository: ("
+ uri + ", " + username + ", " + password + ")");
- dataRepository =
- new ExistDbHttpXmlDataRepository( uri, username, password );

+ dataRepository =
+ new ExistDbHttpXmlDataRepository( uri, username, password );
return dataRepository;
-
+
} else {

//default - HTTP
logger.debug("ExistDbFactory: Creating default HTTP/REST Data
Repository: ("
+ uri + ", " + username + ", " + password + ")");
- dataRepository =
- new ExistDbHttpXmlDataRepository( uri, username, password );

+ dataRepository =
+ new ExistDbHttpXmlDataRepository( uri, username, password );
return dataRepository;
-
+
}
-
- }
-
-
-
+
+ }
+
+
+
public static XmlDbStorageManager getXMLStorageManager(
- String type,
- XmlDbDataRepository dataRepository )
+ String type,
+ XmlDbDataRepository dataRepository )
throws PerfSONARException {
-
+
XmlDbStorageManager sm;
LoggerComponent logger = getLogger();
-
+
if (type.equalsIgnoreCase(EXIST_XMLRPC)) {
-
+
logger.debug("ExistDbFactory: Creating XML RPC Storage Manager");
sm = new
org.perfsonar.service.base.storage.xmldb.exist.xmlrpc.ExistDbXmlrpcXmlStorageManager();
-
+
} else if (type.equalsIgnoreCase(EXIST_HTTP)) {
-
+
logger.debug("ExistDbFactory: Creating HTTP/REST Storage
Manager");
sm = new
org.perfsonar.service.base.storage.xmldb.exist.rest.ExistDbHttpXmlStorageManager();
-
+
} else {
-
+
logger.error("ExistDbFactory: Cannot initialize ["+
type+"] type Storage Manager for accessing XML" +
" Lookup Service Database. Taking defaults");
sm = ExistDbFactory.getXMLStorageManager(
EXIST_HTTP, dataRepository);
-
+
}
-
+
sm.initStorage(dataRepository);
-
+
return sm;
-
+
}
-
-
+
+
// ---------------------------------------- private static methods
-
- private static LoggerComponent getLogger()
+
+ private static LoggerComponent getLogger()
throws PerfSONARException {
-
+
return (LoggerComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.LOGGER);
-
+
}
-
-
- private static ConfigurationComponent getConfig()
+
+
+ private static ConfigurationComponent getConfig()
throws PerfSONARException {
-
+
return (ConfigurationComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.CONFIG);
-
+
}
-
-
+
+
} //ExistDbFactory

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbGenericStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbGenericStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbGenericStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.perfsonar.service.base.storage.xmldb.exist;

@@ -15,88 +15,88 @@
* @author Maciej Glowiak
*
*/
-public abstract class ExistDbGenericStorageManager
+public abstract class ExistDbGenericStorageManager
implements XmlDbStorageManager, AuxiliaryComponent {

// -------------------------------------------- Instance variables
-
+
/**
* Component Name
*/
private String componentName = null;

-
+
/**
* The object to log control/debugging messages
*/
- private LoggerComponent logger = null;
-
+ private LoggerComponent logger = null;

+
/**
* Result type
*/
private int resultFlag = XmlDbConstants.RETURN_STRING_ARRAY;

-
+
// --------------------------------------------------- Constructor
-
-
+
+
// ------------------------------------------------ Public methods
-
+
@Override
public String getComponentName() {
-
+
return componentName;
-
+
}


@Override
public void setComponentName(String componentName) {
-
+
this.componentName = componentName;
-
+
}
-

+
@Override
public void setResultType(String type) {
-
+
if (STRING_ARRAY_TYPE.equals(type)) {
-
+
resultFlag = XmlDbConstants.RETURN_STRING_ARRAY;
-
+
} else if (XML_DB_RESULT_TYPE.equals(type)) {
-
+
resultFlag = XmlDbConstants.RETURN_XML_DB_RESULT;
-
+
} else {
-
+
//default
resultFlag = XmlDbConstants.RETURN_STRING_ARRAY;
-
+
}
}
-
-
+
+
protected int getResultType() {
-
+
return resultFlag;
-
+
}
-
+
protected LoggerComponent getLogger() throws PerfSONARException {
-
+
if (logger==null) {
//get logger
logger = (LoggerComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.LOGGER);
}
-
+
return logger;
}


-
-
+
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbErrorException.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbErrorException.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbErrorException.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -1,77 +1,77 @@
package org.perfsonar.service.base.storage.xmldb.exist.rest;

/**
- * Represents Exist XML DB error or response message (e.g.Unauthorized...)
- *
+ * Represents Exist XML DB error or response message (e.g.Unauthorized...)
+ *
* @author Maciej Glowiak
- *
+ *
* $id$
*/
public class ExistDbErrorException extends Exception {

-
+
// ----------------------------------------------------- Constants
-
-
+
+
private static final long serialVersionUID = 2780526000258753818L;

-
- // -------------------------------------------- Instance variables
-
-
+
+ // -------------------------------------------- Instance variables
+
+
/**
* HTTP code of error returned by exist DB
*/
private int httpCode = -1;
-
+
/**
* HTTP message of error returned by exist DB
*/
private String httpMessage = null;
-
-
+
+
// --------------------------------------------------- Constructor
-
-
+
+
public ExistDbErrorException(int code, String description) {
-
+
super("eXist DB responsed with HTTP error code code ["+
code+"] additional message was ["+description+"]");
httpCode = code;
httpMessage = description;
-
+
}

-
+
// ------------------------------------------------ Public methods
-
-
+
+
public int getHttpCode() {
-
+
return httpCode;
-
+
}

-
+
public void setHttpCode(int httpCode) {
-
+
this.httpCode = httpCode;
-
+
}


public String getHttpMessage() {
-
+
return httpMessage;
-
+
}


public void setHttpMessage(String httpMessage) {
-
+
this.httpMessage = httpMessage;
-
+
}

-
+
} //ExistDbErrorException

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -13,9 +13,9 @@
/**
* HTTP Access to eXist DB XML (exist-db.org)
* Supports HTTP authorization, results parsing
- *
+ *
* @author Maciej Glowiak
- *
+ *
* $Id$
*
*/
@@ -23,40 +23,40 @@


// ---------------------------------------------Instance variables
-
+
private boolean debug = false;
-
-
+
+
// -------------------------------------------------- other
-
+
/**
* Start from first element
*/
public static final int FIRST = 1;
-
-
+
+
/**
* Return all results
*/
public static final int ALL_RESULTS = 0;
-
-
+
+
// ------------------------------------------------ public methods
-
-
+
+
public int sendExistXUpdateRequest(
String url,
- String updateString,
- String username,
+ String updateString,
+ String username,
String password) throws IOException, ExistDbErrorException {
-
+
HTTPResult result = sendPOSTRequest(url, updateString,username,
password);
return result.getResultCode();
-
+
}
-
+
/**
- *
+ *
* @param url
* @param content
* @param username
@@ -67,13 +67,13 @@
* @throws IOException
*/
public HTTPResult sendXQueryPOSTRequest(
- String url,
- String content,
- String username,
+ String url,
+ String content,
+ String username,
String password,
- int start,
+ int start,
int limit) throws IOException {
-
+
//prepare XQuery
content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
"<query xmlns=\"http://exist.sourceforge.net/NS/exist\"; "+
@@ -89,87 +89,87 @@
" <property name=\"encoding\" value=\"UTF-8\"/>" +
//temp
" </properties>" +
"</query>";
-
+
return sendPOSTRequest(url, content, username, password);
-
- }
-
-
+
+ }
+
+
public XmlDbResult sendExistXQueryRequest(
String url,
- String query,
- String username,
- String password,
- int start,
+ String query,
+ String username,
+ String password,
+ int start,
int limit) throws IOException, ExistDbErrorException {
-
+
/* ******************************************************** */
-
+
//send HTTP request and encapsulate query
HTTPResult httpResult = sendXQueryPOSTRequest(
url, query, username, password, start, limit);
-
+
/* ******************************************************** */
-
+
int resultCode = httpResult.getResultCode();
if (resultCode == 200) { //HTTP OK
-
+
//parse XML result returned by eXist DB XML
XmlDbResult xmlResult = parseExistXMLReponse(
httpResult.getResponse());
-
+
return xmlResult;
-
+
} else {
throw new ExistDbErrorException(
resultCode, httpResult.getResultMessage());
}
-
+
}
-
-

+
+
private XmlDbResult parseExistXMLReponse(
InputStream inputStream) throws IOException {
-
+
int hits=-1, first=-1, count=-1;
String result;
String[] resultArray = null;
-
+
boolean allowRemoveExistValue = true;
-
- //read response
-
+
+ //read response
+
BufferedReader rd = new BufferedReader(
new InputStreamReader(inputStream));
-
+
//<exist:result...> parsed?
boolean exResult = false;
-
+
//read each line
StringBuilder response = new StringBuilder();
ArrayList<String> responseList = new ArrayList<String>();
-
+
String str;
while ((str = rd.readLine()) != null) {
-
+
if (debug) {
System.out.println("[->] read line: ["+str+"]");
}
-
+
boolean doParseLine = true;
-
+
if (!exResult) {
-
+
if (str.startsWith("<exist:result")) {
-
+
if (debug) System.out.println(
"[HEAD] ["+str+"]");
doParseLine = false;
exResult=true;
-
+
//if full results, parse hits/count/total as well
-
+
try {
hits=Integer.parseInt(
XMLUtils.extractXMLAttributeValue(
@@ -185,46 +185,46 @@
XMLUtils.extractXMLAttributeValue(
str,"exist:start"));
} catch (RuntimeException e) {}
-
+
if (debug) System.out.println(
"[RESV] hits="+hits);
if (debug) System.out.println(
"[RESV] start="+first);
if (debug) System.out.println(
"[RESV] count="+count);
-
- //Case if exist:result in one line

+
+ //Case if exist:result in one line
//if <exist:result>anything</exist:result>
String content = XMLUtils.extractXMLTag(
str,"exist:result");
-
+
if (content!=null) {
//take only content
str=content;
doParseLine=true; //this time parse line, because
- //it may contain more data to be parsed
+ //it may contain more data to be parsed
if (debug) System.out.println("[D] Results in one
line, parsing content ["+str+"]...");
}
-
+
} //<exist:result>
-
+
} else {
-
+
if (str.startsWith("</exist:result")) {
if (debug) System.out.println(
"[FOOT] ["+str+"]");
doParseLine = false;
}
-
+
} //</exist:result>
-

-
+
+
//parse (if inside <exist:result></exist:result>
if (doParseLine) {
-
+
if (allowRemoveExistValue) {
-
+
//remove <exist:value...
String content =
XMLUtils.extractXMLTag(str,"exist:value");
if (content!=null) {
@@ -234,83 +234,83 @@
responseList.add(str);
if (debug) System.out.println("[D] Removed
<exist:value>");
}
-
- }
-
+
+ }
+
/*
* ----------------------------------------------
* at this stage, str contains string line
* ----------------------------------------------
*/
-
+
//add parsed line to response String Buffer
response.append(str);
-
+
//add Line Feed sign at the end of each line
response.append("\n");
-
+
if (debug) System.out.println("[LINE] ["+str+"]");
-
+
} //parse
-
+
} //read lines
-
+
//convert results to String
result = response.toString();
-
+
//convert result list (if only exist:value) to String[]
if (!responseList.isEmpty())
resultArray = responseList.
- toArray(new String[responseList.size()]);
-
+ toArray(new String[responseList.size()]);
+
if (resultArray!=null)
return new XmlDbResult(resultArray, hits, first, count);
//return XmlDbResult
else
return new XmlDbResult(result, hits, first, count); //return
XmlDbResult
-
+
}

-
+
public boolean isDebug() {
-
+
return debug;
-
+
}


public void setDebug(boolean debug) {
-
+
this.debug = debug;
-
+
}


-
+
// --------------------------------------------------- test method
-
+
/**
* Test method
*/
public static void main(String[] args) throws Exception {
-
-// String query =
+
+// String query =
// "declare namespace " +
// "nmwg='http://ggf.org/ns/nmwg/base/2.0/'; " +
// "/nmwg:store/nmwg:metadata";

-// String query =
+// String query =
// "declare namespace " +
// "nmwg='http://ggf.org/ns/nmwg/base/2.0/'; " +
// "data(/nmwg:store/nmwg:metadata/@id)";
-
+
// String query = "declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";; "+
//
"/nmwg:store[@type='LSStore-control']/nmwg:metadata[@id='entry-1']/nmwg:parameters"+
//
"/nmwg:parameter[@name='timestamp']/text()";
-
+
// String query = "/";
-
+
// String query = "<xu:modifications version='1.0'
xmlns:xu='http://www.xmldb.org/xupdate'
xmlns:perfsonar='http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/'
xmlns:nmwg='http://ggf.org/ns/nmwg/base/2.0/'
xmlns:psservice='http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/'
xmlns:nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'
xmlns:netutil='http://ggf.org/ns/nmwg/characteristic/utilization/2.0/'>" +
-// "<xu:append
select=\"/nmwg:store[@type='LSStore']\"
child=\"last()\">" +
+// "<xu:append
select=\"/nmwg:store[@type='LSStore']\"
child=\"last()\">" +
// "<nmwg:data" +
// "
id=\"http://reed.man.poznan.pl:8080/axis/services/MA/1153214921123/0\""; +
// "
metadataIdRef=\"http://reed.man.poznan.pl:8080/axis/services/MA\";
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";>" +
@@ -330,39 +330,39 @@
// "</nmwg:data>" +
// "</xu:append>" +
// "</xu:modifications>";
-
+
// String query = "<xu:modifications version='1.0'
xmlns:xu='http://www.xmldb.org/xupdate'
xmlns:nmwg='http://ggf.org/ns/nmwg/base/2.0/'>" +
// "<xu:append
select=\"/nmwg:store[@type='LSStore']\"
child=\"last()\">" +
// " <xxxxxxxxxxxxxxxxx/>" +
// "</xu:append>" +
// "</xu:modifications>";
-
+
long t0 = System.currentTimeMillis(); //----------------time 0
-
+
String query = "data(/test/a/@id)";
ExistDbHTTPAccess a = new ExistDbHTTPAccess();
a.setDebug(true);
XmlDbResult result = a.sendExistXQueryRequest(
"http://localhost:8680/exist/rest/db/test";,
- query,
- "lookupservice",
- "sonar",
- FIRST,
- ALL_RESULTS);
+ query,
+ "lookupservice",
+ "sonar",
+ FIRST,
+ ALL_RESULTS);
a.disconnectHTTPServer();
-
+
long t1 = System.currentTimeMillis(); //----------------time 1
-
+
for (int i=0; i<result.getResultAsStringArray().length; i++) {
String x = result.getResultAsStringArray()[i];
System.out.println("RESULT["+i+"]:
"+((x.length()<1000)?x:"..."+x.substring(1000)+"..."));
}
-
+
System.out.println("TIME: "+(t1-t0)+"ms");
-
-
-

+
+
+
}
-
+
} //ExistDbHTTPAccess

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlDataRepository.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlDataRepository.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlDataRepository.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -4,28 +4,28 @@
import org.perfsonar.service.base.storage.xmldb.XmlDbDataRepository;

public class ExistDbHttpXmlDataRepository extends XmlDbDataRepository {
-
+
@Override
public void setType(String type) {}
-
+
@Override
public String getType() {
return "http://exist-db.org/rest";;
-
+
}

-
+
public ExistDbHttpXmlDataRepository(String uri, String username, String
password) {
-
+
super();
-
+
setDbPassword(password);
setDbUsername(username);
setDbUri(uri);
-
- }
-
-
+
+ }
+
+
@Override
public void open() throws PerfSONARException {}


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -15,20 +15,20 @@
/**
* This class is StorageManager for Exist DB XML
* (http://exist-db.org/)
- *
+ *
* It provides fetch (XPath/XQuery expression as an input) and
* store (XUpdate XML expression as an input).
- *
+ *
* Results of fetch/store are
* String - if type is set to STRING_TYPE //not implemented
* String[] - if type is set to STRING_ARRAY_TYPE
* XmlDbResult if type is set to XML_DB_RESULT_TYPE
- *
+ *
* @author Roman Lapacz
* @author Maciej Glowiak
*
*/
-public class ExistDbHttpXmlStorageManager
+public class ExistDbHttpXmlStorageManager
extends ExistDbGenericStorageManager
implements XmlDbStorageManager, AuxiliaryComponent {

@@ -40,8 +40,8 @@
* Data repository object
*/
protected XmlDbDataRepository dataRepository = null;
-
-
+
+
protected ExistDbHTTPAccess httpAccess = null;

// -------------------------------------- constructors
@@ -51,14 +51,14 @@
public ExistDbHttpXmlStorageManager() {

httpAccess = new ExistDbHTTPAccess();
-
+
}



- // -------------------------------------- public methods
-
-
+ // -------------------------------------- public methods
+
+
/**
* Set data repository for this Storage Manager.
* Important note: DataRepository MUST be XmlDbDataRepository. Otherwise,
@@ -84,26 +84,26 @@

}

-
+
@Override
public void initComponent() throws PerfSONARException {

dataRepository = ExistDbFactory.getDataRepositoryByProperties(
ExistDbFactory.EXIST_HTTP,
- "component." + getComponentName() + ".db_uri",
- "component."+getComponentName() + ".db_username",
+ "component." + getComponentName() + ".db_uri",
+ "component."+getComponentName() + ".db_username",
"component."+getComponentName() + ".db_password"
);

//Init Storage Manager with DataRepository
initStorage(dataRepository);
-
- }

-
+ }
+
+
/**
* Fetch data. dataQuery input parameter MUST be a String
- *
+ *
* @param dataQuery Must be String that contain XPath/XQuery expression
* @return depends on getResultType()
*/
@@ -114,11 +114,11 @@
return xqueryHttp(dataQuery);

}
-
-
+
+
/**
* Store data. dataSet input parameter MUST be String
- *
+ *
* @param dataSet Must be String, contains XUpdate string
* @return depends on getResultType()
*/
@@ -127,19 +127,19 @@
throws PerfSONARException {

return xupdateHttp(dataSet);
-
+
}

// -------------------------------------- protected methods



- protected Object xqueryHttp(Object query)
+ protected Object xqueryHttp(Object query)
throws PerfSONARException {
-
+
getLogger().debug("ExistDbHttpXmlStorageManager: XQuery");
XmlDbResult results;
-
+
try {
results = httpAccess.sendExistXQueryRequest(
dataRepository.getDbUri(),
@@ -148,55 +148,55 @@
dataRepository.getDbPassword(),
ExistDbHTTPAccess.FIRST,
ExistDbHTTPAccess.ALL_RESULTS);
-
+
} catch (Exception ex) {
throw new PerfSONARException(
"error.common.storage.xmldb.open",
"XQuery by HTTP failed. "
+ "Could not connect to eXist via pure http, "
- + " nested exception was: "+
+ + " nested exception was: "+
ex.getClass()+" : "+ex.getMessage());
}

- if (getResultType()==XmlDbConstants.RETURN_STRING_ARRAY)
+ if (getResultType()==XmlDbConstants.RETURN_STRING_ARRAY)
return results.getResultAsStringArray();
-
+
else return results;

}

-
-
- protected Object xupdateHttp(Object xml)
+
+
+ protected Object xupdateHttp(Object xml)
throws PerfSONARException {

getLogger().debug("ExistDbHttpXmlStorageManager: XUpdate");
int results;
-
+
try {
results = httpAccess.sendExistXUpdateRequest(
dataRepository.getDbUri(),
(String)xml,
dataRepository.getDbUsername(),
dataRepository.getDbPassword());
-
+
} catch (Exception ex) {
throw new PerfSONARException(
"error.common.storage.xmldb.open",
"XUpdate by HTTP failed. "
+ "Could not connect to eXist via pure http, "
- + " nested exception was: "+
+ + " nested exception was: "+
ex.getClass()+" : "+ex.getMessage());
}
-
- return results; // String, String[] or XmlDbResult
+
+ return results; // String, String[] or XmlDbResult
// - depends on getResultType()
}
-
+
// ---------------------------------------------
-
-
-
-
-
+
+
+
+
+
} //ExistDbXmlStorageManager

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPAccess.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPAccess.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPAccess.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -7,26 +7,26 @@
import java.net.URL;

/**
- * This class implements basic HTTP methods of eXist DB XML
+ * This class implements basic HTTP methods of eXist DB XML
* document manipulating. Most of them may be used in communication
* to other HTTP databases or servers
- *
+ *
* @author Maciej Glowiak
*
*/
public class HTTPAccess {

// --------------------------------------------- Private variables
-
-
+
+
protected HttpURLConnection httpUrlConnection;
-
-
+
+
// -------------------------------------------------- Constructors
-
+
// ------------------------------------------------ Public methods
-
-
+
+
/**
* POST - Sends text content to the server
* @param url
@@ -37,45 +37,45 @@
* @throws IOException
*/
public HTTPResult sendPOSTRequest(
- String url,
- String content,
- String username,
+ String url,
+ String content,
+ String username,
String password) throws IOException {
-
+
return sendHTTPRequest(
- url,
- "POST",
- "application/x- www-form-urlencoded",
+ url,
+ "POST",
+ "application/x- www-form-urlencoded",
content,
true, true,
username, password);
-
+
}
-
-
+
+
/**
* DELETE - removes remote resource from the server
* @param url
* @param username
* @param password
* @return
- * @throws IOException
+ * @throws IOException
*/
public HTTPResult sendDELETERequest(
- String url,
+ String url,
String username,
String password) throws IOException {
-
+
return sendHTTPRequest(
- url,
- "DELETE",
+ url,
+ "DELETE",
null, null,
false, true, //no input, output=result
username, password);
-
+
}
-
-
+
+
/**
* PUT - sends resource to the server
* @param url
@@ -83,50 +83,50 @@
* @param username
* @param password
* @return
- * @throws IOException
+ * @throws IOException
*/
public HTTPResult sendPUTRequest(
- String url,
+ String url,
String content,
String username,
String password) throws IOException {
-
+
return sendHTTPRequest(
- url,
- "PUT",
+ url,
+ "PUT",
null, content,
true, true,
username, password);
-
+
}
-
-
+
+
/**
* GET - downloads remote document from the server
* @param url
* @param username
* @param password
* @return
- * @throws IOException
+ * @throws IOException
*/
public HTTPResult sendGETRequest(
- String url,
+ String url,
String username,
String password) throws IOException {
-
+
return sendHTTPRequest(
- url,
- "GET",
+ url,
+ "GET",
null, null,
false, true,
username, password);
-
+
}
-
-
+
+
/**
* Generic operation on the HTTP server
- *
+ *
* @param url
* @param method
* @param contentType
@@ -139,97 +139,97 @@
* @throws IOException
*/
protected HTTPResult sendHTTPRequest(
- String url,
+ String url,
String method,
String contentType,
- String content,
- boolean isRequest,
+ String content,
+ boolean isRequest,
boolean isResponse,
String username,
String password) throws IOException {
-
+
//temp//
boolean debug=false;
-
+
//connect by HTTP with /exist/rest/db/COLLECTION
URL _url = new URL(url);
-
+
//create HTTP URL Connection
httpUrlConnection = (HttpURLConnection) _url.openConnection();
-
+
//set HTTP method
httpUrlConnection.setRequestMethod(method);
-
+
//set content type
if (contentType != null)
httpUrlConnection.setRequestProperty("Content-Type",
contentType);
-
- httpUrlConnection.setDoOutput(isRequest);
+
+ httpUrlConnection.setDoOutput(isRequest);
httpUrlConnection.setDoInput(isResponse);
-
+
//set content length
if (content!=null)
httpUrlConnection.setRequestProperty(
- "Content-Length",
+ "Content-Length",
String.valueOf(content.length()));
-
- //HTTP Authorization, set "Authorization: Basic " if necessary
+
+ //HTTP Authorization, set "Authorization: Basic " if necessary
if (username!=null) {
-
+
if (password==null) password=""; //if null make it empty String
-
+
if (!(username != null && username.isEmpty())) {
if (debug) System.out.println("[D] authorization Basic "+
username+":"+password);

String basicAuth = "Basic " +
(new sun.misc.BASE64Encoder().
- encode((username+":"+password).getBytes()));

-
+ encode((username+":"+password).getBytes()));
+
httpUrlConnection.setRequestProperty(
"Authorization", basicAuth);
-
+
}
}
-
-
+
+
//send via HTTP
if (isRequest) {
OutputStream out = httpUrlConnection.getOutputStream();
out.write(content.getBytes());
out.flush();
}
-
+
//HTTP response available now
int responseCode = httpUrlConnection.getResponseCode();
String responseMessage = httpUrlConnection.getResponseMessage();
-
+
if (debug) System.out.println("[D] Response code: "+ responseCode+"
("+responseMessage+")");
-
+
InputStream response = null;
if (isResponse) {
response = httpUrlConnection.getInputStream();
}
-
- return new HTTPResult(response, responseCode, responseMessage);
-
+
+ return new HTTPResult(response, responseCode, responseMessage);
+
}
-
-
+
+
public void disconnectHTTPServer() {
-
+
httpUrlConnection.disconnect();
-
+
}
-
+
// --------------------------------------------------------------
-
+
// public static void main(String[] args) throws IOException {
-//
+//
// String content="<test>\n<c id=\"1\"/>\n</test>";
//
// long t0,t1;
-//
+//
// //PUT
// t0=System.currentTimeMillis();
// HTTPAccess.sendPUTRequest(
@@ -238,10 +238,10 @@
// );
// t1=System.currentTimeMillis();
// System.out.println(" time: "+(t1-t0)+"ms");
-//
-
+//
+
// //DELETE
-//
+//
// t0=System.currentTimeMillis();
// HTTPAccess.sendDELETERequest(
// "http://localhost:8680/exist/rest/db/test/c.txt";,
@@ -249,14 +249,14 @@
// );
// t1=System.currentTimeMillis();
// System.out.println(" time: "+(t1-t0)+"ms");
-
-
+
+
// //GET
// t0=System.currentTimeMillis();
// HTTPResult result = HTTPAccess.sendGETRequest(
// "http://localhost:8680/exist/rest/db/test/c.txt";,
// null, null
-// );
+// );
// t1=System.currentTimeMillis();
// System.out.println(" time: "+(t1-t0)+"ms");
// BufferedReader rd = new BufferedReader(
@@ -264,7 +264,7 @@
// String str;
// while ((str = rd.readLine()) != null) {
// System.out.println(" -- ["+str+"]");
-//
+//
// }

// //POST
@@ -272,7 +272,7 @@
// HTTPResult result = HTTPAccess.sendXQueryPOSTRequest(
// "http://localhost:8680/exist/rest/db/test";,
// "/test/a", null, null, 1, 0
-// );
+// );
// t1=System.currentTimeMillis();
// System.out.println(" time: "+(t1-t0)+"ms");
// BufferedReader rd = new BufferedReader(
@@ -280,11 +280,11 @@
// String str;
// while ((str = rd.readLine()) != null) {
// System.out.println(" -- ["+str+"]");
-//
+//
// }
-//
-//
-//
+//
+//
+//
// }
-
+
} //HTTPAccess

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPResult.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPResult.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPResult.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -4,7 +4,7 @@

/**
* Represents HTTP results
- *
+ *
* @author Maciej Glowiak
*
*/
@@ -13,17 +13,17 @@
private InputStream response;
private int resultCode;
private String resultMessage;
-
+
public HTTPResult(
- InputStream response,
- int resultCode,
+ InputStream response,
+ int resultCode,
String resultMessage) {
-
+
this.response = response;
this.resultCode = resultCode;
this.resultMessage = resultMessage;
}
-
+
public InputStream getResponse() {
return response;
}
@@ -33,5 +33,5 @@
public String getResultMessage() {
return resultMessage;
}
-
+
} //HTTPResult
\ No newline at end of file

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlDataRepository.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlDataRepository.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlDataRepository.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,7 +11,7 @@
* Data Repository implementation for Exist DB XML (http://exist-db.org/)
* Uses "org.exist.xmldb.DatabaseImpl" driver, In order to use this class,
you'll need
* Exist JARs.
- *
+ *
* @author Maciej Glowiak
*
*/
@@ -25,21 +25,21 @@
/**
* Default driver class for Exist XML DB.
*/
- private static final String DB_TYPE = "http://exist-db.org/xmlrpc";;
-
+ private static final String DB_TYPE = "http://exist-db.org/xmlrpc";;
+
/**
- * Database driver classname, default for Exist DB XML
+ * Database driver classname, default for Exist DB XML
* is "org.exist.xmldb.DatabaseImpl"
*/
- private String dbDriverClassname = EXIST_DB_DRIVER;
+ private String dbDriverClassname = EXIST_DB_DRIVER;

-
+
/**
* XML Database (exist DB XML object)
*/
private Database existDatabase;
-
-
+
+
/**
* Collection (exist DB XML object)
*/
@@ -48,87 +48,87 @@

//
-----------------------------------------------------------------------
Constructor

-
+
public ExistDbXmlrpcXmlDataRepository(String driverClassname, String
uri, String username, String password) {
-
+
this();
setDbDriverClassname(driverClassname);
setDbPassword(password);
setDbUsername(username);
setDbUri(uri);
-
+
}
-
-
+
+
public ExistDbXmlrpcXmlDataRepository(String uri, String username,
String password) {
-
+
this();
setDbPassword(password);
setDbUsername(username);
setDbUri(uri);
-
+
}
-
-
+
+
public ExistDbXmlrpcXmlDataRepository() {
- // nothing to do here, all parameters are default
+ // nothing to do here, all parameters are default
}
-
-
+
+
// --------------------------------------------------------------------
Public methods-
-
-
+
+
/**
- * Get database driver classname, default for Exist DB XML
+ * Get database driver classname, default for Exist DB XML
* is "org.exist.xmldb.DatabaseImpl"
- */
+ */
public String getDbDriverClassname() {
-
+
return dbDriverClassname;
-
+
}

/**
- * Set database driver classname, default for Exist DB XML
+ * Set database driver classname, default for Exist DB XML
* is "org.exist.xmldb.DatabaseImpl"
*/
public void setDbDriverClassname(String dbDriverClassname) {
-
+
this.dbDriverClassname = dbDriverClassname;
-
+
}

-
+
/**
* Get XML Collection (exist DB XML object). Null if not connected
- */
+ */
public Collection getExistCollection() {
-
+
return existCollection;
-
+
}

-
+
/**
* Get XML Database (exist DB XML object). Null if not connected
*/
public Database getExistDatabase() {
-
+
return existDatabase;
-
+
}


// ------------------------------------- Methods implementing
DataRepository interface
-

+
@Override
public String getType() {
-
+
return DB_TYPE;
-
+
}
-
+
@Override
public void setType(String type) {
// ??
@@ -136,23 +136,23 @@
// ??
}

-
+
@Override
public void open() throws PerfSONARException {
-
+
logger.debug("ExistDbXmlrpcXmlDataRepository: connect");

if (existDatabase==null) {

try {
-
+
Class<?> cl = Class.forName(dbDriverClassname);
existDatabase = (Database)cl.newInstance();
DatabaseManager.registerDatabase(existDatabase);
-
+
existCollection = DatabaseManager.getCollection(
dbUri, dbUsername, dbPassword);
-
+
} catch (ClassNotFoundException e) {
throw new
PerfSONARException("error.common.storage.xmldb.open",
"ExistDbXmlrpcXmlDataRepository: Can't find eXist DB
XML driver "
@@ -165,7 +165,7 @@
} catch (IllegalAccessException e) {
throw new
PerfSONARException("error.common.storage.xmldb.open",
"ExistDbXmlrpcXmlDataRepository: " +
- "IllegalAccessException, "+e.getMessage());

+ "IllegalAccessException, "+e.getMessage());
} catch (XMLDBException e) {
throw new
PerfSONARException("error.common.storage.xmldb.open",
"ExistDbXmlrpcXmlDataRepository: XML DB Exception
"+e.getMessage());
@@ -176,45 +176,45 @@
", driver="+dbDriverClassname+", params: "+dbUri+" :
"+
dbUsername+" : "+dbPassword+"] "+e.getMessage());
}
-
+
} else {
-
+
logger.error("ExistDbXmlrpcXmlDataRepository: error connecting
database - " +
"database connection has been already opened; close it
first!");
-
+
}
-
-
+
+
}


@Override
public void close() throws PerfSONARException {
-
+
if (existDatabase!=null) {
-
+
try {
-
- logger.debug("ExistDbXmlrpcXmlDataRepository: close
connection");
+
+ logger.debug("ExistDbXmlrpcXmlDataRepository: close
connection");
DatabaseManager.deregisterDatabase(existDatabase);
existDatabase=null;
existCollection=null;
-
+
} catch (XMLDBException e) {
throw new
PerfSONARException("error.common.storage.xmldb.close",
"ExistDbXmlrpcXmlDataRepository: Can't deregister
database, "
+e.getMessage());
- }
-
+ }
+
} else {

logger.error("ExistDbXmlrpcXmlDataRepository: can't close
connection; " +
- "database is not connected");
+ "database is not connected");
}
-
+
}

-
-
-
+
+
+
} //ExistDbXmlrpcXmlDataRepository

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -22,50 +22,50 @@
/**
* This class is StorageManager for Exist DB XML
* (http://exist-db.org/)
- *
+ *
* It provides fetch (XPath/XQuery expression as an input) and
* store (XUpdate XML expression as an input).
- *
+ *
* @author Maciej Glowiak
*
*/
-public class ExistDbXmlrpcXmlStorageManager
+public class ExistDbXmlrpcXmlStorageManager
extends ExistDbGenericStorageManager
implements XmlDbStorageManager, AuxiliaryComponent {

-
-
+
+
/**
* Data repository object
*/
private ExistDbXmlrpcXmlDataRepository dataRepository = null;
-
-
+
+
/**
- * if false, the connection to DB will be established before each
query/update and dropped
+ * if false, the connection to DB will be established before each
query/update and dropped
* after this action. If true, the connection will be kept open all the
time
*/
private boolean keepConnection = true;
-
-
+
+
/**
* Indicates if connection to DB is established
*/
private boolean isConnected = false;
-
-
+
+
//
-----------------------------------------------------------------------
Constructor
-
-
+
+
public ExistDbXmlrpcXmlStorageManager() {
-
+
isConnected = false;
-
+
}
-
- // ---------------------------------------------------------------------
Public methods
-
-
+
+ // ---------------------------------------------------------------------
Public methods
+
+
/**
* Set data repository for this Storage Manager.
* Important note: DataRepository MUST be
ExistDbXmlrpcXmlDataRepository. Otherwise,
@@ -73,47 +73,47 @@
*/
@Override
public void initStorage(DataRepository dataRepository) throws
PerfSONARException {
-
+
getLogger().debug("ExistDbXmlrpcXmlStorageManager: initStorage with
data repository");
-
+
try {
-
+
this.dataRepository =
(ExistDbXmlrpcXmlDataRepository)dataRepository;
-
+
} catch (ClassCastException ex) {
-
+
getLogger().error("ExistDbXmlrpcXmlStorageManager: wrong data
repository class ("+
dataRepository.getClass().getName()+
")! Data repository must implement
ExistDbXmlrpcXmlDataRepository class");
-
+
}
-
+
}

-
+
@Override
public void initComponent() throws PerfSONARException {
-
+
getLogger().debug("ExistDbXmlrpcXmlStorageManager: initComponent");
-
+
//read properties
getLogger().debug("ExistDbXmlrpcXmlStorageManager: read properties
from configuration component");
-
- DataRepository dataRepository =
+
+ DataRepository dataRepository =
ExistDbFactory.getDataRepositoryByProperties(
- ExistDbFactory.EXIST_XMLRPC,
+ ExistDbFactory.EXIST_XMLRPC,
"component."+getComponentName()+".db_uri",
"component."+getComponentName()+".db_username",
"component."+getComponentName()+".db_password"
);
-
-
+
+
//Init Storage Manager with DataRepository
initStorage(dataRepository);

- }
+ }

-
+
/**
* Fetch data. dataQuery input parameter MUST be a String
* @param dataQuery Must be String that contain XPath/XQuery expression
@@ -123,7 +123,7 @@
public Object fetch(Object dataQuery) throws PerfSONARException {

getLogger().debug("ExistXMLDatabaseAccess: perform XQuery");
-
+
String xqueryExpression;
try {
xqueryExpression = (String)dataQuery;
@@ -132,7 +132,7 @@
"ExistDbXmlrpcXmlStorageManager: This method accepts " +
"StringData data format only");
}
-
+
if (xqueryExpression==null) {
throw new
PerfSONARException("error.common.storage.xmldb.empty_query",
"ExistDbXmlrpcXmlStorageManager: Input DataQuery " +
@@ -143,38 +143,38 @@


connect();
-
+
XPathQueryService service =
(XPathQueryService)
dataRepository.getExistCollection().getService(
"XPathQueryService", "1.0");
//service.setProperty("indent", "yes");

if (service==null) getLogger().debug("StorageManager: warning -
service is null");
-
+
ResourceSet result = service.query(xqueryExpression);

if (result==null) getLogger().debug("StorageManager: warning -
result is null");
-
+
ResourceIterator resIt = result.getIterator();
List<Object> list = new Vector<Object>();
-
+
int i=0;
while(resIt.hasMoreResources()) {
Resource r = resIt.nextResource();
list.add(i,r.getContent());
i++;
}
-
+
String[] xml = new String[list.size()];
-
+
for (i=0; i < list.size(); i++) {
xml[i] = (String)list.get(i);
}
-
+
disconnect();

//determine return type
-
+
if (getResultType() == XmlDbConstants.RETURN_STRING_ARRAY)
return xml;
else if (getResultType() == XmlDbConstants.RETURN_XML_DB_RESULT)
{
@@ -183,8 +183,8 @@
//default
return xml;
}
-
- } catch (XMLDBException e) {
+
+ } catch (XMLDBException e) {
throw new PerfSONARException("error.common.storage.xmldb.query",
"Can't perform XQuery: "+e.getMessage());
} catch (Exception ex) {
@@ -192,10 +192,10 @@
"There is a problem to use xml database; " +
ex.getMessage() + " errorType="+ex.getClass().getName());

}
-
+
}
-
-
+
+
/**
* Store data. dataSet input parameter MUST be String
* Yoo may use
org.perfsonar.service.commons.storage.xmldb.StringDataQuery
@@ -205,107 +205,107 @@
@Override
public Object store(Object dataSet) throws PerfSONARException {

-
- getLogger().debug("ExistDbXmlrpcXmlStorageManager: perform
XUpdate");
-
+
+ getLogger().debug("ExistDbXmlrpcXmlStorageManager: perform XUpdate");
+
String xupdateExpression;
try {
-
+
xupdateExpression = (String)dataSet;
-
+
} catch (ClassCastException ex) {
throw new
PerfSONARException("error.common.storage.xmldb.wrong_query",
"ExistDbXmlrpcXmlStorageManager: This method accepts " +
"StringData data format only");
}
-
+
if (xupdateExpression==null) {
throw new
PerfSONARException("error.common.storage.xmldb.empty_query",
"ExistDbXmlrpcXmlStorageManager: Input DataQuery " +
"contains no data");
}
try {
-
+
connect();
-
- XUpdateQueryService service =
+
+ XUpdateQueryService service =

(XUpdateQueryService)dataRepository.getExistCollection().getService(
"XUpdateQueryService", "1.0");
service.setCollection(dataRepository.getExistCollection());

service.update(xupdateExpression);
-
+
disconnect();
-
- } catch (XMLDBException e) {
+
+ } catch (XMLDBException e) {
throw new PerfSONARException("error.common.storage.xmldb.query",
"ExistDbXmlrpcXmlStorageManager: Can't perform XUpdate:
"+e.getMessage());
- }
-
+ }
+
return null;
}

/**
* Check if keepConnection flag is set.
- * @return true if the connection is persistent (common for all DB
requests),
- * false if connection is established for each DB request and
then
- * it's dropped
+ * @return true if the connection is persistent (common for all DB
requests),
+ * false if connection is established for each DB request and
then
+ * it's dropped
*/
public boolean isKeepConnection() {
-
+
return keepConnection;
-
+
}


/**
* Set keepConnection flag.
- * @param keepConnection - true if the connection is persistent (common
for all DB requests),
- * false if connection is established for each
DB request and then
+ * @param keepConnection - true if the connection is persistent (common
for all DB requests),
+ * false if connection is established for each
DB request and then
* it's dropped
- *
+ *
*/
public void setKeepConnection(boolean keepConnection) {
-
+
this.keepConnection = keepConnection;
-
+
}

-
+
// -------------------------------------------------------------------
Private methods
-
+
/**
* Connect if required
*/
private void connect() throws PerfSONARException {

if (!isConnected) {
-
+
dataRepository.open();
isConnected = true;
-
+
}
-
+
}
-
+
/**
* Disconnect if required
* @throws PerfSONARException
*/
private void disconnect() throws PerfSONARException {
-
+
if ((isConnected) && (!keepConnection)) {

dataRepository.close();
isConnected = false;
-
+
}
}

-
+
//
-------------------------------------------------------------------------
test case

-
+
/*
* Run query test (XPath/XQuery)
*/
@@ -313,56 +313,56 @@

String[] result = (String[])storageManager.fetch(
xquery);
-
+
for (int i=0; i<result.length; i++) {
System.out.println("Result["+i+"]: "+result[i]);
}
-
- }
-
-
-
+
+ }
+
+
+
// ---------------------------------------------------------- test
-
-
+
+
/*
* Simple test case. Just for testing
*/
public static void main(String[] argv) throws Exception {

//create Data Repository for Exist DB
-
+
ExistDbXmlrpcXmlDataRepository dataRepository = new
ExistDbXmlrpcXmlDataRepository(
"xmldb:exist://localhost:8680/exist/xmlrpc/db/ls",
"lookupservice",
"sonar");
-
-
+
+
/*
// or set all parameters manually
dataRepository.setDbPassword("sonar");
dataRepository.setDbUsername("lookupservice");

dataRepository.setDbUri("xmldb:exist://localhost:8680/exist/xmlrpc/db/ls");
- */
-
+ */
+
//create and init Storage Manager
ExistDbXmlrpcXmlStorageManager storageManager = new
ExistDbXmlrpcXmlStorageManager();
-
-
+
+
//keepConnection=true means that the connection will be persistent
storageManager.setKeepConnection(true);
-
+
storageManager.initStorage(dataRepository);

//run test cases
testQuery(storageManager,"//nmwgt:hostName");
testQuery(storageManager,"//nmwgt:ifName");
testQuery(storageManager,"//nmwgt:ipAddress");
-
+
}
-
-
+
+
// -------------------------------------------------------------------
end of test case
-
-
+
+
} //ExistDbXmlrpcXmlStorageManager

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileDataRepository.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileDataRepository.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileDataRepository.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -4,16 +4,16 @@
import org.perfsonar.service.base.storage.DataRepository;

public class XmlFileDataRepository implements DataRepository {
-
+
private static final String XML_FILE_TYPE = "xml.file";

-
+
private String path = null;
-
+
public XmlFileDataRepository(String path) {
this.path = path;
}
-
+
@Override
public void setType(String type) {
}
@@ -31,7 +31,7 @@
public void close() throws PerfSONARException {
}

-
+
public String getPath() {
return path;
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -28,35 +28,35 @@

public class XmlFileStorageManager implements StorageManager {

-
- // ----------------------------------------------------- Instance
variables
-
-
+
+ // ----------------------------------------------------- Instance
variables
+
+
private XmlFileDataRepository dataRepository;
-
-
+
+
// --------------------------------------------------------- Public
methods
-
-
+
+
/**
* Accepts XmlFileDataRepository
*/
@Override
public void initStorage(DataRepository dataRepository)
throws PerfSONARException {
-
+
try {
this.dataRepository = (XmlFileDataRepository)dataRepository;
} catch (RuntimeException ex) {
throw new
PerfSONARException("error.common.storage.xml_file.init",
"XmlFileStorageManager: not XmlFileDataRepository!");
}
-
+
}

-
+
/**
- * Returns
+ * Returns
* @param XPath expression as String
* @return String[] XML results
*/
@@ -74,27 +74,27 @@
"XmlFileStorageManager: not a String parameter!"
);
}
-
+
//System.out.println(" == xpath="+dataQuery);
dataRepository.open();
Vector<String> results = new Vector<String>();
-
+
try {

// Set up a DOM tree to query.
InputSource in = new InputSource(new
FileInputStream(dataRepository.getPath()));
DocumentBuilderFactory dfactory =
DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true);
- Document doc = dfactory.newDocumentBuilder().parse(in);
-
+ Document doc = dfactory.newDocumentBuilder().parse(in);
+
// Set up an identity transformer to use as serializer.
Transformer serializer =
TransformerFactory.newInstance().newTransformer();
serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
"yes");
-
+
// Create an XPath evaluator and pass in the document.
XPathEvaluator evaluator = new XPathEvaluatorImpl(doc);
XPathNSResolver resolver = evaluator.createNSResolver(doc);
-
+
// Evaluate the xpath expression
XPathResult result = (XPathResult) evaluator.evaluate(
xpathQuery,
@@ -103,8 +103,8 @@
XPathResult.UNORDERED_NODE_ITERATOR_TYPE,
null
);
-
-
+
+
// Serialize the found nodes, store result in results as vector
// of Strings
Node n;
@@ -112,56 +112,56 @@
StringBuffer outputBuffer = new StringBuffer();
OutputStream outputStream = new
StringBufferOutputStream(outputBuffer);
//XX if (isTextNode(n)) {
-//XX // DOM may have more than one node corresponding to a
+//XX // DOM may have more than one node corresponding to a
//XX // single XPath text node. Coalesce all contiguous text
nodes
//XX // at this level
//XX
//XX StringBuffer sb = new StringBuffer(n.getNodeValue());
//XX System.out.print(sb);
-//XX
+//XX
//XX } else {

- try {
+ try {
serializer.transform(
- new DOMSource(n),
+ new DOMSource(n),
new StreamResult(new
OutputStreamWriter(outputStream))
);
- results.add(outputBuffer.toString());

+ results.add(outputBuffer.toString());
} catch (TransformerException e) {
e.printStackTrace();
}
}
-
+
//XX }
} catch (Exception ex) {
throw new PerfSONARException(
"error.common.storage.xml_file.fetch",
ex.getMessage());
}
-
+
String[] stringResults = new String[results.size()];
results.toArray(stringResults);
-
+
dataRepository.close();
-
+
return stringResults;
}
-
-
-
+
+
+
/**
* UNIMPLEMENTED
*/
@Override
public Object store(Object dataSet) throws PerfSONARException {
-
+
throw new PerfSONARException("not implemented");
-
+
}
-
-

-
+
+
+
// /**
// * Decide if the node is text, and so must be handled specially
// */
@@ -174,19 +174,19 @@
//
// return nodeType == Node.CDATA_SECTION_NODE || nodeType ==
Node.TEXT_NODE;
//
-// }
-
-
+// }
+
+
// ----------------------------------------------- MAIN
------------------
-
+
/*
* TEMPORARY
*/
public static void main(String[] a) {
-
+
System.out.println("STARTED");
XmlFileDataRepository dr = new XmlFileDataRepository(
-// "/projects/sonar/perfsonar/conf/rrd-database_ESnet.xml");

+// "/projects/sonar/perfsonar/conf/rrd-database_ESnet.xml");
// "/projects/sonar/perfsonar/conf/rrd-infoFile-GEANT.xml");
"/projects/sonar/perfsonar/conf/rrd-database_Abilene.xml");
System.out.println("Create StorageManager ");
@@ -202,8 +202,8 @@
} catch (Exception ex) {
ex.printStackTrace();
}
-
+
}
-

+
} //XmlFileStorageManager

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransport.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransport.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransport.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -27,7 +27,7 @@
*/
public void copy(String file, Location src, Location dst)
throws Exception;
-
+
/**
* Delete file at specified location.
*
@@ -37,7 +37,7 @@
*/
public void delete(String file, Location loc)
throws Exception;
-
+
/**
* Check if file exists at specified remote location.
*

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransportFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransportFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransportFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -13,29 +13,29 @@
*
*/
public class FileTransportFactory {
-
-
+
+
// ---------------------------------- constants
-
-
+
+
/**
* Array of all known implementations of FileTransport interface.
*/
private static final Class<?>[] FILE_TRANSPORT_IMPLS = {
-
+
SSHFileTransport.class
-
+
};
-
+
/**
* Constants for known implementations of FileTransport interface.
*/
public static final String SSH_FILE_TRANSPORT_IMPL = "ssh";
-
-
+
+
// ---------------------------------- public methods
-
-
+
+
/**
* Return new object for requested FileTransport implementation.
*
@@ -47,23 +47,23 @@
* or implementation constructor throws Exception
*/
public static FileTransport getFileTransport(String impl) throws
Exception {
-
+
for (Class<?> c: FILE_TRANSPORT_IMPLS) {
-
+
String name = c.getName();
int n = name.lastIndexOf('.');
if (n != -1) {
name = name.substring(n + 1);
- }
+ }
if (name.equalsIgnoreCase(impl + "FileTransport")) {
return (FileTransport)c.newInstance();
}
}
-
+
throw new Exception(
"No implementation of FileTransport found for '"
+ impl + "'");
}
-
-
+
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/Location.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/Location.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/Location.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -16,10 +16,10 @@


// ---------------------------------- class fields
-
-
+
+
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;

@@ -29,48 +29,48 @@
* (optional, if null, local location is assumed).
*/
private String address = null;
-
-
+
+
/**
* Path (to file)
*/
private String path = null;
-
-
+
+
/**
* Port (optional port number, null if not used)
*/
private Integer port = null;
-
+
/**
* Username (optional username used for accessing remote address,
* null if not used)
*/
private String username = null;
-
-
+
+
// ---------------------------------- constructors
-
-
+
+
/**
* Empty constructor.
*/
public Location() {
}
-
-
+
+
/**
* Constructor with required properties only.
*
* @param path
*/
public Location(String path) {
-
+
this.path = path;
-
+
}
-
-
+
+
// ---------------------------------- public methods


@@ -80,92 +80,92 @@
* @param address
*/
public void setAddress(String address) {
-
+
this.address = address;
-
+
}
-
-
+
+
/**
* Getter for address property.
*
* @return address
*/
public String getAddress() {
-
+
return this.address;
-
+
}
-
-
+
+
/**
* Setter for path property.
*
* @param path
*/
public void setPath(String path) {
-
+
this.path = path;
-
+
}
-
-
+
+
/**
* Getter for path property.
*
* @return path
*/
public String getPath() {
-
+
return this.path;
-
+
}
-
-
+
+
/**
* Setter for port property.
*
* @param port
*/
public void setPort(Integer port) {
-
+
this.port = port;
-
+
}
-
-
+
+
/**
* Getter for port property.
*
* @return port
*/
public Integer getPort() {
-
+
return this.port;
-
+
}
-
-
+
+
/**
* Setter for username property.
*
* @param username
*/
public void setUsername(String username) {
-
+
this.username = username;
-
+
}
-
-
+
+
/**
* Getter for username property.
*
* @return username
*/
public String getUsername() {
-
+
return username;
-
+
}
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/SSHFileTransport.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/SSHFileTransport.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/SSHFileTransport.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -22,25 +22,25 @@


// ---------------------------------- constants
-
-
+
+
/**
* Standard LiNUX location of ssh executable.
*/
private static final String SSH_EXEC = "/usr/bin/ssh";
-
-
+
+
/**
* Standard LiNUX location of cat executable.
*/
private static final String CAT_EXEC = "/bin/cat";
-
-
+
+
/**
* Standard LiNUX location of rm executable.
*/
private static final String RM_EXEC = "/bin/rm";
-
+
/**
* Standard LiNUX location of ls executable.
*/
@@ -63,8 +63,8 @@
throws Exception {

byte[] buf = new byte[8192];
-
- // Simple verifications
+
+ // Simple verifications
// * file must not be null
// * src and dst must not be null
// * One of source address or destination address must
@@ -83,11 +83,11 @@
dst.getPath() == null)
throw new Exception("src or dst path is null");

-
+
// Source file is local
// We will be feeding the ssh app
if (src.getAddress() == null) {
-
+
String localFilePath =
src.getPath()
+ System.getProperty("file.separator")
@@ -100,10 +100,10 @@
(dst.getUsername() == null ? "" :
(dst.getUsername() + "@"))
+ dst.getAddress();
-
+
// Open local file for reading
FileInputStream fin = new FileInputStream(localFilePath);
-
+
// Execute ssh command
ArrayList<String> cmdArgs = new ArrayList<String>();
cmdArgs.add(SSH_EXEC);
@@ -117,29 +117,29 @@
Process ssh =
Runtime.getRuntime().exec(
cmdArgs.toArray(new String[cmdArgs.size()]));
-
+
// Feed local file to SSH process
OutputStream sshOut = ssh.getOutputStream();
int n = fin.read(buf);
while (n > 0) {
-
+
sshOut.write(buf, 0, n);
-
+
n = fin.read(buf);
-
+
}
-
+
ssh.getInputStream().close();
ssh.getOutputStream().close();
ssh.getErrorStream().close();
-
+
ssh.waitFor();
-
+
if (ssh.exitValue() != 0)
throw new Exception(
"Error copying local file, exit code "
+ ssh.exitValue());
-
+
// Destination file is local
} else if (dst.getAddress() == null) {

@@ -155,10 +155,10 @@
dst.getPath()
+ System.getProperty("file.separator")
+ file;
-
+
// Open local file for writing
FileOutputStream fout = new FileOutputStream(localFilePath);
-
+
// Execute ssh command
ArrayList<String> cmdArgs = new ArrayList<String>();
cmdArgs.add(SSH_EXEC);
@@ -172,40 +172,40 @@
Process ssh =
Runtime.getRuntime().exec(
cmdArgs.toArray(new String[cmdArgs.size()]));
-
+
// Write file retrived from SSH process to local file
InputStream sshIn = ssh.getInputStream();
int n = sshIn.read(buf);
while (n > 0) {
-
+
fout.write(buf, 0, n);
-
+
n = sshIn.read(buf);
-
+
}
-
+
fout.close();
-
+
ssh.getInputStream().close();
ssh.getOutputStream().close();
ssh.getErrorStream().close();
-
+
ssh.waitFor();
-
+
if (ssh.exitValue() != 0) {
// Try to remove localFilePath, because
// it is probably garbeled
new File(localFilePath).delete();
-
+
throw new Exception(
"Error copying remote file, exit code "
+ ssh.exitValue());
}
-
+
}
-
+
}
-
+
/**
* Delete file at specified location.
*
@@ -216,7 +216,7 @@
@Override
public void delete(String file, Location loc)
throws Exception {
-
+
// Simple verifications
// * file must not be null
// * loc must not be null
@@ -228,8 +228,8 @@
throw new Exception("loc address is null");
if (loc.getPath() == null)
throw new Exception("loc path is null");
-
-
+
+
String remoteFilePath =
loc.getPath()
+ System.getProperty("file.separator")
@@ -238,7 +238,7 @@
(loc.getUsername() == null ? "" :
(loc.getUsername() + "@"))
+ loc.getAddress();
-
+
ArrayList<String> cmdArgs = new ArrayList<String>();
cmdArgs.add(SSH_EXEC);
if (loc.getPort() != null) {
@@ -252,22 +252,22 @@
Process ssh =
Runtime.getRuntime().exec(
cmdArgs.toArray(new String[cmdArgs.size()]));
-
-
+
+
ssh.getInputStream().close();
ssh.getOutputStream().close();
ssh.getErrorStream().close();
-
+
ssh.waitFor();
-
+
if (ssh.exitValue() != 0)
throw new Exception(
"Error removing remote file, exit code "
+ ssh.exitValue());
-
+
}

-
+
/**
* Check if file exists at specified remote location.
*
@@ -279,9 +279,9 @@
@Override
public boolean exists(String file, Location loc)
throws Exception {
-
+
byte[] buf = new byte[8192];
-
+
// Simple verifications
// * file must not be null
// * loc must not be null
@@ -293,8 +293,8 @@
throw new Exception("loc address is null");
if (loc.getPath() == null)
throw new Exception("loc path is null");
-
-
+
+
String remoteFilePath =
loc.getPath()
+ System.getProperty("file.separator")
@@ -303,7 +303,7 @@
(loc.getUsername() == null ? "" :
(loc.getUsername() + "@"))
+ loc.getAddress();
-
+
ArrayList<String> cmdArgs = new ArrayList<String>();
cmdArgs.add(SSH_EXEC);
if (loc.getPort() != null) {
@@ -317,24 +317,24 @@
Process ssh =
Runtime.getRuntime().exec(
cmdArgs.toArray(new String[cmdArgs.size()]));
-
-
+
+
InputStream sshIn = ssh.getInputStream();
int n = sshIn.read(buf);
while (n > 0) {
-
+
n = sshIn.read(buf);
-
+
}
-
+
ssh.getInputStream().close();
ssh.getOutputStream().close();
ssh.getErrorStream().close();
-
+
ssh.waitFor();
-
+
return ssh.exitValue() == 0;
-
+
}



Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/util/ResultCodesUtil.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/util/ResultCodesUtil.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/util/ResultCodesUtil.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -11,27 +11,27 @@

/**
* Class for creating result code structures (data, metadata, message)
- *
+ *
* @author Maciej Glowiak
*/
public class ResultCodesUtil {
-
-
-
+
+
+
/**
* Create Metadata element containing result code and (optional)
* reference to other metadata
- *
+ *
* @param metadataId Identifier of result code metadata. If null, the
default one will be used
* @param parentMetadataId Identifier of metadata to be refferred to. If
null, no parent metadata will be used.
* @param resultCode Textual value of result code.
* @return Metadata element
*/
public static Metadata createResultCodeMetadata(
- String metadataId,
- String parentMetadataIdRef,
+ String metadataId,
+ String parentMetadataIdRef,
String resultCode) {
-
+
Metadata metadata = new Metadata();
if (metadataId==null) metadataId="resultCodeMetadata";
metadata.setId(metadataId);
@@ -39,31 +39,31 @@
EventType eventType = new EventType();
eventType.setEventType(resultCode);
metadata.setEventType(eventType);
-
+
if (parentMetadataIdRef!=null) {
Subject subject = new Subject();
subject.setMetadataIdRef(parentMetadataIdRef);
subject.setId("referenceToMetadata");
metadata.setSubject(subject);
}
-
+
return metadata;
-
+
}

-
+
/**
- *
+ *
* @param dataId
* @param metadataId
* @param resultDescription
* @return
*/
public static Data createResultDescriptionData(
- String dataId,
- String metadataIdRef,
+ String dataId,
+ String metadataIdRef,
String resultDescription) {
-
+
Data data = new Data();
if (dataId==null) dataId="resultDescriptionData";
data.setId(dataId);
@@ -74,74 +74,74 @@
data.setDatum(datum);

return data;
-
+
}
-
-
+
+
/**
* Converts PerfSONARException into metadata+data result code block
* and puts it into given Message object. If given Message is null
* new Message object will be created
- *
+ *
* @param message object where to put result code
* @param pex perfsonar exception containing result code and description
* @param parentMetadataIdRef reference to other metadata
* @return
*/
public static Message createResultCodeMetadata(
- Message message,
- PerfSONARException pex,
+ Message message,
+ PerfSONARException pex,
String parentMetadataIdRef) {
-
+
//metadata
-
+
String metadataId;
- if (parentMetadataIdRef!=null)
+ if (parentMetadataIdRef!=null)
metadataId="resultCodeMetadata_for_"+parentMetadataIdRef;
else metadataId="resultCodeMetadata";
-
+
Metadata metadata = createResultCodeMetadata(
metadataId,
parentMetadataIdRef,
pex.getResultCode());

//data
-
+
String dataId;
dataId="resultDescriptionData_for_"+metadataId;
-
+
Data data =
createResultDescriptionData(dataId,metadataId,pex.getResultDescription());
-
+
//create new Message if necessary
if (message==null) {
message=new Message();
message.setId("resultCodeMessage");
}
-
+
message.setMetadata(metadata);
message.setData(data);
-
+
return message;
}
-
-
+
+
/**
* Converts PerfSONARException into metadata+data result code block
* and puts it into given Message object
- *
+ *
* @param message object where to put result code
* @param pex perfsonar exception containing result code and description
* @param parentMetadataIdRef reference to other metadata
* @return
*/
public static Message createResultCodeMetadata(
- Message message,
+ Message message,
PerfSONARException pex) {
-
+
return createResultCodeMetadata(message, pex, null);
-
+
}
-
-
-
+
+
+
} //ResultCodesUtil

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -43,7 +43,7 @@

private volatile boolean initialised = false;
private final Object initialisationMutex = new Object();
-
+
/**
* Accepts web service based calls and gives back responses
*
@@ -55,9 +55,9 @@
try {
if(!initialised) init();
checkAuxiliaryComponents();
- return handleCall(request);
- } catch (PerfSONARException pex) {
- return handleError(pex);
+ return handleCall(request);
+ } catch (PerfSONARException pex) {
+ return handleError(pex);
}
}
/**
@@ -97,7 +97,7 @@
logger.debug("RequestHandler: Message object
constructed from request. Request is of type: " + requestMessage.getType());
/* Check if it isn't just an InitService message */
if
(INIT_SERVICE_MESSAGE_TYPE.equalsIgnoreCase(requestMessage.getType())) {
- return handleInitServiceMessage(requestMessage);

+ return handleInitServiceMessage(requestMessage);
}

assertAuthentication(requestMessage);
@@ -107,7 +107,7 @@
}
}
/**
- * Called when any error occurred, response with result/error code
+ * Called when any error occurred, response with result/error code
* @param exception the error
* @return Document containing error information.
*/
@@ -129,11 +129,11 @@
"RequestHandler: Return null response - can
neither create " +
"response message nor error code message!"
);
- }
- logger.info("RequestHandler: Service sent a response with
error information");
+ }
+ logger.info("RequestHandler: Service sent a response with
error information");
return responseDocument;
}
- /**
+ /**
* handles a Init-Service Message.
* TODO this should probably return a normal document instead of it
being an exception
* @return document to return
@@ -152,7 +152,7 @@
// message handler for this type of message.
MessageHandler messageHandler =
MessageHandlerFactory.getMessageHandler(requestMessage.getType());

- logger.debug("RequestHandler: Calling on MessageHandler
["+messageHandler.getClass()+"] to satisfy request");
+ logger.debug("RequestHandler: Calling on MessageHandler
["+messageHandler.getClass()+"] to satisfy request");

// Call on the messageHandler to "execute" the message and
return a response message.
// run proper message handler, which will run ServiceEngine
@@ -184,11 +184,11 @@
* @param requestMessage
* @throws PerfSONARException if the requestMessage is invalid
*/
- protected void checkMessage(Message requestMessage) throws
PerfSONARException {
- if (requestMessage==null) {
- logger.error("RequestHandler: Message object constructed
as null from request");
+ protected void checkMessage(Message requestMessage) throws
PerfSONARException {
+ if (requestMessage==null) {
+ logger.error("RequestHandler: Message object constructed
as null from request");
throw new PerfSONARException(
- "error.common.parse_error",
+ "error.common.parse_error",
"RequestHandler: Server could not construct a
message object from " +
"the request due to unknown error. Please check
request and try again"
);
@@ -245,7 +245,7 @@
requestMessage = XMLUtils.convertToMessage(request,
saxParserConfig);
} catch (Exception e) {
throw new PerfSONARException(
- "error.common.parse_error",
+ "error.common.parse_error",
"Parse/validation error, Cannot convert request to
Message.",
e
);
@@ -274,18 +274,18 @@
);
}

-
+
/**
* Print out time of execution (to log)
- * @param startTime
- * @param messageType
- * @param messageId
- *
+ * @param startTime
+ * @param messageType
+ * @param messageId
+ *
*/
private void logExecutionTime(long startTime, String messageId, String
messageType) {
- long time = System.currentTimeMillis() - startTime;
+ long time = System.currentTimeMillis() - startTime;
logger.info(String.format("Execution Time of message type=[%s]
id=[%s] is [%3$tM]min [%3$tS]secs [%3$tL]milisec", messageType,
messageId,Long.valueOf(time)));
- }
-
-
+ }
+
+
}

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -21,14 +21,14 @@


/**
- * Auxiliary component that keeps the configuration
+ * Auxiliary component that keeps the configuration
* about eventTypes (nmwg element) supported by the service.
* The configuration is stored in conf/eventType-map.xml
* file.
*
* @author romradz
*/
-public class EventTypeConfigurationComponent
+public class EventTypeConfigurationComponent
implements AuxiliaryComponent {


@@ -128,7 +128,7 @@
(EventTypeConfiguration) digester.parse(digesterInputStream);
digesterInputStream.close();

- //logger.debug("EventTypeConfigurationComponent.initComponent: "
+ //logger.debug("EventTypeConfigurationComponent.initComponent: "
// + eventTypeConfiguration.getEventType("utilization");

} catch (Exception ex) {

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/MetadataConfigurationStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/MetadataConfigurationStorageManager.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/MetadataConfigurationStorageManager.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -87,11 +87,11 @@
throw new PerfSONARException(
"error.ma",
"MetadataConfigurationStorageManager.fetch: "
- + "Result array of metadata search in null");
+ + "Result array of metadata search in null");


logger.debug("MetadataConfigurationStorageManager.fetch: "
- + "The number of elements returned as a result of xquery
statement: "
+ + "The number of elements returned as a result of xquery
statement: "
+ xmlResults.length);


@@ -101,7 +101,7 @@
"MetadataConfigurationStorageManager.fetch: "
+ "No metadata in the metadata configuration");

- if (xmlResults.length == 1)
+ if (xmlResults.length == 1)
if (xmlResults[0].trim().isEmpty())
throw new PerfSONARException(
"warning.ma.metadata_configuration",
@@ -390,12 +390,12 @@

XmlDbDataRepository dataRepository =
ExistDbFactory.getDataRepositoryByProperties(
- xmldbAccess.toUpperCase(),
+ xmldbAccess.toUpperCase(),
"component.ma.xmldb.db_uri",
"component.ma.xmldb.db_username",
"component.ma.xmldb.db_password");

- XmlDbStorageManager storageManager =
+ XmlDbStorageManager storageManager =
ExistDbFactory.getXMLStorageManager(
xmldbAccess, dataRepository);
storageManager.setResultType(

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/Transformations.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/Transformations.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/Transformations.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -145,7 +145,7 @@
}


- // getting an appropriate MetadataQueryGenerator to
+ // getting an appropriate MetadataQueryGenerator to
// genarate correct metadata query
MetadataQueryGenerator metadataQueryGenerator =

MetadataQueryGeneratorFactory.getMetadataQueryGenerator(eventType);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGeneratorFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGeneratorFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGeneratorFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -17,7 +17,7 @@
public class MetadataKeyGeneratorFactory {


- public static MetadataKeyGenerator getMetadataKeyGenerator(String
eventTypeName)
+ public static MetadataKeyGenerator getMetadataKeyGenerator(String
eventTypeName)
throws PerfSONARException {

LoggerComponent logger = (LoggerComponent)
@@ -67,7 +67,7 @@
+ className + ": "
+ ex.toString());
throw new PerfSONARException(
- "error.ma.event_type_mapping_configuration",
+ "error.ma.event_type_mapping_configuration",
"MetadataKeyGeneratorFactory.getMetadataKeyGenerator: "
+ "Unable to create an object of "
+ className);
@@ -82,7 +82,7 @@
+ "Could not create a metadataQueryGenerator object for "
+ "eventType: " + eventTypeName);
throw new PerfSONARException(
- "error.ma.event_type_mapping_configuration",
+ "error.ma.event_type_mapping_configuration",
"MetadataKeyGeneratorFactory.getMetadataKeyGenerator: "
+ "Could not create a metadataQueryGenerator for "
+ "eventType: " + eventTypeName);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -166,7 +166,7 @@
if (ipAddress == null &&
hostName == null &&
ifName == null &&
- ifDescription == null &&
+ ifDescription == null &&
ifAddress == null &&
ifIndex == null &&
type == null &&
@@ -197,7 +197,7 @@
}


- xQuery +=
+ xQuery +=
" let $res := \n"
+ " for $i in //nmwg:metadata \n"
+ " where 1 \n";
@@ -273,7 +273,7 @@
}


- xQuery += "\n"
+ xQuery += "\n"
+ " return $i
\n"
+ "
\n"
+ " let $metaids :=
\n"

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -165,7 +165,7 @@
if (ipAddress == null &&
hostName == null &&
ifName == null &&
- ifDescription == null &&
+ ifDescription == null &&
ifAddress == null &&
ifIndex == null &&
type == null &&
@@ -196,7 +196,7 @@
}


- xQuery +=
+ xQuery +=
" let $res := \n"
+ " for $i in //nmwg:metadata \n"
+ " where 1 \n";
@@ -272,7 +272,7 @@
}


- xQuery += "\n"
+ xQuery += "\n"
+ " return $i
\n"
+ "
\n"
+ " let $metaids :=
\n"

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/IperfQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/IperfQueryGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/IperfQueryGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -130,8 +130,8 @@
if (params != null) {
for (String parameter : parameters) {
if (params.getParameterByName(parameter) != null)
- iperfParametersMap.put(parameter,
-
(params.getParameterByName(parameter).getParameterValue() != null ?
+ iperfParametersMap.put(parameter,
+
(params.getParameterByName(parameter).getParameterValue() != null ?

params.getParameterByName(parameter).getParameterValue().trim() : ""));
}
}
@@ -250,7 +250,7 @@
}


- xQuery += "\n"
+ xQuery += "\n"
+ " return $i
\n"
+ "
\n"
+ " let $metaids :=
\n"

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -118,7 +118,7 @@
// situation when only eventType is provided in the request
if (subject == null) {

- xQuery =
+ xQuery =
" let $nodeMetadata :=
\n"
+ " for $i in //nmwg:metadata
\n"
+ " where $i/nmwg:subject/nmwgtopo3:node
\n"

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGeneratorTMP.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGeneratorTMP.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGeneratorTMP.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -121,7 +121,7 @@
// situation when only eventType is provided in the request
if (subject == null) {

- xQuery =
+ xQuery =
" let $nodeMetadata :=
\n"
+ " for $i in //nmwg:metadata
\n"
+ " where $i/nmwg:subject/nmwgtopo3:node
\n"

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGeneratorFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGeneratorFactory.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGeneratorFactory.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -15,7 +15,7 @@


/**
- * Factory class which can be used to get the appropriate
+ * Factory class which can be used to get the appropriate
* MetadataQueryGenerator object for the given eventType.
*
* @author romradz
@@ -25,10 +25,10 @@


/**
- * Returns an object which can create a metadata query
+ * Returns an object which can create a metadata query
* in order to fetch relevant metadata configuration.
*/
- public static MetadataQueryGenerator getMetadataQueryGenerator(String
eventTypeName)
+ public static MetadataQueryGenerator getMetadataQueryGenerator(String
eventTypeName)
throws PerfSONARException {


@@ -73,7 +73,7 @@

try {

- metadataQueryGenerator =
+ metadataQueryGenerator =
(MetadataQueryGenerator)
Class.forName(className).newInstance();

@@ -85,7 +85,7 @@
+ className + ": "
+ ex.toString());
throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
+ "error.ma.metadata_query_mapping_configuration",

"MetadataQueryGeneratorFactory.getMetadataQueryGenerator: "
+ "Unable to create an object of "
+ className);
@@ -100,7 +100,7 @@
+ "Could not create a metadataQueryGenerator object for "
+ "eventType: " + eventTypeName);
throw new PerfSONARException(
- "error.ma.metadata_query_mapping_configuration",
+ "error.ma.metadata_query_mapping_configuration",

"MetadataQueryGeneratorFactory.getMetadataQueryGenerator: "
+ "Could not create a metadataQueryGenerator for "
+ "eventType: " + eventTypeName);

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -34,7 +34,7 @@

protected LoggerComponent logger = null;

- private final String[] parameters = { "count", "dscp", "phb",
+ private final String[] parameters = { "count", "dscp", "phb",
"wait", "endDelay", "timeOut", "padding", "portRange",
"direction" };

// -------------------------------------- constructors
@@ -76,13 +76,13 @@


if (query == null){
- logger.error("QUERY is null!");
+ logger.error("QUERY is null!");
throw new PerfSONARException(
"error.ma.query",
"OwampQueryGenerator.getMetadataQuery: "
+ "Input message is null");
}
-
+
String src = "";
String dst = "";
String eventType = "";
@@ -104,23 +104,23 @@

HashMap<String, String> parametersMap = new HashMap<String,String>();
if (metadata != null) {
-
+
eventType = (metadata.getEventType() != null ?
metadata.getEventType().getEventType().trim() : "");
-
+
Subject subject = (Subject) metadata.getSubject();
EndPointPair end = subject.getEndPointPair();
-
+
Parameters params = metadata.getParameters();
if(params != null){
for(String parameter : parameters){
if(params.getParameterByName(parameter) != null)
- parametersMap.put(parameter,
-
(params.getParameterByName(parameter).getParameterValue() != null ?
+ parametersMap.put(parameter,
+
(params.getParameterByName(parameter).getParameterValue() != null ?

params.getParameterByName(parameter).getParameterValue().trim() : ""));
}
}
-
-
+
+
if (end != null) {
src = (end.getSourceElement() != null ?
end.getSourceElement().getValue().trim() : "");
dst = (end.getDestinationElement() != null ?
end.getDestinationElement().getValue().trim() : "");
@@ -133,12 +133,12 @@
+ "declare namespace
owamp='http://ggf.org/ns/nmwg/tools/owamp/2.0/'; "
+ "declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; \n\n";

- xQuery +=
+ xQuery +=
" let $res :=
\n"
+ " for $i in //nmwg:metadata \n"
+ " where 1
\n";

-
+
if (!eventType.isEmpty())
xQuery += "and $i/nmwg:eventType[(text()='" + eventType +
"')]";

@@ -147,7 +147,7 @@

if (!dst.isEmpty())
xQuery += "and
$i/owamp:subject/nmwgt:endPointPair/nmwgt:dst[@value='"
+ dst + "']";
-
+
Set<String> keySet = parametersMap.keySet();
for(String key : keySet){
String v = parametersMap.get(key);
@@ -156,8 +156,8 @@
+ "or (@value='" + v + "' and
@name='"+key+"')]";
}
}
-
- xQuery += "\n"
+
+ xQuery += "\n"
+ " return $i
\n"
+ "
\n"
+ " let $metaids :=
\n"

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -166,7 +166,7 @@
if (ipAddress == null &&
hostName == null &&
ifName == null &&
- ifDescription == null &&
+ ifDescription == null &&
ifAddress == null &&
ifIndex == null &&
type == null &&
@@ -281,7 +281,7 @@
}


- xQuery += "\n"
+ xQuery += "\n"
+ " return $i
\n"
+ "
\n"
+ " let $metaids :=
\n"

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
2012-10-05 09:22:39 UTC (rev 6008)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
2012-10-05 09:22:41 UTC (rev 6009)
@@ -23,7 +23,7 @@

/**
* Action for simple Scheduler that registers with the LS
- *
+ *
* @author Maciej Glowiak (main author)
* @author romradz (contributor)
* @deprecated use
{@link
org.perfsonar.service.base.registration.LSRegistrationComponent}



  • [pS-dev] [GEANT/SA2/ps-java-services] r6009 - in trunk: perfsonar-java-sql-ma/src/main/java/org/perfso nar/service/measurementArchive/sqlType perfsonar-java-sql- ma/src/main/java/org/perfsonar/service/measurementArchive/ sqlType/fetch perfsonar-java-sql-ma/src/main/java/org/perf sonar/service/measurementArchive/sqlType/store perfsonar-j ava-sql-ma/src/test/java/org/perfsonar/service/measurement Archive/sqlType perfsonar_base/src/main/java/org/perfson ar/base/auxiliary perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/authn perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/configur ation perfsonar_base/src/main/java/org/perfsonar/base/au xiliary/components/configuration/properties perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/c ontext perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/context/inMemory perfsonar_base/src/ main/java/org/perfsonar/base/auxiliary/components/logger p erfsonar_base/src/main/java/org/ perfsonar/base/auxiliar y/components/logger/log4j perfsonar_base/src/main/java/o rg/perfsonar/base/auxiliary/components/mapping perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/scheduler perfsonar_base/src/main/java/org/perfsonar /base/auxiliary/components/scheduler/actions perfsonar_b ase/src/main/java/org/perfsonar/base/auxiliary/components/ simplescheduler perfsonar_base/src/main/java/org/perfson ar/base/exceptions perfsonar_base/src/main/java/org/perf sonar/base/nmwg/owamp perfsonar_base/src/main/java/org/p erfsonar/base/util perfsonar_base/src/main/java/org/perf sonar/base/util/iptrie perfsonar_base/src/main/java/org/ perfsonar/client/axis perfsonar_base/src/main/java/org/p erfsonar/client/base/authn/saslca perfsonar_base/src/mai n/java/org/perfsonar/client/base/requests perfsonar_base /src/main/java/org/perfsonar/client/base/requests/authServ ice perfsonar_base/src/main/java/org/perfsonar/client/ba se/requests/lookupService perfsonar_base/src/main/java/o rg/perfson ar/client/base/xquery perfsonar_base/src/main /java/org/perfsonar/client/base/xquery/lookupService perfs onar_base/src/main/java/org/perfsonar/client/testHarness perfsonar_base/src/main/java/org/perfsonar/service/base /authn perfsonar_base/src/main/java/org/perfsonar/servic e/base/authn/tokens perfsonar_base/src/main/java/org/per fsonar/service/base/container/listeners perfsonar_base/s rc/main/java/org/perfsonar/service/base/engine perfsonar _base/src/main/java/org/perfsonar/service/base/measureme ntExecutor perfsonar_base/src/main/java/org/perfsonar/se rvice/base/messages perfsonar_base/src/main/java/org/per fsonar/service/base/registration perfsonar_base/src/main /java/org/perfsonar/service/base/storage perfsonar_base/ src/main/java/org/perfsonar/service/base/storage/xmldb per fsonar_base/src/main/java/org/perfsonar/service/base/sto rage/xmldb/exist perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/rest perfsonar_base /src/main/java/org/perfsonar/service/base/st orage/xmldb/e xist/xmlrpc perfsonar_base/src/main/java/org/perfsonar/s ervice/base/storage/xmlfile perfsonar_base/src/main/java /org/perfsonar/service/base/transport perfsonar_base/src /main/java/org/perfsonar/service/base/util perfsonar_bas e/src/main/java/org/perfsonar/service/base/web perfsonar _base/src/main/java/org/perfsonar/service/measurementArc hive/eventTypeConfig perfsonar_base/src/main/java/org/pe rfsonar/service/measurementArchive/metadataConfig perfsona r_base/src/main/java/org/perfsonar/service/measurementAr chive/metadataConfig/keyGenerator perfsonar_base/src/mai n/java/org/perfsonar/service/measurementArchive/metadataCo nfig/queryGenerator perfsonar_base/src/main/java/org/per fsonar/service/measurementArchive/register, svn-noreply, 10/05/2012

Archive powered by MHonArc 2.6.16.

Top of Page