perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6025 - in trunk: perfsonar-java-sql-ma/src/checkstyle perfsonar _base perfsonar_base/src perfsonar_base/src/checksty le perfsonar_base/src/main/java/org/perfsonar/base/auxil iary perfsonar_base/src/main/java/org/perfsonar/base/aux iliary/components/authn perfsonar_base/src/main/java/org /perfsonar/base/auxiliary/components/authn/wssec perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/configuration perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/configuration/properties pe rfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ components/logger perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/logger/log4j perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/m apping perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/scheduler perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/scheduler/actio ns perfsonar_base/src/main/java/org/perfsona r/base/auxi liary/components/simplescheduler perfsonar_base/src/main /java/org/perfsonar/base/exceptions perfsonar_base/src/m ain/java/org/perfsonar/base/nmwg/owamp perfsonar_base/sr c/main/java/org/perfsonar/base/util perfsonar_base/src/m ain/java/org/perfsonar/base/util/iptrie perfsonar_base/s rc/main/java/org/perfsonar/client/axis perfsonar_base/sr c/main/java/org/perfsonar/client/base/authn perfsonar_ba se/src/main/java/org/perfsonar/client/base/authn/edugain p erfsonar_base/src/main/java/org/perfsonar/client/base/au thn/saslca perfsonar_base/src/main/java/org/perfsonar/cl ient/base/requests perfsonar_base/src/main/java/org/perf sonar/client/base/requests/authService perfsonar_base/sr c/main/java/org/perfsonar/client/base/requests/lookupServi ce perfsonar_base/src/main/java/org/perfsonar/client/bas e/xquery perfsonar_base/src/main/java/org/perfsonar/clie nt/base/xquery/lookupService perfsonar_base/src/main/jav a/org/perfsonar/client/testHarness perfsonar_base/src/ma in/java/org/perfsonar/ service/base/authn perfsonar_base /src/main/java/org/perfsonar/service/base/authn/tokens per fsonar_base/src/main/java/org/perfsonar/service/base/con tainer/listeners perfsonar_base/src/main/java/org/perfso nar/service/base/engine perfsonar_base/src/main/java/org /perfsonar/service/base/measurementExecutor perfsonar_ba se/src/main/java/org/perfsonar/service/base/messages perfs onar_base/src/main/java/org/perfsonar/service/base/regis tration perfsonar_base/src/main/java/org/perfsonar/servi ce/base/storage perfsonar_base/src/main/java/org/perfson ar/service/base/storage/xmldb perfsonar_base/src/main/ja va/org/perfsonar/service/base/storage/xmldb/exist perfsona r_base/src/main/java/org/perfsonar/service/base/storage/ xmldb/exist/rest perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/xmlrpc perfsonar_ba se/src/main/java/org/perfsonar/service/base/storage/xmlfil e perfsonar_base/src/main/java/org/perfsonar/service/bas e/transport perfsonar_base/src/main/java/org/perfson ar/ service/base/util perfsonar_base/src/main/java/org/perfs onar/service/base/web perfsonar_base/src/main/java/org/p erfsonar/service/measurementArchive/eventTypeConfig perfso nar_base/src/main/java/org/perfsonar/service/measurement Archive/metadataConfig perfsonar_base/src/main/java/org/ perfsonar/service/measurementArchive/metadataConfig/keyGen erator perfsonar_base/src/main/java/org/perfsonar/servic e/measurementArchive/metadataConfig/queryGenerator perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/register
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6025 - in trunk: perfsonar-java-sql-ma/src/checkstyle perfsonar _base perfsonar_base/src perfsonar_base/src/checksty le perfsonar_base/src/main/java/org/perfsonar/base/auxil iary perfsonar_base/src/main/java/org/perfsonar/base/aux iliary/components/authn perfsonar_base/src/main/java/org /perfsonar/base/auxiliary/components/authn/wssec perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/configuration perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/configuration/properties pe rfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ components/logger perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/logger/log4j perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/m apping perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/scheduler perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/scheduler/actio ns perfsonar_base/src/main/java/org/perfsona r/base/auxi liary/components/simplescheduler perfsonar_base/src/main /java/org/perfsonar/base/exceptions perfsonar_base/src/m ain/java/org/perfsonar/base/nmwg/owamp perfsonar_base/sr c/main/java/org/perfsonar/base/util perfsonar_base/src/m ain/java/org/perfsonar/base/util/iptrie perfsonar_base/s rc/main/java/org/perfsonar/client/axis perfsonar_base/sr c/main/java/org/perfsonar/client/base/authn perfsonar_ba se/src/main/java/org/perfsonar/client/base/authn/edugain p erfsonar_base/src/main/java/org/perfsonar/client/base/au thn/saslca perfsonar_base/src/main/java/org/perfsonar/cl ient/base/requests perfsonar_base/src/main/java/org/perf sonar/client/base/requests/authService perfsonar_base/sr c/main/java/org/perfsonar/client/base/requests/lookupServi ce perfsonar_base/src/main/java/org/perfsonar/client/bas e/xquery perfsonar_base/src/main/java/org/perfsonar/clie nt/base/xquery/lookupService perfsonar_base/src/main/jav a/org/perfsonar/client/testHarness perfsonar_base/src/ma in/java/org/perfsonar/ service/base/authn perfsonar_base /src/main/java/org/perfsonar/service/base/authn/tokens per fsonar_base/src/main/java/org/perfsonar/service/base/con tainer/listeners perfsonar_base/src/main/java/org/perfso nar/service/base/engine perfsonar_base/src/main/java/org /perfsonar/service/base/measurementExecutor perfsonar_ba se/src/main/java/org/perfsonar/service/base/messages perfs onar_base/src/main/java/org/perfsonar/service/base/regis tration perfsonar_base/src/main/java/org/perfsonar/servi ce/base/storage perfsonar_base/src/main/java/org/perfson ar/service/base/storage/xmldb perfsonar_base/src/main/ja va/org/perfsonar/service/base/storage/xmldb/exist perfsona r_base/src/main/java/org/perfsonar/service/base/storage/ xmldb/exist/rest perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/xmlrpc perfsonar_ba se/src/main/java/org/perfsonar/service/base/storage/xmlfil e perfsonar_base/src/main/java/org/perfsonar/service/bas e/transport perfsonar_base/src/main/java/org/perfson ar/ service/base/util perfsonar_base/src/main/java/org/perfs onar/service/base/web perfsonar_base/src/main/java/org/p erfsonar/service/measurementArchive/eventTypeConfig perfso nar_base/src/main/java/org/perfsonar/service/measurement Archive/metadataConfig perfsonar_base/src/main/java/org/ perfsonar/service/measurementArchive/metadataConfig/keyGen erator perfsonar_base/src/main/java/org/perfsonar/servic e/measurementArchive/metadataConfig/queryGenerator perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/register
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6025 - in trunk: perfsonar-java-sql-ma/src/checkstyle perfsonar _base perfsonar_base/src perfsonar_base/src/checksty le perfsonar_base/src/main/java/org/perfsonar/base/auxil iary perfsonar_base/src/main/java/org/perfsonar/base/aux iliary/components/authn perfsonar_base/src/main/java/org /perfsonar/base/auxiliary/components/authn/wssec perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/configuration perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/configuration/properties pe rfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ components/logger perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/logger/log4j perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/m apping perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/scheduler perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/scheduler/actio ns perfsonar_base/src/main/java/org/perfsona r/base/auxi liary/components/simplescheduler perfsonar_base/src/main /java/org/perfsonar/base/exceptions perfsonar_base/src/m ain/java/org/perfsonar/base/nmwg/owamp perfsonar_base/sr c/main/java/org/perfsonar/base/util perfsonar_base/src/m ain/java/org/perfsonar/base/util/iptrie perfsonar_base/s rc/main/java/org/perfsonar/client/axis perfsonar_base/sr c/main/java/org/perfsonar/client/base/authn perfsonar_ba se/src/main/java/org/perfsonar/client/base/authn/edugain p erfsonar_base/src/main/java/org/perfsonar/client/base/au thn/saslca perfsonar_base/src/main/java/org/perfsonar/cl ient/base/requests perfsonar_base/src/main/java/org/perf sonar/client/base/requests/authService perfsonar_base/sr c/main/java/org/perfsonar/client/base/requests/lookupServi ce perfsonar_base/src/main/java/org/perfsonar/client/bas e/xquery perfsonar_base/src/main/java/org/perfsonar/clie nt/base/xquery/lookupService perfsonar_base/src/main/jav a/org/perfsonar/client/testHarness perfsonar_base/src/ma in/java/org/perfsonar/ service/base/authn perfsonar_base /src/main/java/org/perfsonar/service/base/authn/tokens per fsonar_base/src/main/java/org/perfsonar/service/base/con tainer/listeners perfsonar_base/src/main/java/org/perfso nar/service/base/engine perfsonar_base/src/main/java/org /perfsonar/service/base/measurementExecutor perfsonar_ba se/src/main/java/org/perfsonar/service/base/messages perfs onar_base/src/main/java/org/perfsonar/service/base/regis tration perfsonar_base/src/main/java/org/perfsonar/servi ce/base/storage perfsonar_base/src/main/java/org/perfson ar/service/base/storage/xmldb perfsonar_base/src/main/ja va/org/perfsonar/service/base/storage/xmldb/exist perfsona r_base/src/main/java/org/perfsonar/service/base/storage/ xmldb/exist/rest perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/xmlrpc perfsonar_ba se/src/main/java/org/perfsonar/service/base/storage/xmlfil e perfsonar_base/src/main/java/org/perfsonar/service/bas e/transport perfsonar_base/src/main/java/org/perfson ar/ service/base/util perfsonar_base/src/main/java/org/perfs onar/service/base/web perfsonar_base/src/main/java/org/p erfsonar/service/measurementArchive/eventTypeConfig perfso nar_base/src/main/java/org/perfsonar/service/measurement Archive/metadataConfig perfsonar_base/src/main/java/org/ perfsonar/service/measurementArchive/metadataConfig/keyGen erator perfsonar_base/src/main/java/org/perfsonar/servic e/measurementArchive/metadataConfig/queryGenerator perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/register
- Date: Mon, 8 Oct 2012 13:49:20 +0100 (BST)
Author: nordunet.behrmann
Date: 2012-10-08 13:49:20 +0100 (Mon, 08 Oct 2012)
New Revision: 6025
Added:
trunk/perfsonar_base/src/checkstyle/
trunk/perfsonar_base/src/checkstyle/checkstyle.xml
Modified:
trunk/perfsonar-java-sql-ma/src/checkstyle/checkstyle.xml
trunk/perfsonar_base/pom.xml
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/AuthNComponent.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/authn/SOAPUtil.java
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/wssec/WSSecAuthNComponent.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/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/axis/Client.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNDataFactory.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNSAMLData.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNSAMLData.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINFilterHelper.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINMetadataService.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/authn/saslca/UserID.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/UserIDCallbackHandler.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/AttrEERequestGenerator.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/client/testHarness/SOAPX509Client.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCMDSTest.java
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCSaslTest.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchManager.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocol.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocolFactory.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/AttrRequest.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AttrResponse.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AuthRRequest.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManager.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManagerFactory.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/BaseChaining.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/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/ServiceLSRegistrator.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/DataRepository.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/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/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/SimpleMetadataConfigurationStorageManager.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/L2PathStatusKeyGenerator.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGenerator.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/BwctlQueryGenerator.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/MetadataQueryGenerator.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/PingQueryGenerator.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/RandomFetchTestQueryGenerator.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/metadataConfig/queryGenerator/XmlDbAccessTestQueryGenerator.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/XmlDbContentTestQueryGenerator.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
Log:
perfsonar_base: Add checkstyle plugin
Besides adding the Maven checkstyle plugin, this commit
updates many classes to conform to the coding conventions
enforced by the checkstyle plugin.
Issue: PSSERVICES-588
Issue: PSSERVICES-599
Issue: PSSERVICES-597
Modified: trunk/perfsonar-java-sql-ma/src/checkstyle/checkstyle.xml
===================================================================
--- trunk/perfsonar-java-sql-ma/src/checkstyle/checkstyle.xml 2012-10-08
12:49:17 UTC (rev 6024)
+++ trunk/perfsonar-java-sql-ma/src/checkstyle/checkstyle.xml 2012-10-08
12:49:20 UTC (rev 6025)
@@ -158,7 +158,7 @@
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="AvoidInlineConditionals"/>
+ <!--module name="AvoidInlineConditionals"/-->
<module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
@@ -169,7 +169,9 @@
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
+ <module name="RedundantThrows">
+ <property name="suppressLoadErrors" value="true"/>
+ </module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
Modified: trunk/perfsonar_base/pom.xml
===================================================================
--- trunk/perfsonar_base/pom.xml 2012-10-08 12:49:17 UTC (rev 6024)
+++ trunk/perfsonar_base/pom.xml 2012-10-08 12:49:20 UTC (rev 6025)
@@ -36,6 +36,27 @@
<target>1.6</target>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.9.1</version>
+ <executions>
+ <execution>
+ <id>check-style</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <consoleOutput>true</consoleOutput>
+
<logViolationsToConsole>true</logViolationsToConsole>
+ <failsOnError>true</failsOnError>
+ <failOnViolation>true</failOnViolation>
+
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
Copied: trunk/perfsonar_base/src/checkstyle/checkstyle.xml (from rev 6024,
trunk/perfsonar-java-sql-ma/src/checkstyle/checkstyle.xml)
===================================================================
--- trunk/perfsonar_base/src/checkstyle/checkstyle.xml
(rev 0)
+++ trunk/perfsonar_base/src/checkstyle/checkstyle.xml 2012-10-08 12:49:20
UTC (rev 6025)
@@ -0,0 +1,198 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+ Based on the default checkstyle configuration, but with minor
+ modifications based on established conventions in existing
+ perfsonar code.
+-->
+
+<!--
+
+ Checkstyle configuration that checks the sun coding conventions from:
+
+ - the Java Language Specification at
+ http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+ - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+ - the Javadoc guidelines at
+ http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+ - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+ - some best practices
+
+ Checkstyle is very configurable. Be sure to read the documentation at
+ http://checkstyle.sf.net (or in your downloaded distribution).
+
+ Most Checks are configurable, be sure to consult the documentation.
+
+ To completely disable a check, just comment it out or delete it from the
file.
+
+ Finally, it is worth reading the documentation.
+
+-->
+
+<module name="Checker">
+ <!--
+ If you set the basedir property below, then all reported file
+ names will be relative to the specified directory. See
+ http://checkstyle.sourceforge.net/5.x/config.html#Checker
+
+ <property name="basedir" value="${basedir}"/>
+ -->
+
+ <!-- Checks that a package-info.java file exists for each package.
-->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
+ <!--module name="JavadocPackage"/-->
+
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <module name="NewlineAtEndOfFile"/>
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation"/>
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="FileLength"/>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="FileTabCharacter"/>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="RegexpSingleline">
+ <property name="format" value="\s+$"/>
+ <property name="minimum" value="0"/>
+ <property name="maximum" value="0"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+
+ <!-- Checks for Headers -->
+ <!-- See http://checkstyle.sf.net/config_header.html -->
+ <!-- <module name="Header"> -->
+ <!-- <property name="headerFile" value="${checkstyle.header.file}"/>
-->
+ <!-- <property name="fileExtensions" value="java"/> -->
+ <!-- </module> -->
+
+ <module name="TreeWalker">
+
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <!--module name="JavadocMethod"/>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable"/-->
+ <module name="JavadocStyle"/>
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName"/>
+ <module name="LocalFinalVariableName"/>
+ <module name="LocalVariableName"/>
+ <module name="MemberName"/>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <!--module name="LineLength">
+ <property name="max" value="120"/>
+ </module-->
+ <!--module name="MethodLength"/-->
+ <!--module name="ParameterNumber"/-->
+
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad"/>
+ <module name="GenericWhitespace"/>
+ <module name="MethodParamPad"/>
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks"/>
+ <module name="EmptyBlock">
+ <property name="tokens"
+
value="LITERAL_DO,LITERAL_FINALLY,LITERAL_ELSE,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
+ </module>
+ <module name="LeftCurly">
+ <property name="option" value="nl"/>
+ <property name="tokens"
value="CLASS_DEF,INTERFACE_DEF,METHOD_DEF"/>
+ </module>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <!--module name="AvoidInlineConditionals"/-->
+ <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField">
+ <property name="tokens" value="VARIABLE_DEF"/>
+ </module>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ <!--module name="MagicNumber"/-->
+ <!--module name="MissingSwitchDefault"/-->
+ <module name="RedundantThrows">
+ <property name="suppressLoadErrors" value="true"/>
+ </module>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--module name="DesignForExtension"/-->
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <!--module name="InterfaceIsType"/-->
+ <module name="VisibilityModifier">
+ <property name="protectedAllowed" value="true"/>
+ </module>
+
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <module name="ArrayTypeStyle"/>
+ <!--module name="FinalParameters"/-->
+ <!--module name="TodoComment"/-->
+ <module name="UpperEll"/>
+
+ </module>
+
+</module>
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -10,29 +10,24 @@
*/
public interface AuxiliaryComponent
{
-
-
/**
- * Method used for initialize AuxiliaryComponent
+ * Method used for initialize AuxiliaryComponent.
*
* @throws SystemException
*/
- public void initComponent() throws PerfSONARException;
+ void initComponent() throws PerfSONARException;
-
/**
- * Get component name
+ * Get component name.
*
* @return name as String
*/
- public String getComponentName();
+ String getComponentName();
/**
- * Set component name
+ * Set component name.
*
* @param name name of component
*/
- public void setComponentName(String name);
-
-
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -25,27 +25,27 @@
* @author Uros Juvan (added componentsIterator)
* @author Michael Bischoff
*/
-public class AuxiliaryComponentManager
+public final class AuxiliaryComponentManager
{
+ private static final Logger LOGGER =
Logger.getLogger(AuxiliaryComponentManager.class.getName());
- private final static Logger logger =
Logger.getLogger(AuxiliaryComponentManager.class.getName());
-
// -----------------------------------------------------------------
Static
/**
- * Static reference to Auxiliary Component Manager
+ * Static reference to Auxiliary Component Manager.
*/
- private static final AuxiliaryComponentManager componentManager = new
AuxiliaryComponentManager();
+ private static final AuxiliaryComponentManager COMPONENT_MANAGER = new
AuxiliaryComponentManager();
- private static final Object initialiseMutex = new Object();
+ private static final Object INITIALISE_MUTEX = new Object();
private static volatile boolean initialised;
private static volatile boolean isInitialising;
// ----------------------------------------------------- Instance
variables
/**
- * Map of components (component_name, component object reference)
+ * Map of components (component_name, component object reference).
*/
- private final ConcurrentMap<String, AuxiliaryComponent> components = new
ConcurrentHashMap<String, AuxiliaryComponent>();
+ private final ConcurrentMap<String, AuxiliaryComponent> components =
+ new ConcurrentHashMap<String, AuxiliaryComponent>();
private String webInfLocation;
@@ -55,7 +55,7 @@
/**
* Private constructor - object can be created by static getInstance()
- * method (singleton pattern) only
+ * method (singleton pattern) only.
*/
private AuxiliaryComponentManager()
{
@@ -65,7 +65,7 @@
/**
* Set up the manager. Load mappings from components.properties file
- * and creates all component objects
+ * and creates all component objects.
*/
public boolean initManager() throws PerfSONARException
{
@@ -75,15 +75,16 @@
if (componentsProperties == null) {
throw new PerfSONARException(
- "AuxiliaryComponentManager.initManager: " +
- "Missing or unable to locate components.properties file.
Cannot continue"
+ "AuxiliaryComponentManager.initManager: "
+ + "Missing or unable to locate components.properties
file. Cannot continue"
);
}
- logger.info("AuxiliaryComponentManager.initManager: Read config file
name as: " + componentsProperties);
+ 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());
+ ArrayList<ComponentsConfigurationReader.Entry> properties =
+ new
ComponentsConfigurationReader().readFile(componentsProperties.getCanonicalPath());
//for each entry in properties - create and initialize component
for (ComponentsConfigurationReader.Entry e : properties) {
@@ -91,12 +92,12 @@
String componentClassName = e.getValue();
try {
- logger.fine("AUX ComponentManager creating [" +
componentName + "] = " + componentClassName);
+ LOGGER.fine("AUX ComponentManager creating [" +
componentName + "] = " + componentClassName);
AuxiliaryComponent component =
loadComponent(componentName, componentClassName);
- logger.finer("AUX ComponentManager: init [" +
componentName + "]");
+ LOGGER.finer("AUX ComponentManager: init [" +
componentName + "]");
component.initComponent();
} catch (PerfSONARException ex) {
-
logger.throwing(AuxiliaryComponentManager.class.getName(), "initmanager()",
ex);
+
LOGGER.throwing(AuxiliaryComponentManager.class.getName(), "initmanager()",
ex);
//do nothing - not critical exception, just load other
modules
}
}
@@ -146,19 +147,19 @@
//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();
+ String m = "AUXComponentManager: "
+ + "can't create component [" + componentName + "]. "
+ + "Encountered ClassNotFound Exception. Message: " +
ex.getMessage();
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();
+ String m = "AUXComponentManager: "
+ + "can't create component [" + componentName + "]. "
+ + "Encountered Instantiation Exception. Message: " +
ex.getMessage();
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();
+ String m = "AUXComponentManager: "
+ + "can't create component [" + componentName + "]. "
+ + "Encountered IllegalAccess Exception. Message: " +
ex.getMessage();
throw new
PerfSONARException("error.common.manager.cant_create_component", m);
}
@@ -167,7 +168,7 @@
}
/**
- * Put component into component map
+ * Put component into component map.
*
* @param name name of the component
* @param component object
@@ -178,7 +179,7 @@
}
/**
- * Return component for specified mapping
+ * Return component for specified mapping.
*
* @param name name of the component
* @return Auxiliary Component
@@ -195,13 +196,11 @@
*/
public Iterator<Map.Entry<String, AuxiliaryComponent>>
componentsIterator()
{
-
return components == null ? null : components.entrySet().iterator();
-
}
/**
- * Should be set and thus this shouldn't return null
+ * Should be set and thus this shouldn't return null.
*
* @return temp directory that exist can be read and written to or null
* if this
{@link
AuxiliaryComponentManager} was incorrectly configured
@@ -223,21 +222,21 @@
{
// initialation must be lazy because of AxisMessageContext.
if (!initialised) {
- synchronized (initialiseMutex) {
+ synchronized (INITIALISE_MUTEX) {
// avoid other threads from also initialising
// defend against endless loop. (calling getInstance()
within initManager();)
if (!initialised && !isInitialising) {
isInitialising = true;
- initialised = componentManager.initManager();
+ initialised = COMPONENT_MANAGER.initManager();
isInitialising = false;
}
}
}
- return componentManager;
+ return COMPONENT_MANAGER;
}
/**
- * For stand-alone applications
+ * For stand-alone applications.
*/
public static void main(String[] args) throws PerfSONARException
{
@@ -254,7 +253,7 @@
*/
public static File lookupFile(String location)
{
- logger.fine("Looking up file: " + location);
+ LOGGER.fine("Looking up file: " + location);
if (location == null) {
return null;
@@ -262,15 +261,15 @@
URL url;
// try WEB-INF
- logger.finer("WEB-INF:" + componentManager.webInfLocation);
- if (componentManager.webInfLocation != null) {
+ LOGGER.finer("WEB-INF:" + COMPONENT_MANAGER.webInfLocation);
+ if (COMPONENT_MANAGER.webInfLocation != null) {
if (location.startsWith("/")) {
- url = componentManager.getClass().getResource(
- componentManager.webInfLocation + location
+ url = COMPONENT_MANAGER.getClass().getResource(
+ COMPONENT_MANAGER.webInfLocation + location
);
} else {
- url = componentManager.getClass().getResource(
- componentManager.webInfLocation + "/" + location
+ url = COMPONENT_MANAGER.getClass().getResource(
+ COMPONENT_MANAGER.webInfLocation + "/" + location
);
}
if (url != null) {
@@ -279,7 +278,7 @@
}
// try class path
- url = componentManager.getClass().getResource(location);
+ url = COMPONENT_MANAGER.getClass().getResource(location);
if (url != null) {
return new File(url.getFile());
}
@@ -296,15 +295,15 @@
*/
public static void setWebInfLocation(String location)
{
- logger.fine("WEB-INF location set to: " + location);
+ LOGGER.fine("WEB-INF location set to: " + location);
// normalise
String normalisedLocation = slashify(location);
- logger.finer("location normalised to: " + normalisedLocation);
+ LOGGER.finer("location normalised to: " + normalisedLocation);
if (location.endsWith(File.pathSeparator) || location.endsWith("/"))
{
- componentManager.webInfLocation =
normalisedLocation.substring(0, location.length() - 1);
+ COMPONENT_MANAGER.webInfLocation =
normalisedLocation.substring(0, location.length() - 1);
} else {
- componentManager.webInfLocation = normalisedLocation;
+ COMPONENT_MANAGER.webInfLocation = normalisedLocation;
}
}
@@ -324,7 +323,7 @@
if (!directory.canWrite()) {
throw new IllegalArgumentException("Temp directory can't be
written to.");
}
- componentManager.tempDirectory = directory;
+ COMPONENT_MANAGER.tempDirectory = directory;
}
private static String slashify(String path)
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryThreadedComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -9,12 +9,8 @@
*/
public interface AuxiliaryThreadedComponent extends AuxiliaryComponent
{
-
-
/**
* Method stopping the thread.
*/
- public void stopThread();
-
-
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentNames.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -1,13 +1,12 @@
package org.perfsonar.base.auxiliary;
/**
- * Interface contains common component names
+ * Interface contains common component names.
*
* @author Maciej Glowiak
*/
-public interface ComponentNames
+public final class ComponentNames
{
-
public static final String CONFIG = "config";
public static final String LOGGER = "logger";
@@ -20,9 +19,11 @@
/**
* The context aux-component is a simple in-application map
- * that allows sharing of data
+ * that allows sharing of data.
*/
public static final String CONTEXT = "context";
-
+ private ComponentNames()
+ {
+ }
} //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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ComponentsConfigurationReader.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -19,7 +19,7 @@
/**
* Reads properties file and returns an ArrayList of Entry (pair of
- * strings: name and value )
+ * strings: name and value).
*
* @return ArrayList of Entry
* @throws IOException
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/AuthNComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/AuthNComponent.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/AuthNComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -4,15 +4,14 @@
public interface AuthNComponent
{
- public static final String CHECK_AUTHN_PARAM = "service.as.authn_active";
- public static final String YES_CHECK_AUTHN = "on";
- public static final String LIST_MSG_AUTHN =
"service.as.authn_for_msg_types";
+ String CHECK_AUTHN_PARAM = "service.as.authn_active";
+ String YES_CHECK_AUTHN = "on";
+ String LIST_MSG_AUTHN = "service.as.authn_for_msg_types";
- public static final String CHECK_AUTHR_PARAM = "service.as.authr_active";
- public static final String YES_CHECK_AUTHR = "on";
- public static final String LIST_MSG_AUTHR =
"service.as.authr_for_msg_types";
+ String CHECK_AUTHR_PARAM = "service.as.authr_active";
+ String YES_CHECK_AUTHR = "on";
+ String LIST_MSG_AUTHR = "service.as.authr_for_msg_types";
- public void requestAuthN(String messageType) throws PerfSONARException;
-
- public void requestAuthR(String messageType, String eventType) throws
PerfSONARException;
+ void requestAuthN(String messageType) throws PerfSONARException;
+ void requestAuthR(String messageType, String eventType) throws
PerfSONARException;
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/DynamicCrypto.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -37,7 +37,7 @@
public class DynamicCrypto implements Crypto
{
- private static final Log log = LogFactory.getLog(DynamicCrypto.class);
+ private static final Log LOG = LogFactory.getLog(DynamicCrypto.class);
protected static CertificateFactory certFact;
protected Properties properties = null;
protected KeyStore keystore = null;
@@ -100,7 +100,8 @@
Certificate cert;
try {
- for (Enumeration<String> e = keystore.aliases();
e.hasMoreElements(); ) {
+ Enumeration<String> e = keystore.aliases();
+ while (e.hasMoreElements()) {
String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
@@ -138,13 +139,13 @@
}
/*
- * need to check if "getCertificateChain" also finds certificates
that are
- * used for enryption only, i.e. they may not be signed by a CA
- * Otherwise we must define a restriction how to use certificate:
- * each certificate must be signed by a CA or is a self signed
Certificate
- * (this should work as well).
- * --- remains to be tested in several ways --
- */
+ * need to check if "getCertificateChain" also finds certificates that
are
+ * used for enryption only, i.e. they may not be signed by a CA
+ * Otherwise we must define a restriction how to use certificate:
+ * each certificate must be signed by a CA or is a self signed
Certificate
+ * (this should work as well).
+ * --- remains to be tested in several ways --
+ */
private String getAliasForX509Cert(String issuer, BigInteger
serialNumber,
boolean useSerialNumber)
throws WSSecurityException
@@ -155,7 +156,8 @@
Certificate cert;
try {
- for (Enumeration<String> e = keystore.aliases();
e.hasMoreElements(); ) {
+ Enumeration<String> e = keystore.aliases();
+ while (e.hasMoreElements()) {
String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
@@ -171,8 +173,8 @@
continue;
}
x509cert = (X509Certificate) cert;
- if (!useSerialNumber ||
- useSerialNumber &&
x509cert.getSerialNumber().compareTo(serialNumber) == 0) {
+ if (!useSerialNumber
+ || useSerialNumber &&
x509cert.getSerialNumber().compareTo(serialNumber) == 0) {
certRDN = splitAndTrim(x509cert.getIssuerDN().getName());
if (certRDN.equals(issuerRDN)) {
return alias;
@@ -201,7 +203,8 @@
"noSHA1availabe");
}
try {
- for (Enumeration<String> e = keystore.aliases();
e.hasMoreElements(); ) {
+ Enumeration<String> e = keystore.aliases();
+ while (e.hasMoreElements()) {
String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
if (certs == null || certs.length == 0) {
@@ -263,7 +266,8 @@
// Look at every certificate in the keystore
try {
- for (Enumeration<String> e = keystore.aliases();
e.hasMoreElements(); ) {
+ Enumeration<String> e = keystore.aliases();
+ while (e.hasMoreElements()) {
String alias = e.nextElement();
Certificate[] certs = keystore.getCertificateChain(alias);
@@ -394,7 +398,7 @@
}
boolean b = keystore.isKeyEntry(alias);
if (!b) {
- log.error("Cannot find key for alias: " + alias);
+ LOG.error("Cannot find key for alias: " + alias);
throw new Exception("Cannot find key for alias: " + alias);
}
Key keyTmp = keystore.getKey(alias, password.toCharArray());
@@ -445,7 +449,7 @@
* Strip away first four bytes from the DerValue (tag and length of
* ExtensionValue OCTET STRING and KeyIdentifier OCTET STRING)
*/
- byte abyte0[] = new byte[derEncodedValue.length - 4];
+ byte[] abyte0 = new byte[derEncodedValue.length - 4];
System.arraycopy(derEncodedValue, 4, abyte0, 0, abyte0.length);
return abyte0;
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/SOAPUtil.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/SOAPUtil.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/SOAPUtil.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -9,8 +9,11 @@
import org.apache.xml.security.c14n.Canonicalizer;
import org.w3c.dom.Document;
-public class SOAPUtil
+public final class SOAPUtil
{
+ private SOAPUtil()
+ {
+ }
/**
* Convert a DOM Document into a soap message.
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/wssec/WSSecAuthNComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/wssec/WSSecAuthNComponent.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/authn/wssec/WSSecAuthNComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -126,7 +126,8 @@
if (isRequiredAuthN() && messageTypesAuthN.contains(messageType)) {
SecurityToken st = new
SecurityToken(SecTokenManagerFactory.getDefaultSecTokenManager());
if (!st.hasSecTokenInRequest()) {
- throw new PerfSONARException("error.authn.not_sectoken",
"WSSecAuthNComponent: It has not sent any Security Token");
+ throw new PerfSONARException("error.authn.not_sectoken",
+ "WSSecAuthNComponent: It has not sent any Security
Token");
}
st.setSecTokenFromRequest();
AuthNRequest authnReq = new AuthNRequest(st);
@@ -156,7 +157,8 @@
authr = true;
SecurityToken st = new
SecurityToken(SecTokenManagerFactory.getDefaultSecTokenManager());
if (!st.hasSecTokenInRequest()) {
- throw new PerfSONARException("error.authn.not_sectoken",
"WSSecAuthNComponent: It has not sent any Security Token");
+ throw new PerfSONARException("error.authn.not_sectoken",
+ "WSSecAuthNComponent: It has not sent any Security
Token");
}
st.setSecTokenFromRequest();
AuthRRequest authrReq = new AuthRRequest(st, messageType);
@@ -167,7 +169,8 @@
try {
authrReq.setSubject(SecTokenSOAPManager.getSubject(st));
} catch (Exception e) {
- throw new PerfSONARException("error.authn.not_sectoken",
"WSSecAuthNComponent: Cannot get authR data from the Security Token");
+ throw new PerfSONARException("error.authn.not_sectoken",
+ "WSSecAuthNComponent: Cannot get authR data from the
Security Token");
}
AADispatchProtocol prot =
AADispatchProtocolFactory.getDefaultAADispatchProtocol();
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/ConfigurationComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,24 +7,20 @@
/**
* Interface contains common functionality for all implementation
- * of Configuration Components
+ * of Configuration Components.
*
* @author Maciej Glowiak
*/
public interface ConfigurationComponent
{
-
-
/**
- * Operation which provides access to individual property
+ * Operation which provides access to individual property.
*
* @param name of the parameter
* @return String containing value/s for the parameter
* @throws PerfSONARException when property couldn't be read
*/
- public String getProperty(String name) throws PerfSONARException;
+ String getProperty(String name) throws PerfSONARException;
- public Properties getProperties() throws PerfSONARException;
-
-
-} //ConfigurationComponent
\ No newline at end of file
+ Properties getProperties() throws PerfSONARException;
+} //ConfigurationComponent
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/configuration/properties/PropertiesConfigurationComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -11,13 +11,12 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Class which reads configurations from a properties file
+ * Class which reads configurations from a properties file.
*
* @author loukik
* @author Maciej Glowiak
*/
-public class PropertiesConfigurationComponent
- implements AuxiliaryComponent, ConfigurationComponent
+public class PropertiesConfigurationComponent implements AuxiliaryComponent,
ConfigurationComponent
{
private final Logger logger =
Logger.getLogger(PropertiesConfigurationComponent.class.getName());
@@ -25,17 +24,17 @@
// ---------------------------------- class fields
/**
- * Component Name
+ * Component Name.
*/
private String componentName = null;
/**
- * Properties
+ * Properties.
*/
private Properties properties = null;
/**
- * File with properties
+ * File with properties.
*/
private File file = null;
@@ -47,11 +46,11 @@
file =
AuxiliaryComponentManager.lookupFile("/perfsonar/conf/service.properties");
if (file == null) {
- logger.severe("PropertiesConfigurationComponent.initComponent:" +
- " Missing or unable to locate service.properties file.
Cannot initialise PropertiesConfigurationComponent.");
+ 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.");
+ 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
@@ -63,7 +62,7 @@
/**
- * Operation which provides all the properties read from the file
+ * Operation which provides all the properties read from the file.
*
* @return Properties - static object containing all the properties
* in the property file
@@ -78,7 +77,7 @@
/**
* Operation which provides access to individual properties read
- * from the property file
+ * from the property file.
*
* @param name of the parameter
* @return String containing value/s for the parameter
@@ -88,17 +87,14 @@
public String getProperty(String name) throws PerfSONARException
{
if (getProperties() == null) {
- throw new PerfSONARException(
- "PropertiesConfigurationComponent.getProperty: "
- + "PropertiesConfigurationComponent wasn't initialised
correctly, can't retrieve."
- );
+ throw new
PerfSONARException("PropertiesConfigurationComponent.getProperty: "
+ + "PropertiesConfigurationComponent wasn't initialised
correctly, can't retrieve.");
}
String property = properties.getProperty(name);
if (property == null) {
throw new PerfSONARException(
- "PropertiesConfigurationComponent.getProperty: "
- + "Requested Param: " + name + "not found");
+ "PropertiesConfigurationComponent.getProperty: " +
"Requested Param: " + name + "not found");
}
return property;
@@ -123,7 +119,7 @@
/**
* Operation which loads configuration
- * from a property file
+ * from a property file.
*/
void loadConfiguration() throws PerfSONARException
{
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/LoggerComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,52 +2,44 @@
/**
* Interface contains common methods for all
- * Configuration Components
+ * Configuration Components.
*
* @author Maciej Glowiak
*/
public interface LoggerComponent
{
-
-
/**
* Logs a message with debug log level.
*
* @param message log this message
*/
- public abstract void debug(String message);
+ void debug(String message);
-
/**
* Logs a message with info log level.
*
* @param message log this message
*/
- public abstract void info(String message);
+ void info(String message);
-
/**
* Logs a message with warn log level.
*
* @param message log this message
*/
- public abstract void warn(String message);
+ void warn(String message);
-
/**
* Logs a message with error log level.
*
* @param message log this message
*/
- public abstract void error(String message);
+ void error(String message);
-
/**
* Logs a message with fatal log level.
*
* @param message log this message
*/
- public abstract void fatal(String message);
-
-
-} //LoggerComponent
\ No newline at end of file
+ void fatal(String message);
+} //LoggerComponent
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/logger/log4j/Log4jLoggerComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -18,8 +18,7 @@
* @author Roman Lapacz
* @author Maciej Glowiak
*/
-public class Log4jLoggerComponent
- implements AuxiliaryComponent, LoggerComponent
+public class Log4jLoggerComponent implements AuxiliaryComponent,
LoggerComponent
{
@@ -28,7 +27,7 @@
// ---------------------------------- class fields
/**
- * Component Name
+ * Component Name.
*/
private String componentName = null;
@@ -38,7 +37,7 @@
private Logger errorLog = null;
private Logger fatalLog = null;
- ConfigurationComponent configuration;
+ private ConfigurationComponent configuration;
// ---------------------------------- constructors
@@ -59,7 +58,8 @@
errorLog = Logger.getLogger("sonar-error");
fatalLog = Logger.getLogger("sonar-fatal");
- configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
+ configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(
+ ComponentNames.CONFIG);
String logconf =
configuration.getProperty("service.log.log4j.config");
File logConfiguration =
AuxiliaryComponentManager.lookupFile(logconf);
@@ -67,7 +67,9 @@
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.)");
+ 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.");
@@ -78,7 +80,7 @@
/**
- * Sets log4j congiguration file
+ * Sets log4j congiguration file.
*
* @param configFile pathname
*/
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/mapping/ExpressionMapping.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -42,7 +42,7 @@
/**
* Reads configuration mapping from file given as
- * component.ComponentName.mapping_file property
+ * component.ComponentName.mapping_file property.
*/
@Override
public void initComponent() throws PerfSONARException
@@ -97,7 +97,7 @@
/**
- * Return mapping with applied replacements as Map
+ * Return mapping with applied replacements as Map.
*/
public String getMapping(String mappingName, Map<String, String>
replacements)
{
@@ -114,7 +114,7 @@
}
/**
- * Return mapping without any replacements
+ * Return mapping without any replacements.
*/
public String getMapping(String mappingName)
{
@@ -125,7 +125,7 @@
/**
- * Replace mapping with one replacement
+ * Replace mapping with one replacement.
*/
public String getMapping(
String mappingName,
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageHandler.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,7 +17,7 @@
/**
* Message Handler for scheduler which extends nmwg handler by adding the
- * capability to retrieve element objects and not just complete message
object
+ * capability to retrieve element objects and not just complete message
object.
*
* @author loukik
* @author Roman
@@ -44,7 +44,7 @@
// ------------------------------------ public methods
/**
- * Returns an element object for the given name
+ * Returns an element object for the given name.
*
* @param elementName object of type String containing the given name
*/
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/ScheduleMessageParser.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -50,16 +50,16 @@
public static final boolean DEFAULT_NAMESPACE_PREFIXES = true;
/**
- * Constructor which initializes loggers, configuration components and
handlers
+ * 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);
+ configurationComponent = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(
+ ComponentNames.CONFIG);
handler = new ScheduleMessageHandler();
}
@@ -68,7 +68,7 @@
// ------------------------------------ public methods
/**
- * Parses xml in a document in order to convert it into a message object
+ * 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
@@ -109,7 +109,7 @@
/**
- * Parses xml present in a string object in order to convert it into a
message object
+ * 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
@@ -135,7 +135,7 @@
}
/**
- * Parses xml presented as an input source
+ * Parses xml presented as an input source.
*
* @param inputSource object of type InputSource containing xml
* @throws PerfSONARException
@@ -213,15 +213,13 @@
}
/**
- * Returns element object for the given name
+ * 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/Scheduler.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -53,19 +53,21 @@
logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
- configurationComponent = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
+ 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");
+ 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",
- "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());
+ "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());
}
@@ -112,17 +114,12 @@
@Override
public void run()
{
-
while (working) { //infinite loop
try {
-
-
Thread.sleep(2000);
-
} catch (InterruptedException e) {
logger.info("SCHEDULER: sleep error");
}
-
}
}
@@ -131,7 +128,6 @@
public void readSchedules(String scheduleSeconds) throws
PerfSONARException
{
-
logger.debug("Scheduler.readSchedules: Scheduler has been woken up
to read schedules");
String xmlDbURL;
@@ -144,113 +140,94 @@
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 " +
- "stored in the xml database. Please configure
service.properties file " +
- "with the following properties: " +
- "Scheduler.Database.XML.location = URL for accessing xml
database, " +
- "Scheduler.Database.XML.login.username = Username for
accessing database, " +
- "Scheduler.Database.XML.login.password = Password for
accessing database, " +
- "Scheduler.Database.XML.community = Community under which
schedule resource " +
- "should be looked up");
-
+ logger.fatal("Scheduler.readSchedules: Scheduler is unable to "
+ + "read configuration information required to
connect to "
+ + "an xml database. Scheduler cannot gather
schedules which are "
+ + "stored in the xml database. Please configure
service.properties file "
+ + "with the following properties: "
+ + "Scheduler.Database.XML.location = URL for
accessing xml database, "
+ + "Scheduler.Database.XML.login.username =
Username for accessing database, "
+ + "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 " +
- "gather schedules which are stored in the xml database. " +
- "XML location property is missing. Please make sure " +
- "service.properties file contains value for the property: " +
- "Scheduler.Database.XML.location");
+ logger.fatal("Scheduler.readSchedules: Scheduler is unable to "
+ + "read configuration information from
service.properties file "
+ + "required to connect to an xml database.
Scheduler cannot "
+ + "gather schedules which are stored in the xml
database. "
+ + "XML location property is missing. Please
make sure "
+ + "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 " +
- "gather schedules which are stored in the xml database. " +
- "Username to connect to the database is missing. " +
- "Please make sure service.properties file contains value " +
- "for the property: Scheduler.Database.XML.login.username");
+ logger.fatal("Scheduler.readSchedules: Scheduler is unable to "
+ + "read configuration information from
service.properties file "
+ + "required to connect to an xml database.
Scheduler cannot "
+ + "gather schedules which are stored in the xml
database. "
+ + "Username to connect to the database is
missing. "
+ + "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 " +
- "gather schedules which are stored in the xml database. " +
- "Password to be used to connect to the database is missing.
" +
- "Please make sure service.properties file contains value " +
- "for the property: Scheduler.Database.XML.login.password");
+ logger.fatal("Scheduler.readSchedules: Scheduler is unable to "
+ + "read configuration information from
service.properties file "
+ + "required to connect to an xml database.
Scheduler cannot "
+ + "gather schedules which are stored in the xml
database. "
+ + "Password to be used to connect to the
database is missing. "
+ + "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 " +
- "gather schedules which are stored in the xml database. " +
- "Community info in which schedule information is stored is "
+
- "missing. Please make sure service.properties file contains
value " +
- "for the property: Scheduler.Database.XML.community");
+ logger.fatal("Scheduler.readSchedules: Scheduler is unable to "
+ + "read configuration information from
service.properties file "
+ + "required to connect to an xml database.
Scheduler cannot "
+ + "gather schedules which are stored in the xml
database. "
+ + "Community info in which schedule information
is stored is "
+ + "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";
+ 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);
- 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");
+ 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) {
-
try {
parser.parse(scheduleResult);
Metadata metadataElement = (Metadata)
parser.getElement("metadata");
@@ -258,60 +235,49 @@
String metadataIdRef = subjectElement.getMetadataIdRef();
if (metadataIdRef == null ||
metadataIdRef.equalsIgnoreCase("")) {
- logger.error("Scheduler.readSchedules: Corrupt entry
found in the " +
- "list of schedules to be executed. This entry, " +
- "with metadata id=" + metadataElement.getId() + "
does not" +
- "refer to any metadata chain that should be
executed");
+ logger.error("Scheduler.readSchedules: Corrupt entry
found in the "
+ + "list of schedules to be executed.
This entry, "
+ + "with metadata id=" +
metadataElement.getId() + " does not"
+ + "refer to any metadata chain that
should be executed");
throw new
PerfSONARException("error.common.scheduler.init",
- "Scheduler: Corrupt entry found in the " +
- "list of schedules to be executed. Metadata
reference missing " +
- "in metadata element" + metadataElement.getId());
-
+ "Scheduler: Corrupt entry
found in the "
+ + "list of schedules to
be executed. Metadata reference missing "
+ + "in metadata element"
+ metadataElement.getId());
}
metadataIdVector.add(metadataIdRef);
} catch (Exception e) {
- logger.error("Scheduler.readSchedules: Could not execute all
schedules: " +
- "Encountered the following error: " + e.getMessage());
-
+ logger.error("Scheduler.readSchedules: Could not execute all
schedules: "
+ + "Encountered the following error: " +
e.getMessage());
}
-
-
}
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]);
- logger.debug("Scheduler.readSchedules: Schedule metadata points
" +
- "to a metadata with id: " + leafMetadataIds[itr]);
-
- String queryForLeafMetadataContent =
-
"/*:message/*:metadata[@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");
-
+ 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.");
+ 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.");
}
continue;
}
@@ -322,7 +288,6 @@
String nextNodeIdRef;
boolean moreNodesInChain;
-
try {
parser.parse(metadataLeafResults[0]);
@@ -333,43 +298,37 @@
if (!(metadataIdRef == null ||
metadataIdRef.equalsIgnoreCase(""))) {
nextNodeIdRef = metadataIdRef;
moreNodesInChain = true;
-
} else {
nextNodeIdRef = null;
moreNodesInChain = false;
-
}
-
} catch (Exception e) {
- logger.error("Scheduler.readSchedules: Unexpected exception
" +
- "caught while parsing schedule entry. Message: " +
e.getMessage() +
- " Schedule entry is corrupt at metadata with id:" +
leafMetadataIds[itr]);
+ logger.error("Scheduler.readSchedules: Unexpected exception "
+ + "caught while parsing schedule entry.
Message: " + e.getMessage()
+ + " Schedule entry is corrupt at metadata
with id:" + leafMetadataIds[itr]);
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");
+ 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");
+ 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");
}
errorInChain = true;
@@ -386,24 +345,20 @@
metadataIdRef = subjectElement.getMetadataIdRef();
if (!(metadataIdRef == null ||
metadataIdRef.equalsIgnoreCase(""))) {
-
nextNodeIdRef = metadataIdRef;
moreNodesInChain = true;
// System.out.println("next in
chain:*"+metadataIdRef+"*");
-
} else {
nextNodeIdRef = null;
moreNodesInChain = false;
//System.out.println("end of chain");
}
-
} catch (Exception e) {
- logger.error("Scheduler.readSchedules: Unexpected
Exception " +
- "caught while parsing schedule entry. " +
- "Schedule entry is corrupt at metadata with id:
" + nextNodeIdRef);
+ logger.error("Scheduler.readSchedules: Unexpected
Exception "
+ + "caught while parsing schedule
entry. "
+ + "Schedule entry is corrupt at
metadata with id: " + nextNodeIdRef);
errorInChain = true;
break;
-
}
String[] newScheduleChain = new
String[scheduleChain.length + 1];
@@ -414,7 +369,6 @@
scheduleChain = newScheduleChain;
scheduleChain[0] = nextMetadataResults[0];
-
} else {
moreNodesInChain = false;
}
@@ -423,7 +377,6 @@
break;
}
-
}
if (errorInChain) {
continue;
@@ -435,7 +388,6 @@
Metadata[] scheduleMetadataChain = new
Metadata[scheduleChain.length];
for (int i = 0; i < scheduleChain.length; i++) {
-
parser.parse(scheduleChain[i]);
Metadata metadataElement = (Metadata)
parser.getElement("metadata");
@@ -453,12 +405,10 @@
String eventTypeString = eventType.getEventType();
if (eventTypeString == null || eventTypeString.equals(" ")) {
-
- logger.error("Scheduler: Error in schedule entry. " +
- "The metadata element with Id: "
- + scheduleMetadataChain[0].getId() +
- "does not have an event type element. " +
- "Scheduler cannot determine what to do with it");
+ logger.error("Scheduler: Error in schedule entry. "
+ + "The metadata element with Id: " +
scheduleMetadataChain[0].getId()
+ + "does not have an event type element. "
+ + "Scheduler cannot determine what to do
with it");
continue;
}
@@ -469,92 +419,76 @@
// TODO: do nothing here?
}
- if (schedulerActionType != null
- && (!schedulerActionType.equalsIgnoreCase("GENERIC"))
- && (!schedulerActionType.equalsIgnoreCase
-
("net.geant2.monitoring.nms.service.commons.auxiliary.GenericSchedulerAction")))
{
+ 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);
+ 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 =
- (SchedulerAction) tempClass.newInstance();
+ schedulerActionClass = (SchedulerAction)
tempClass.newInstance();
schedulerActionClass.init(scheduleMetadataChain, itr);
-
} catch (ClassNotFoundException e1) {
-
- logger.error("Scheduler: The configured SchedulerAction"
+
- " class cannot be found. The event type " +
- "associated with this class is:" + eventTypeString +
" The" +
- " error message seen is" + e1.getMessage());
+ logger.error("Scheduler: The configured SchedulerAction"
+ + " class cannot be found. The event
type "
+ + "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());
+ 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());
-
+ 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" +
- "exception. The event type associated with this " +
- "class is:" + eventTypeString + " The error message
seen is" +
- e.getMessage());
+ logger.error("Scheduler: The configured SchedulerAction"
+ + " class cannot be invoked because of
unknown"
+ + "exception. The event type associated
with this "
+ + "class is:" + eventTypeString + " The
error message seen is"
+ + e.getMessage());
continue;
}
-
} else {
// use the generic schedulerAction
- logger.debug("Scheduler.readSchedules: Calling on
GenericSchedulerAction" +
- "for the metadata chain containing head with event type:
" +
- eventTypeString);
+ logger.debug("Scheduler.readSchedules: Calling on
GenericSchedulerAction"
+ + "for the metadata chain containing head
with event type: "
+ + eventTypeString);
SchedulerAction schedulerAction = new
GenericSchedulerAction();
schedulerAction.init(scheduleMetadataChain, itr);
}
-
-
- }// end of for(each leaf)
-
-
+ } // end of for(each leaf)
}
/**
- * This is only for test purposes
+ * This is only for test purposes.
*
* @param args
* @throws RequestException
* @throws DataFormatException
* @throws PerfSONARException
*/
- public static void main(String args[]) throws PerfSONARException
+ public static void main(String[] args) throws PerfSONARException
{
Scheduler tester = new Scheduler();
@@ -562,9 +496,4 @@
tester.readSchedules("60");
}
-
-
- // ---------------------------- Private Methods
-
-
-}
\ No newline at end of file
+}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/GenericSchedulerAction.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,22 +8,16 @@
/**
* Generic scheduler action which exploits the capabilities which are
- * already existing in the SchedulerAction abstract class
+ * already exsting 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/scheduler/actions/SchedulerAction.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -25,23 +25,22 @@
/**
- * Abstract SchedulerAction class
+ * Abstract SchedulerAction class.
*
* @author loukik
*/
public abstract class SchedulerAction implements Runnable
{
-
- // TODO: thread.stop is used here but has been deprecated. Need to
replace this.
+ // REVISIT: thread.stop is used here but has been deprecated. Need to
replace this.
// FIXME thread.stop is deathlock prone
// ----------------------------Member Variables
- public Metadata[] metadataList = null;
+ private Metadata[] metadataList = null;
- public Thread thread;
+ private Thread thread;
- int me = -1;
+ private int me = -1;
protected LoggerComponent logger;
@@ -51,7 +50,7 @@
// ----------------------------Constructor
/**
- * Initialize the Scheduler Action which forks off a thread
+ * Initialize the Scheduler Action which forks off a thread.
*
* @param messageList
* @param me
@@ -66,7 +65,8 @@
logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
- configurationComponent = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
+ configurationComponent = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(
+ ComponentNames.CONFIG);
this.thread = new Thread(this);
@@ -78,7 +78,7 @@
/**
- * Implemented interface method which calls on the performAction method
+ * Implemented interface method which calls on the performAction method.
*
* @see java.lang.Runnable#run()
*/
@@ -104,15 +104,12 @@
*/
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
// 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
@@ -125,8 +122,6 @@
// lets work on the given list in sequence
for (Metadata aMetadataList : metadataList) {
-
-
Message tempMessageObject = new Message();
Metadata metadataElement = aMetadataList;
@@ -137,29 +132,22 @@
tempMessageObject.setMetadata(metadataElement);
if (metadataElement != null) {
-
String metadataId = metadataElement.getId();
-
EventType eventType = metadataElement.getEventType();
-
String eventTypeString = eventType.getEventType();
// 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()) {
Data dataElementInInitialCollection = (Data)
initialDataIterator.next();
dataElementInInitialCollection.setMetadataIdRef(metadataId);
tempMessageObject.setData(dataElementInInitialCollection);
}
-
// use this as message object
requestMessage = tempMessageObject;
-
- // TODO: this process needs improvement
-
+ // REVISIT: this process needs improvement
String eventTypeClassName = eventTypeString.concat("_class");
String eventTypeInterfaceName =
eventTypeString.concat("_interface");
eventTypeClassName =
"SchedulerAction.".concat(eventTypeClassName);
@@ -167,51 +155,37 @@
String handlerClassName;
try {
-
handlerClassName =
configurationComponent.getProperty(eventTypeClassName);
-
} catch (Exception e) {
-
- logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " " +
- "has to be mapped to a classname (including package
name) in" +
- "the configuration file (service.properties file).
An error has occurred" +
- "while trying to read this mapping. Error message
is: " + e.getMessage());
-
+ logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has to be mapped to a classname
(including package name) in "
+ + "the configuration file
(service.properties file). An error has occurred "
+ + "while trying to read this mapping.
Error message is: " + e.getMessage());
return;
-
}
- logger.debug("SchedulerAction: Schedule entry contains " +
- "event type: " + eventTypeString + " .SchedulerAction
instructed" +
- " to use class: " + handlerClassName + " for this event
type");
+ logger.debug("SchedulerAction: Schedule entry contains "
+ + "event type: " + eventTypeString + "
.SchedulerAction instructed"
+ + " to use class: " + handlerClassName + "
for this event type");
-
Class<?> handlerClass;
try {
-
handlerClass = Class.forName(handlerClassName);
-
} catch (ClassNotFoundException e1) {
-
- logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " " +
- "has been configured to be handled by the " +
- "class: " + handlerClassName + ". But
SchedulerAction (generic) " +
- "cannot find this classname. Possible configuration
error. " +
- "Please provide the exact classname (including
package declaration) " +
- "in the configuration file (service.properties
file)");
-
+ logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has been configured to be handled by
the "
+ + "class: " + handlerClassName + ". But
SchedulerAction (generic) "
+ + "cannot find this classname. Possible
configuration error. "
+ + "Please provide the exact classname
(including package declaration) "
+ + "in the configuration file
(service.properties file)");
return;
-
} catch (Exception e) {
-
- logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " " +
- "has been configured to be handled by the " +
- "class: " + handlerClassName + ". But
SchedulerAction (generic) " +
- "is not able to use this class name for unknown
reasons. Exception " +
- "encountered: " + e.getMessage());
-
+ logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has been configured to be handled by
the "
+ + "class: " + handlerClassName + ". But
SchedulerAction (generic) "
+ + "is not able to use this class name
for unknown reasons. Exception "
+ + "encountered: " + e.getMessage());
return;
-
}
Class<?>[] interfaceClasses;
@@ -220,137 +194,100 @@
String matchedInterfaceClassName = null;
// this is a hack for rrd storage manager impl
-
-
if (interfaceClasses == null || interfaceClasses.length ==
0) {
-
- logger.debug("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " " +
- "has been configured to be handled by the " +
- "class: " + handlerClassName + " which does not
implement any interface.");
-
+ logger.debug("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has been configured to be handled by
the "
+ + "class: " + handlerClassName + "
which does not implement any interface.");
} else {
-
for (Class<?> interfaceClass : interfaceClasses) {
-
String interfaceClassName;
interfaceClassName = interfaceClass.getName();
-
if (interfaceClassName.equals(
- "net.geant2.monitoring.nms.service.commons." +
- "engine.ServiceEngine")) {
-
+ "net.geant2.monitoring.nms.service.commons." +
"engine.ServiceEngine")) {
matchedInterfaceClassName = interfaceClassName;
-
-
} else if (interfaceClassName.equals(
- "net.geant2.monitoring.nms.service.commons." +
- "measurementExecutor.MeasurementExecutor")) {
-
+ "net.geant2.monitoring.nms.service.commons." +
"measurementExecutor.MeasurementExecutor")) {
matchedInterfaceClassName = interfaceClassName;
-
} else if (interfaceClassName.equals(
- "net.geant2.monitoring.nms.service.commons." +
- "storageManager.StorageManager")) {
-
+ "net.geant2.monitoring.nms.service.commons." +
"storageManager.StorageManager")) {
matchedInterfaceClassName = interfaceClassName;
-
}
-
}
-
}
-
// I know that the following code could have been put in the
for loop. But I choose
// to purposely have it here
if (matchedInterfaceClassName == null) {
-
String interfaceNameFromProperties;
System.out.println("eventTypeInterfaceName: " +
eventTypeInterfaceName);
try {
- interfaceNameFromProperties =
-
this.configurationComponent.getProperty(eventTypeInterfaceName);
+ interfaceNameFromProperties =
this.configurationComponent.getProperty(eventTypeInterfaceName);
} catch (PerfSONARException e2) {
-
- logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " " +
- "has been configured to be handled by the " +
- "class: " + handlerClassName + ". But
SchedulerAction (generic) is not " +
- "configured to work with any of the interfaces
that it implements. " +
- "No configurations were found in the config file
either. " +
- "SchedulerAction cannot complete this schedule");
-
+ logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has been configured to be
handled by the "
+ + "class: " + handlerClassName + ".
But SchedulerAction (generic) is not "
+ + "configured to work with any of
the interfaces that it implements. "
+ + "No configurations were found in
the config file either. "
+ + "SchedulerAction cannot complete
this schedule");
return;
}
matchedInterfaceClassName = interfaceNameFromProperties;
}
- logger.debug("SchedulerAction: The eventType in schedule: "
+ eventTypeString +
- " is configured to be handled by class" +
handlerClassName + " which " +
- "implements the interface: " +
matchedInterfaceClassName);
+ logger.debug("SchedulerAction: The eventType in schedule: "
+ eventTypeString
+ + " is configured to be handled by class" +
handlerClassName + " which "
+ + "implements the interface: " +
matchedInterfaceClassName);
if (matchedInterfaceClassName != null) {
-
try {
-
Message replyMessage;
- if (matchedInterfaceClassName.equals
-
("net.geant2.monitoring.nms.service.commons.engine.ServiceEngine") ||
-
matchedInterfaceClassName.equalsIgnoreCase("ServiceEngine") ||
-
matchedInterfaceClassName.equalsIgnoreCase("Service Engine") ||
-
matchedInterfaceClassName.equalsIgnoreCase("Service_Engine")) {
-
- logger.debug("SchedulerAction: The event type: "
+ eventTypeString + " requires" +
- "contacting a ServiceEngine of type: " +
handlerClassName);
-
+ if (matchedInterfaceClassName.equals(
+
"net.geant2.monitoring.nms.service.commons.engine.ServiceEngine")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("ServiceEngine")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("Service Engine")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("Service_Engine")) {
+ logger.debug("SchedulerAction: The event type: "
+ eventTypeString + " requires "
+ + "contacting a ServiceEngine
of type: " + handlerClassName);
ServiceEngine serviceEngine = (ServiceEngine)
handlerClass.newInstance();
replyMessage =
serviceEngine.takeAction("MAKE_MEASUREMENT", requestMessage);
+ } else if (matchedInterfaceClassName.equals(
+
"net.geant2.monitoring.nms.service.commons.measurementExecutor.MeasurementExecutor")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("MeasurementExecutor")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("Measurement Executor")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("Measurement_Executor")) {
+ logger.debug("SchedulerAction: The event type: "
+ eventTypeString + " requires "
+ + "contacting a
MeasurementExecutor of type: " + handlerClassName);
-
- } else if (matchedInterfaceClassName.equals
-
("net.geant2.monitoring.nms.service.commons.measurementExecutor.MeasurementExecutor")
- ||
matchedInterfaceClassName.equalsIgnoreCase("MeasurementExecutor") ||
-
matchedInterfaceClassName.equalsIgnoreCase("Measurement Executor") ||
-
matchedInterfaceClassName.equalsIgnoreCase("Measurement_Executor")) {
-
- logger.debug("SchedulerAction: The event type: "
+ eventTypeString + " requires" +
- "contacting a MeasurementExecutor of type: "
+ handlerClassName);
-
MeasurementExecutor measurementExecutor =
(MeasurementExecutor) handlerClass.newInstance();
replyMessage =
measurementExecutor.makeMeasurement(requestMessage);
-
- } else if (matchedInterfaceClassName.equals
-
("net.geant2.monitoring.nms.service.commons.storageManager.StorageManager") ||
-
matchedInterfaceClassName.equalsIgnoreCase("StorageManager") ||
-
matchedInterfaceClassName.equalsIgnoreCase("Storage Manager") ||
-
matchedInterfaceClassName.equalsIgnoreCase("Storage_Manager")) {
-
- logger.debug("SchedulerAction: The event type: "
+ eventTypeString + " requires" +
- "contacting a StorageManager of type: " +
handlerClassName);
+ } else if (matchedInterfaceClassName.equals(
+
"net.geant2.monitoring.nms.service.commons.storageManager.StorageManager")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("StorageManager")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("Storage Manager")
+ ||
matchedInterfaceClassName.equalsIgnoreCase("Storage_Manager")) {
+ logger.debug("SchedulerAction: The event type: "
+ eventTypeString + " requires "
+ + "contacting a StorageManager
of type: " + handlerClassName);
StorageManager storageManager = (StorageManager)
handlerClass.newInstance();
replyMessage = (Message)
storageManager.store(requestMessage);
-
} else {
-
- logger.error("SchedulerAction: The event type
for a " +
- "scheduler: " + eventTypeString + "has been
configured " +
- "to be handled by an implementation of " +
- matchedInterfaceClassName + " But
SchedulerAction (generic) " +
- "does not know how to deal with this
interface.");
-
+ logger.error("SchedulerAction: The event type
for a "
+ + "scheduler: " +
eventTypeString + "has been configured "
+ + "to be handled by an
implementation of "
+ + matchedInterfaceClassName + "
But SchedulerAction (generic) "
+ + "does not know how to deal
with this interface.");
return;
-
}
if (replyMessage == null) {
- logger.error("SchedulerAction: A configured
schedule instructed scheduler " +
- "to contact " + handlerClass.getName() + ".
" +
- "But for the given input in the schedule,
the service engine returned a null message." +
- "SchedulerAction cannot continue with this
schedule.");
-
+ logger.error("SchedulerAction: A configured
schedule instructed scheduler "
+ + "to contact " +
handlerClass.getName() + ". "
+ + "But for the given input in
the schedule, "
+ + "the service engine returned
a null message."
+ + "SchedulerAction cannot
continue with this schedule.");
return;
}
@@ -358,16 +295,12 @@
Collection metadataCollection = metadataMap.values();
Iterator metadataIterator =
metadataCollection.iterator();
-
if (metadataCollection.isEmpty()) {
-
- logger.error("SchedulerAction: Due to unknown
errors," +
- "SchedulerAction was unable to create a
message object " +
- "for the given Schedule. Metadata for such a
message couldn't " +
- "be determined.");
-
+ logger.error("SchedulerAction: Due to unknown
errors,"
+ + "SchedulerAction was unable
to create a message object "
+ + "for the given Schedule.
Metadata for such a message couldn't "
+ + "be determined.");
return;
-
}
String metadataIdref = null;
@@ -380,7 +313,6 @@
// set the request message for the next leg (if any).
// change its datablock into a datablock got from
the reply
-
requestMessage.clearData();
Map dataMap = replyMessage.getDataMap();
@@ -389,10 +321,8 @@
Iterator itr = dataCollection.iterator();
if (!(dataCollection.isEmpty())) {
-
int dataCount = 1;
while (itr.hasNext()) {
-
Data readDataElement = (Data) itr.next();
System.out.println("Data got from leg
contains: " + readDataElement);
readDataElement.setMetadataIdRef(metadataIdref);
@@ -400,48 +330,40 @@
requestMessage.setData(readDataElement);
dataCount++;
}
-
} else {
- logger.debug("SchedulerAction: A configured
schedule instructed scheduler " +
- "to contact " + handlerClass.getName() + ".
" +
- "But for the given input in the schedule,
the service engine returned no " +
- "data elements. A blank data element will be
passed on to the next part of " +
- "this schedule (if any)");
+ logger.debug("SchedulerAction: A configured
schedule instructed scheduler "
+ + "to contact " +
handlerClass.getName() + ". "
+ + "But for the given input in
the schedule, "
+ + "the service engine returned
no "
+ + "data elements. A blank data
element will be passed on to the next "
+ + "part of this schedule (if
any)");
Data blankDataElement = new Data();
blankDataElement.setId("data1");
blankDataElement.setMetadataIdRef("");
-
-
}
-
} catch (InstantiationException e2) {
-
- logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " " +
- "has been configured to be handled by the " +
- "class: " + handlerClassName + ". But
SchedulerAction " +
- "(generic) is unable to " +
- "instantiate this class. InstantiationException
" +
- "was encoutered :" + e2.getMessage());
+ logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has been configured to be
handled by the "
+ + "class: " + handlerClassName + ".
But SchedulerAction "
+ + "(generic) is unable to "
+ + "instantiate this class.
InstantiationException "
+ + "was encoutered :" +
e2.getMessage());
return;
-
} catch (IllegalAccessException e2) {
-
- logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " " +
- "has been configured to be handled by the " +
- "class: " + handlerClassName + ". But
SchedulerAction " +
- "(generic) is unable to " +
- "instantiate this class. IllegalAccessException
" +
- "was encoutered :" + e2.getMessage());
+ logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has been configured to be
handled by the "
+ + "class: " + handlerClassName + ".
But SchedulerAction "
+ + "(generic) is unable to "
+ + "instantiate this class.
IllegalAccessException "
+ + "was encoutered :" +
e2.getMessage());
return;
-
} catch (PerfSONARException 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 System Exception:" +
e.getMessage());
+ logger.error("SchedulerAction: The eventType in the
schedule: " + eventTypeString + " "
+ + "has been configured to be
handled by the "
+ + "class: " + handlerClassName + ".
But SchedulerAction "
+ + "(generic) encountered a System
Exception:" + e.getMessage());
return;
-
}
//catch (RequestException e) {
// logger.error("SchedulerAction: The eventType in
the schedule: "+eventTypeString+" "+
@@ -466,31 +388,21 @@
// }
//
}
-
-
}
-
-
} // end of for
+ } // end of performAction
-
- }// 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/Scheduler.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -19,7 +19,7 @@
/**
- * This class provides the capability to run an action each N seconds
+ * This class provides the capability to run an action each N seconds.
*
* @author Maciej Glowiak
* @author Uros Juvan (changed interface being implemented from
@@ -28,6 +28,7 @@
*/
public class Scheduler extends Thread implements AuxiliaryThreadedComponent
{
+ public static final int DEFALULT_WAKEUP_INTERVAL = 10000;
// ----------------------------Member Variables
@@ -42,7 +43,7 @@
private boolean paused = false;
- private int wakeupInterval = 10000; //milliseconds
+ private int wakeupInterval = DEFALULT_WAKEUP_INTERVAL;
private final Set<SchedulerTask> tasks = Collections.synchronizedSet(new
HashSet<SchedulerTask>());
@@ -75,8 +76,8 @@
} catch (PerfSONARException e) {
- String m = "Cannot initialize components: " +
- "logger and configuration " + e.getMessage();
+ String m = "Cannot initialize components: "
+ + "logger and configuration " + e.getMessage();
throw new PerfSONARException("error.common.no_configuration", m);
@@ -90,33 +91,28 @@
/**
- * Checks if scheduler is active and working
+ * Checks if scheduler is active and working.
*
* @return
*/
public boolean isWorking()
{
-
return working;
-
}
/**
- * Stops scheduler permanently
+ * Stops scheduler permanently.
*/
public void stopScheduler()
{
-
this.working = false;
-
}
@Override
public void run()
{
-
paused = false;
while (working) { //infinite loop until stopScheduler()
@@ -155,52 +151,36 @@
public int getWakeupInterval()
{
-
return wakeupInterval;
-
}
-
public void setWakeupInterval(int wakeupInterval)
{
-
this.wakeupInterval = wakeupInterval;
-
}
-
@Override
public String getComponentName()
{
-
return componentName;
-
}
-
@Override
public void setComponentName(String name)
{
componentName = name;
}
-
public void addSchedulerTask(SchedulerTask t)
{
-
tasks.add(t);
-
}
-
public void addSchedulerTask(int interval, SchedulerAction action)
{
-
tasks.add(new SchedulerTask(interval, action));
-
}
-
/**
* Remove scheduler task specified by action.
*
@@ -208,26 +188,19 @@
*/
public void remSchedulerTask(SchedulerAction action)
{
-
// Interval is not important in remove
tasks.remove(new SchedulerTask(0, action));
-
}
-
// ---------------------------- Private Methods
-
public static void main(String[] a) throws PerfSONARException
{
-
new Scheduler().initComponent();
-
}
-
/**
- * Checks if scheduler is temporarly paused
+ * Checks if scheduler is temporarly paused.
*
* @return
*/
@@ -236,30 +209,23 @@
return paused;
}
-
/**
* Set scheduler paused. It'll be still working but won't be
- * scheduling and running tasks
+ * scheduling and running tasks.
*
* @param paused
*/
public void setPaused(boolean paused)
{
-
this.paused = paused;
-
}
/**
- * Stop the thread by calling stopScheduler
+ * 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerAction.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,13 +2,11 @@
/**
- * Interface that represents simple scheduler action
+ * Interface that represents simple scheduler action.
*
* @author Maciej Glowiak
*/
public interface SchedulerAction
{
-
- public void runAction();
-
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/components/simplescheduler/SchedulerTask.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -34,7 +34,7 @@
/**
- * This constructor is used, when some action should be run in the future
+ * This constructor is used, when some action should be run in the
future.
*
* @param interval interval for running action
* @param action action to run
@@ -54,7 +54,7 @@
// ------------------------------------------------ public methods
/**
- * Runs proper action as new Thread (only if time is out)
+ * Runs proper action as new Thread (only if time is out).
*/
public boolean runAction()
{
@@ -67,15 +67,17 @@
timestamp = currentTimestamp;
//run action in thread
- new Thread()
- {
- @Override
- public void run()
+ Thread thread =
+ new Thread()
{
- super.run();
- action.runAction();
- }
- }.start();
+ @Override
+ public void run()
+ {
+ super.run();
+ action.runAction();
+ }
+ };
+ thread.start();
//if action is being performed return true
return true;
@@ -103,7 +105,7 @@
/**
- * Get interval between two subsequence runs of action
+ * Get interval between two subsequence runs of action.
*
* @param interval
*/
@@ -116,7 +118,7 @@
/**
- * Set interval between two subsequence runs of action
+ * Set interval between two subsequence runs of action.
*
* @param interval
*/
@@ -129,7 +131,7 @@
/**
- * Returns timestamp of recent run of action
+ * Returns timestamp of recent run of action.
*
* @return
*/
@@ -144,7 +146,7 @@
/**
* Set timestamp of recent run of action on the beginning of epoch
* (1970), so action should be run immediately (in the next cycle of
- * Scheduler)
+ * Scheduler).
*/
public void resetTimestamp()
{
@@ -177,17 +179,13 @@
*/
public boolean equals(Object o)
{
-
if (o == null) {
return false;
}
- return o instanceof SchedulerTask ?
- (((SchedulerTask) o).action == null ?
- action == null :
- ((SchedulerTask) o).action.equals(action)) :
- false;
-
+ return (o instanceof SchedulerTask && (((SchedulerTask) o).action ==
null)
+ ? action == null
+ : ((SchedulerTask) o).action.equals(action));
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/exceptions/PerfSONARException.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -9,31 +9,21 @@
*/
public class PerfSONARException extends Exception
{
-
-
// ----------------------------------------------------- Constants
-
-
- /**
- * Serial ID
- */
private static final long serialVersionUID = 4352758945385997927L;
-
/**
- * Default result code, used if no result code was set
+ * Default result code, used if no result code was set.
*/
private static final String UNKNOWN_RESULT_CODE = "unknown";
// --------------------------------------------- Private variables
+ private String resultCode = UNKNOWN_RESULT_CODE;
+ private String resultDescription = "";
- String resultCode = UNKNOWN_RESULT_CODE;
- String resultDescription = "";
-
-
// -------------------------------------------------- Constructors
@@ -64,7 +54,7 @@
/**
- * PerfSONAR Exception - result code support
+ * PerfSONAR Exception - result code support.
*
* @param resultCode - textual result code
* @param message - textual result description (message)
@@ -79,7 +69,7 @@
/**
- * PerfSONAR Exception - result code support
+ * PerfSONAR Exception - result code support.
*
* @param resultCode - textual result code
* @param message - textual result description (message)
@@ -106,7 +96,7 @@
/**
- * Returns result code (or "unknown")
+ * Returns result code (or "unknown").
*/
public String getResultCode()
{
@@ -117,7 +107,7 @@
/**
- * Return result code description (or empty String)
+ * Return result code description (or empty String).
*/
public String getResultDescription()
{
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/nmwg/owamp/Parameters.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -40,67 +40,67 @@
public Parameter getParameterByName(String name)
{
if (!(name.isEmpty())) {
- if (name.equals("count") ||
- name.equals("dscp") ||
- name.equals("phb") ||
- name.equals("wait") ||
- name.equals("timeOut") ||
- name.equals("padding") ||
- name.equals("endDelay") ||
- name.equals("portRange") ||
- name.equals("size") ||
- name.equals("output") ||
- name.equals("direction")) {
+ if (name.equals("count")
+ || name.equals("dscp")
+ || name.equals("phb")
+ || name.equals("wait")
+ || name.equals("timeOut")
+ || name.equals("padding")
+ || name.equals("endDelay")
+ || name.equals("portRange")
+ || name.equals("size")
+ || name.equals("output")
+ || name.equals("direction")) {
Parameter p = (Parameter) parameterMap.get(name);
return (p);
} else {
- System.err.println("Error: " + getFileName() +
- " 'getParameterByName(String)' Unrecognized " +
- " parameter: " + name + ".");
+ System.err.println("Error: " + getFileName()
+ + " 'getParameterByName(String)'
Unrecognized "
+ + " parameter: " + name + ".");
return null;
}
} else {
- System.err.println("Error: " + getFileName() +
- " 'getParameterByName(String)' name cannont be nil.");
+ System.err.println("Error: " + getFileName()
+ + " 'getParameterByName(String)' name
cannont be nil.");
return null;
}
}
/**
- * Adds a parameter to the map
+ * Adds a parameter to the map.
*/
@Override
public void addParameter(Parameter newParameter)
{
if (newParameter != null) {
- if (newParameter.getParameterName().equals("count") ||
- newParameter.getParameterName().equals("dscp") ||
- newParameter.getParameterName().equals("phb") ||
- newParameter.getParameterName().equals("wait") ||
- newParameter.getParameterName().equals("timeOut") ||
- 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 (newParameter.getParameterName().equals("count")
+ || newParameter.getParameterName().equals("dscp")
+ || newParameter.getParameterName().equals("phb")
+ || newParameter.getParameterName().equals("wait")
+ || newParameter.getParameterName().equals("timeOut")
+ || 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() +
- " 'setParameter(Parameter)' Duplicate parameter" +
- " name: " + newParameter.getParameterName() +
- " for id: " + newParameter.getId());
+ System.err.println("Error: " + getFileName()
+ + " 'setParameter(Parameter)'
Duplicate parameter"
+ + " name: " +
newParameter.getParameterName()
+ + " for id: " +
newParameter.getId());
return;
}
parameterMap.put(newParameter.getParameterName(),
newParameter);
} else {
- System.err.println("Error: " + getFileName() +
- " 'addParameter(Parameter)' Unrecognized " +
- " parameter: " + newParameter.getParameterName() + ".");
+ System.err.println("Error: " + getFileName()
+ + " 'addParameter(Parameter)'
Unrecognized "
+ + " parameter: " +
newParameter.getParameterName() + ".");
return;
}
} else {
- System.err.println("Error: " + getFileName() +
- " 'addParameter(Paramter)' Parameter cannont be nil.");
+ System.err.println("Error: " + getFileName()
+ + " 'addParameter(Paramter)' Parameter
cannont be nil.");
return;
}
}
@@ -109,34 +109,33 @@
public void addParameter(String name, String value)
{
if (!(name.isEmpty()) && !(value.isEmpty())) {
- if (name.equals("count") ||
- name.equals("dscp") ||
- name.equals("phb") ||
- name.equals("wait") ||
- name.equals("timeOut") ||
- name.equals("padding") ||
- name.equals("endDelay") ||
- name.equals("portRange") ||
- name.equals("size") ||
- name.equals("output") ||
- name.equals("direction")) {
+ if (name.equals("count")
+ || name.equals("dscp")
+ || name.equals("phb")
+ || name.equals("wait")
+ || name.equals("timeOut")
+ || name.equals("padding")
+ || name.equals("endDelay")
+ || name.equals("portRange")
+ || name.equals("size")
+ || name.equals("output")
+ || name.equals("direction")) {
Parameter p = new Parameter();
p.setParameterName(name);
p.setParameterValue(value);
this.addParameter(p);
} else {
- System.err.println("Error: " + getFileName() +
- " 'addParameter(String, String)' Unrecognized " +
- " parameter: " + name + ".");
+ System.err.println("Error: " + getFileName()
+ + " 'addParameter(String, String)'
Unrecognized "
+ + " parameter: " + name + ".");
return;
}
} else {
- System.err.println("Error: " + getFileName() +
- " 'addParameter(String, String)' cannot have nil value" +
- " for name or value.");
+ 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-08 12:49:17 UTC (rev 6024)
+++ trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/MathUtil.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,21 +8,19 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Class providing Mathematical functions
+ * Class providing Mathematical functions.
*
* @author loukik
*/
public class MathUtil
{
-
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>
@@ -45,39 +43,29 @@
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);
-
+ 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");
-
+ 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>
@@ -87,7 +75,6 @@
*/
public long[] convertOctetsToBits(long[] octetValues) throws
PerfSONARException
{
-
if (octetValues == null) {
return null;
}
@@ -100,33 +87,23 @@
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);
-
+ 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");
-
+ 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-08 12:49:17 UTC (rev 6024)
+++ trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/NetUtil.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -6,26 +6,24 @@
package org.perfsonar.base.util;
/**
- * Class containing Network related utilities
+ * Class containing Network related utilities.
*
* @author loukik
*/
-public class NetUtil
+public final class NetUtil
{
- public NetUtil()
+ private NetUtil()
{
-
}
/**
- * Operation to check if a given IPv4 string is valid or not
+ * Operation to check if a given IPv4 string is valid or not.
*
* @param ipv4AddressString
* @return True if it is valid, False otherwise
*/
public static boolean validateIPv4Address(String ipv4AddressString)
{
-
String[] splitByDot;
splitByDot = ipv4AddressString.split("[.]+");
@@ -38,7 +36,7 @@
}
/**
- * Operation to check if a given IPv6 string is valid or not
+ * Operation to check if a given IPv6 string is valid or not.
*
* @param ipv6AddressString
* @return True if it is valid, False otherwise
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/StringBufferOutputStream.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -4,39 +4,31 @@
import java.io.OutputStream;
/**
- * StringBuffer OutputStream. Writes to given StringBuffer
+ * StringBuffer OutputStream. Writes to given StringBuffer.
*
* @author Maciej Glowiak
*/
public class StringBufferOutputStream extends OutputStream
{
-
-
/**
- * Local StringBuffer
+ * Local StringBuffer.
*/
private final StringBuffer sb;
-
/**
- * Constructor, needs to specify StringBuffer destination
+ * 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/TimeDateUtil.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -23,8 +23,11 @@
*
* @author romradz
*/
-public class TimeDateUtil
+public final class TimeDateUtil
{
+ private TimeDateUtil()
+ {
+ }
/**
* Returns unix time value.
@@ -54,7 +57,7 @@
return null;
}
- String unixTime = _getUnixTime(timeParemeter);
+ String unixTime = internalgetUnixTime(timeParemeter);
if (unixTime == null) {
unixTime = timeParemeter.getParameterValue();
}
@@ -63,7 +66,7 @@
}
- protected static String _getUnixTime(Parameter timeParemeter)
+ protected static String internalgetUnixTime(Parameter timeParemeter)
throws PerfSONARException
{
@@ -82,7 +85,7 @@
if (!subelement.getLocalName().equals("time")) {
throw new PerfSONARException(
"error.parameter",
- "TimeDateUtil._getUnixTime: wrong type of parameter; "
+ "TimeDateUtil.internalgetUnixTime: wrong type of parameter; "
+ "it should be time type");
}
@@ -105,7 +108,7 @@
} catch (Exception ex) {
throw new PerfSONARException(
"error.parameter",
- "TimeDateUtil._getUnixTime: ISO time coversion is wrong;
"
+ "TimeDateUtil.internalgetUnixTime: ISO time coversion is
wrong; "
+ ex.toString());
}
@@ -113,7 +116,7 @@
throw new PerfSONARException(
"error.parameter",
- "TimeDateUtil._getUnixTime: "
+ "TimeDateUtil.internalgetUnixTime: "
+ "Time type " + time.getType() + "is not supported");
}
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-08 12:49:17 UTC (rev 6024)
+++ trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/XMLUtils.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -36,13 +36,16 @@
/**
- * The class contains several methods for various text operations with the
XML
+ * The class contains several methods for various text operations with the
XML.
*
* @author Maciej Glowiak
* @author romradz (contributor)
*/
-public class XMLUtils
+public final class XMLUtils
{
+ private XMLUtils()
+ {
+ }
// --------------------------------------------------------------
constants
@@ -84,7 +87,7 @@
}
/**
- * Serialize org.w3c.document
+ * Serialize org.w3c.document.
*/
public static String serializeDOM(Document doc) throws Exception
{
@@ -102,7 +105,7 @@
/**
* Serialize schema element. It omits all comments, document type and XML
- * declaration, so can be used to generate part of XML document
+ * declaration, so can be used to generate part of XML document.
*
* @param element NMWG schema element
* @return XML document as String
@@ -110,7 +113,6 @@
public static String serializeXML(Element element)
throws PerfSONARException
{
-
OutputFormat outputFormat = new OutputFormat("XML", "UTF-8", true);
outputFormat.setIndent(1);
outputFormat.setIndenting(true);
@@ -124,22 +126,19 @@
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();
+ String m = "XMLUtils.serializeXML: error while serializing XML: "
+ + e.getMessage();
throw new PerfSONARException(m);
}
-
}
/**
- * Converts Message into DOM Document
+ * Converts Message into DOM Document.
*
* @param m message object
* @return Document
@@ -148,7 +147,6 @@
public static Document convertMessageToDOM(Message m)
throws PerfSONARException
{
-
try {
DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
@@ -160,20 +158,15 @@
} else {
return builtDoc;
}
-
} catch (Exception e) {
throw new PerfSONARException(
- "error.common.parse_error",
- "Cannot convert Message to DOM");
+ "error.common.parse_error", "Cannot convert Message to DOM");
}
-
}
-
public static Document convertMessageToDOM(String m)
throws PerfSONARException
{
-
try {
java.io.InputStream stream = new
ByteArrayInputStream(m.getBytes());
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
@@ -181,18 +174,15 @@
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(stream);
return doc;
-
} catch (Exception e) {
throw new PerfSONARException(
"error.common.parse_error",
"Cannot convert Message string to DOM");
}
-
}
-
/**
- * Converts Document containing message into NMWG Message object
+ * Converts Document containing message into NMWG Message object.
*
* @param request - message Document
* @param f - parser's mapping file
@@ -202,7 +192,6 @@
public static Message convertToMessage(Document request, String f)
throws PerfSONARException
{
-
XMLSerializer serializer = new XMLSerializer();
ByteArrayOutputStream boStream = new ByteArrayOutputStream();
@@ -212,7 +201,6 @@
Handler.setConfigFile(f);
try {
-
serializer.setOutputByteStream(boStream);
serializer.serialize(request);
@@ -237,16 +225,12 @@
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",
@@ -254,31 +238,26 @@
+ "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 =
((org.ggf.ns.nmwg.base.v2_0.MessageHandler)
handler).getMessage();
return message;
-
}
/**
- * Returns nmwg object with specific tag name parsed from xml string
+ * Returns nmwg object with specific tag name parsed from xml string.
*/
public static Map<String, Element> getElementFromXML(
String xmlPart, String tagName, String parserFile)
{
-
ElemHandler handler = parseNmwgXML(xmlPart, parserFile);
String[] tagNames = {tagName};
Map<String, Element> elements = handler.getElement(tagNames);
@@ -289,22 +268,18 @@
public static Map<String, Element> getElementFromXML(
String xmlPart, String[] tagNames, String parserFile)
{
-
ElemHandler handler = parseNmwgXML(xmlPart, parserFile);
Map<String, Element> elements = handler.getElement(tagNames);
return elements;
-
}
/**
- * Remove HTML/XML tags from string
+ * remove HTML/XML tags from string.
*/
public static String removeXMLTags(String xml)
{
-
return xml.replaceAll("\\<[^\\>]+\\>", "");
-
}
// --------------------------------------------------------- private
methods
@@ -312,16 +287,9 @@
public static ElemHandler parseNmwgXML(
String xmlPart, String parserFile)
{
-
-
- String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser";
- String NAMESPACES_FEATURE_ID =
"http://xml.org/sax/features/namespaces";
- String NAMESPACE_PREFIXES_FEATURE_ID =
"http://xml.org/sax/features/namespace-prefixes";
-
StringReader stringReader = new StringReader(xmlPart);
InputSource inputSource = new InputSource(stringReader);
-
ElemHandler handler = new ElemHandler();
Handler.setConfigFile(parserFile);
@@ -331,10 +299,8 @@
boolean namespacePrefixes = true;
if (parser == null) {
-
try {
parser =
XMLReaderFactory.createXMLReader(DEFAULT_PARSER_NAME);
-
} catch (Exception e) {
e.printStackTrace();
}
@@ -363,14 +329,11 @@
e.printStackTrace();
}
-
return handler;
-
}
public static String extractXMLTag(String str, String tag)
{
-
//trim from blank spaces
str = str.trim();
@@ -394,11 +357,10 @@
String substr = str.substring(indexStartTag2 + 1, indexEndTag1);
return substr;
-
}
/**
- * Extracts attribute value from string
+ * Extracts attribute value from string.
*
* @param a string
* @param attribute attribute name
@@ -408,7 +370,6 @@
String str,
String attribute)
{
-
try { //just in case of a RuntimeException
int ind1 = str.indexOf(attribute);
@@ -431,13 +392,12 @@
}
return null; //bad xml?
-
}
// ---------------------------------------------------------- XML Files
parsing
/**
- * Converts XML File into DOM Document
+ * Converts XML File into DOM Document.
*
* @param file xml file in system
* @return Document
@@ -445,14 +405,11 @@
*/
public static Document convertXMLFileToDom(String file) throws
PerfSONARException
{
-
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document dom;
try {
-
DocumentBuilder db = dbf.newDocumentBuilder();
dom = db.parse(file);
-
} catch (IOException e) {
throw new PerfSONARException("error.common.parse_error",
"IO exception: "
@@ -471,7 +428,7 @@
}
/**
- * Gets the internal elements of nodes with a specific tag
+ * Gets the internal elements of nodes with a specific tag.
*
* @param dom The document to get the elements from
* @param node The tag for the nodes
@@ -481,7 +438,6 @@
public static List<Map<String, String>> getNodeElementsFromDom(
Document dom, String node, List<String> elements)
{
-
List<Map<String, String>> elementsMapList = new
ArrayList<Map<String, String>>();
org.w3c.dom.Element root = dom.getDocumentElement();
@@ -501,7 +457,7 @@
}
/**
- * Auxiliar private method to get a text value from an Element
+ * Auxiliar private method to get a text value from an Element.
*
* @param element The element to get the value from
* @param node The tag of the node which value is wanted
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Constants.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -1,12 +1,12 @@
package org.perfsonar.base.util.iptrie;
/**
- * Summarization code
+ * Summarization code.
*
* @author swany
*/
public interface Constants
{
- public final static int MAX_KEY_LENGTH = 32;
+ int MAX_KEY_LENGTH = 32;
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/HelperClass.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,12 +2,6 @@
import java.util.ArrayList;
-/**
- * Summarization code
- *
- * @author swany
- */
-
public class HelperClass
{
// The purpose of the Helper class is to separate the code that is not
a part of the functionality of Trie.java,
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddress.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -3,7 +3,7 @@
import java.util.Arrays;
/**
- * Summarization code
+ * Summarization code.
*
* @author swany
*/
@@ -107,4 +107,4 @@
}
return ipAddress;
}
-}
\ No newline at end of file
+}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IPAddressConvertor.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -1,10 +1,5 @@
package org.perfsonar.base.util.iptrie;
-/**
- * Summarization code
- *
- * @author swany
- */
public class IPAddressConvertor
{
private final String ipAddress;
@@ -32,19 +27,19 @@
private String computeKey(String address) throws
InvalidIPAddressException
{
- StringBuilder key = new StringBuilder();
+ StringBuilder builder = new StringBuilder();
String[] splitAddress = address.split("\\.");
if (splitAddress.length == 4) {
for (String part : splitAddress) {
int addressPart = Integer.parseInt(part);
char ch = (char) addressPart;
- key.append(ch);
+ builder.append(ch);
if (!((addressPart >= 0) && (addressPart < 256))) {
throw new InvalidIPAddressException(MESSAGE);
}
}
}
- return key.toString();
+ return builder.toString();
}
public String getKey()
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/InvalidIPAddressException.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -1,11 +1,5 @@
package org.perfsonar.base.util.iptrie;
-/**
- * Summarization code
- *
- * @author swany
- */
-
@SuppressWarnings("serial")
public class InvalidIPAddressException extends Exception
{
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrie.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -5,19 +5,18 @@
/**
+ * This class wraps the base Trie with IP-specific semantics
+ * such as shifting the current keys into the correct position.
+ * For now, this will be created from a basic Trie containing
+ * IP information and will provide iterator functionality
+ *
* @author swany
- * This class wraps the base Trie with IP-specific semantics
- * such as shifting the current keys into the correct position.
- * For now, this will be created from a basic Trie containing
- * IP information and will provide iterator functionality
*/
public class IpTrie
{
-
-
private final Trie trie;
private final ArrayList<IpTrieNode> nodelist;
- IpTrieNode root;
+ private IpTrieNode root;
public IpTrie(Trie t)
{
@@ -28,7 +27,7 @@
}
/**
- * this method will walk the Trie and fill in IpTrieNodes
+ * this method will walk the Trie and fill in IpTrieNodes.
*/
public void updateNodelist()
{
@@ -79,9 +78,7 @@
public ArrayList<IpTrieNode> getInternalNodes()
{
ArrayList<IpTrieNode> alitn = new ArrayList<IpTrieNode>();
- Iterator<IpTrieNode> it = nodelist.iterator();
- for (IpTrieNode node; it.hasNext(); ) {
- node = it.next();
+ for (IpTrieNode node : nodelist) {
if (node.childZero != null) {
alitn.add(node);
}
@@ -92,9 +89,7 @@
public ArrayList<IpTrieNode> getSummaryNodes()
{
ArrayList<IpTrieNode> alitn = new ArrayList<IpTrieNode>();
- Iterator<IpTrieNode> it = nodelist.iterator();
- for (IpTrieNode node; it.hasNext(); ) {
- node = it.next();
+ for (IpTrieNode node : nodelist) {
// evaluate what to return
// here we say if the data pointer is null, but it
// has one child with data, then it is on the summary front
@@ -105,21 +100,20 @@
continue;
}
- if (node.trieNode.getData() == null &&
- (node.childZero.trieNode.getData() != null ||
- node.childOne.trieNode.getData() != null)) {
+ if (node.trieNode.getData() == null &&
(node.childZero.trieNode.getData() != null
+ || node.childOne.trieNode.getData() != null)) {
alitn.add(node);
}
}
return alitn;
}
- public ArrayList<IpTrieNode> getSummaryNodesHueristic_dumb()
+ public ArrayList<IpTrieNode> getSummaryNodesHueristicDumb()
{
ArrayList<IpTrieNode> alitn = new ArrayList<IpTrieNode>();
Iterator<IpTrieNode> it = nodelist.iterator();
- for (IpTrieNode node; it.hasNext(); ) {
- node = it.next();
+ while (it.hasNext()) {
+ IpTrieNode node = it.next();
// evaluate what to return
// here we say if the data pointer is null, but it
// has one child with data, then it is on the summary front
@@ -130,17 +124,16 @@
continue;
}
- if (node.trieNode.getData() == null &&
- (node.childZero.trieNode.getData() != null ||
- node.childOne.trieNode.getData() != null)) {
+ if (node.trieNode.getData() == null &&
(node.childZero.trieNode.getData() != null
+ || node.childOne.trieNode.getData() != null)) {
alitn.add(node);
}
}
ArrayList<IpTrieNode> alitn2 = new ArrayList<IpTrieNode>();
it = alitn.iterator();
- for (IpTrieNode node; it.hasNext(); ) {
- node = it.next();
+ while (it.hasNext()) {
+ IpTrieNode node = it.next();
if ((node.mask - node.parent.mask) > 2) {
alitn2.add(node);
}
@@ -149,8 +142,8 @@
//sanity check
long sum = 0;
it = alitn2.iterator();
- for (IpTrieNode node; it.hasNext(); ) {
- node = it.next();
+ while (it.hasNext()) {
+ IpTrieNode node = it.next();
System.out.println(node.addrString + " " + node.childCount);
sum += node.childCount;
}
@@ -175,9 +168,7 @@
//sanity check
long sum = 0;
- Iterator<IpTrieNode> it = alitn.iterator();
- for (IpTrieNode node; it.hasNext(); ) {
- node = it.next();
+ for (IpTrieNode node : alitn) {
sum += node.childCount;
if (node.mask == 32) {
sum++;
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/IpTrieNode.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,16 +8,19 @@
*/
public class IpTrieNode
{
- final long mask;
- long ipAddress;
- final long key;
- final String keyString;
- final String addrString;
- final TrieNode trieNode;
- IpTrieNode parent;
- IpTrieNode childZero, childOne;
- final long childCount;
+ private long ipAddress;
+ private final long key;
+ private final String keyString;
+ protected final long mask;
+ protected final String addrString;
+ protected final TrieNode trieNode;
+ protected final long childCount;
+
+ protected IpTrieNode parent;
+ protected IpTrieNode childZero;
+ protected IpTrieNode childOne;
+
public IpTrieNode(TrieNode tnode, long position, long currentKey)
{
HelperClass helper = new HelperClass();
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/StringBufferUtilities.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -5,13 +5,11 @@
import java.io.FileNotFoundException;
import java.io.IOException;
-/**
- * Summarization code
- *
- * @author swany
- */
-public class StringBufferUtilities
+public final class StringBufferUtilities
{
+ private StringBufferUtilities()
+ {
+ }
public static String getContents(String fileName)
{
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/SummarizeIpAddrs.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,33 +7,29 @@
import java.util.HashSet;
import java.util.Set;
-/**
- * Summarization code
- *
- * @author swany
- * @author mac
- */
-public class SummarizeIpAddrs
+public final class SummarizeIpAddrs
{
+ private SummarizeIpAddrs()
+ {
+ }
/**
* Main method, reads input set of IP addresses, returns summarized set
- * of IP addresses/masks
+ * of IP addresses/masks.
*
* @param ipAddresses
* @return set of strings containing IP addresses/masks
*/
public static HashSet<String> getSummary(Collection<String> ipAddresses)
{
+ final TrieNode root = new TrieNode(-1, Constants.MAX_KEY_LENGTH);
+ Trie trie = new Trie(root);
- final TrieNode ROOTNODE = new TrieNode(-1, Constants.MAX_KEY_LENGTH);
- Trie trie = new Trie(ROOTNODE);
-
for (String newIpAddr : ipAddresses) {
try {
IPAddress newIp = new IPAddress(newIpAddr);
long aLongValue = newIp.getAddrAsLong();
- trie = trie.Add(aLongValue, Constants.MAX_KEY_LENGTH, newIp);
+ trie = trie.add(aLongValue, Constants.MAX_KEY_LENGTH, newIp);
} catch (InvalidIPAddressException e) {
System.err.println("Ignoring address: " + newIpAddr);
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/Trie.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -6,11 +6,6 @@
import java.util.ArrayList;
import java.util.List;
-/**
- * Summarization code
- *
- * @author swany
- */
public class Trie
{
private int nodeCount;
@@ -39,21 +34,21 @@
return ((key >> (keyLength - 1)) & 1);
}
- public Trie Add(long key, long keyLength, Object data)
+ 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);
+ rootNode.getChildOne().add(key, keyLength, data);
} else {
rootNode.setChildOne(new TrieNode(key, keyLength));
rootNode.getChildOne().setData(data);
}
} else {
if (rootNode.getChildZero() != null) {
- rootNode.getChildZero().Add(key, keyLength, data);
+ rootNode.getChildZero().add(key, keyLength, data);
} else {
rootNode.setChildZero(new TrieNode(key, keyLength));
rootNode.getChildZero().setData(data);
@@ -62,48 +57,48 @@
return this;
}
- public boolean FindExactMatch(long key, long keyLength)
+ public boolean findExactMatch(long key, long keyLength)
{
if (firstDigit(key, keyLength) == 1) {
- return rootNode.getChildOne() != null &&
rootNode.getChildOne().FindExactMatch(key, keyLength);
+ return rootNode.getChildOne() != null &&
rootNode.getChildOne().findExactMatch(key, keyLength);
} else {
- return rootNode.getChildZero() != null &&
rootNode.getChildZero().FindExactMatch(key, keyLength);
+ return rootNode.getChildZero() != null &&
rootNode.getChildZero().findExactMatch(key, keyLength);
}
}
// public Trie Merge(Trie trie) {
- // List<Long> keys = trie.GetKeys();
+ // List<Long> keys = trie.getKeys();
// for (Long key : keys)
- // this.Add(Long.parseLong(key.toString()),
Constants.MAX_KEY_LENGTH);
+ // this.add(Long.parseLong(key.toString()),
Constants.MAX_KEY_LENGTH);
// return this;
// }
- public List<Long> GetKeys()
+ public List<Long> getKeys()
{
long key = 0;
long position = Constants.MAX_KEY_LENGTH;
List<Long> keys = new ArrayList<Long>();
if (rootNode.getChildZero() != null) {
- keys = GetKeys(keys, rootNode.getChildZero(), key, position);
+ keys = getKeys(keys, rootNode.getChildZero(), key, position);
}
if (rootNode.getChildOne() != null) {
- keys = GetKeys(keys, rootNode.getChildOne(), key, position);
+ keys = getKeys(keys, rootNode.getChildOne(), key, position);
}
return keys;
}
- private List<Long> GetKeys(List<Long> keys, TrieNode node, long key,
long position)
+ private List<Long> getKeys(List<Long> keys, TrieNode node, long key,
long position)
{
key = key | (node.getKey() << (position - node.getKeyLength()));
if (node.getChildZero() != null) {
- keys = GetKeys(keys, node.getChildZero(), key, position -
node.getKeyLength());
+ keys = getKeys(keys, node.getChildZero(), key, position -
node.getKeyLength());
}
if (node.getChildOne() != null) {
- keys = GetKeys(keys, node.getChildOne(), key, position -
node.getKeyLength());
+ keys = getKeys(keys, node.getChildOne(), key, position -
node.getKeyLength());
}
for (long i = 0; i < node.getValueCount(); i++) {
@@ -113,26 +108,26 @@
}
//returns the best match of keys for the given inputs
- public TrieNode FindBestMatch(long key, long keyLength)
+ public TrieNode findBestMatch(long key, long keyLength)
{
//implements the best match by digging all the way to the leaf based
on the key difference.
if (firstDigit(key, keyLength) == 1) {
if (rootNode.getChildOne() != null) {
- return rootNode.getChildOne().FindBestMatch(key, keyLength);
+ return rootNode.getChildOne().findBestMatch(key, keyLength);
} else {
return null;
}
} else if (rootNode.getChildZero() == null) {
return null;
}
- return rootNode.getChildZero().FindBestMatch(key, keyLength);
+ return rootNode.getChildZero().findBestMatch(key, keyLength);
}
- public boolean Equals(Trie trie)
+ public boolean equalsTrie(Trie trie)
{
if (trie != null && this.getCount() == trie.getCount()) {
- List<Long> list1 = this.GetKeys();
- List<Long> list2 = trie.GetKeys();
+ List<Long> list1 = this.getKeys();
+ List<Long> list2 = trie.getKeys();
for (int i = 0; i < this.nodeCount; i++) {
if (!list1.get(i).equals(list2.get(i))) {
@@ -149,20 +144,20 @@
return nodeCount;
}
- public boolean Remove(long key, long keyLength)
+ public boolean remove(long key, long keyLength)
{
TrieNode root;
root = firstDigit(key, keyLength) == 1 ? rootNode.getChildOne() :
rootNode.getChildZero();
- if (Remove(root, key, keyLength, 0)) {
+ if (remove(root, key, keyLength, 0)) {
nodeCount--;
return true;
}
return false;
}
- private boolean Remove(TrieNode node, long key, long keyLength, long
currentKeyLength)
+ private boolean remove(TrieNode node, long key, long keyLength, long
currentKeyLength)
{
boolean success;
@@ -188,7 +183,7 @@
child = node.getChildZero();
}
- success = ((child != null) && Remove(child, key, keyLength,
currentKeyLength));
+ success = ((child != null) && remove(child, key, keyLength,
currentKeyLength));
if (success && child.getValueCount() < 0) {
// check if we need to delete nodes as we go back along the path
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/util/iptrie/TrieNode.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -3,14 +3,8 @@
import java.io.PrintStream;
import java.util.ArrayList;
-/**
- * Summarization code
- *
- * @author swany
- */
public class TrieNode
{
-
private long key;
private long keyLength;
@@ -25,7 +19,7 @@
private TrieNode childOne;
- final HelperClass helper = new HelperClass();
+ private final HelperClass helper = new HelperClass();
public void incrementChildCount()
{
@@ -111,7 +105,7 @@
return new long[]{keyCommon, keyLengthCommon};
}
- public boolean Equals(TrieNode node)
+ public boolean equalsTrieNode(TrieNode node)
{
return node != null && (this.key == node.key && this.keyLength ==
node.keyLength);
}
@@ -147,7 +141,7 @@
this.data = data;
}
- public TrieNode Add(long key, long keyLength, Object data)
+ public TrieNode add(long key, long keyLength, Object data)
{
this.childCount++;
@@ -207,14 +201,14 @@
if (firstDigit(keyDiff, keyLengthDiff) == 1) {
if (this.childOne != null) {
- this.childOne.Add(keyDiff, keyLengthDiff, data);
+ this.childOne.add(keyDiff, keyLengthDiff, data);
} else {
this.childOne = new TrieNode(keyDiff, keyLengthDiff);
this.childOne.setData(data);
}
} else {
if (this.childZero != null) {
- this.childZero.Add(keyDiff, keyLengthDiff, data);
+ this.childZero.add(keyDiff, keyLengthDiff, data);
} else {
this.childZero = new TrieNode(keyDiff,
keyLengthDiff);
this.childZero.setData(data);
@@ -228,7 +222,7 @@
return this;
}
- public boolean FindExactMatch(long key, long keyLength)
+ public boolean findExactMatch(long key, long keyLength)
{
boolean matchStatus;
@@ -251,14 +245,14 @@
if (firstDigit(keyDiff, keyLengthDiff) == 1) {
if (childOne != null) {
- return childOne.FindExactMatch(keyDiff, keyLengthDiff);
+ return childOne.findExactMatch(keyDiff, keyLengthDiff);
} else {
matchStatus = false;
return matchStatus;
}
} else {
if (childZero != null) {
- return childZero.FindExactMatch(keyDiff, keyLengthDiff);
+ return childZero.findExactMatch(keyDiff, keyLengthDiff);
} else {
matchStatus = false;
return matchStatus;
@@ -267,7 +261,7 @@
}
}
- public TrieNode FindBestMatch(long key, long keyLength)
+ public TrieNode findBestMatch(long key, long keyLength)
{
// note : we don't need to worry about a node being a terminator
since at the end, we will either have
// - an exact match of the key, so the node will be a terminator
@@ -285,13 +279,13 @@
if (firstDigit(keyDiff, keyLengthDiff) == 1) {
if (childOne != null) {
- return childOne.FindBestMatch(keyDiff, keyLengthDiff);
+ return childOne.findBestMatch(keyDiff, keyLengthDiff);
} else {
return this;
}
} else {
if (childZero != null) {
- return childZero.FindBestMatch(keyDiff, keyLengthDiff);
+ return childZero.findBestMatch(keyDiff, keyLengthDiff);
} else {
return this;
}
@@ -299,15 +293,15 @@
}
}
- public TrieNode Clone()
+ public TrieNode cloneTrie()
{
TrieNode clone = new TrieNode(this.key, this.keyLength,
this.valueCount);
if (this.childZero != null) {
- clone.childZero = this.childZero.Clone();
+ clone.childZero = this.childZero.cloneTrie();
}
if (this.childOne != null) {
- clone.childOne = this.childOne.Clone();
+ clone.childOne = this.childOne.cloneTrie();
}
return clone;
@@ -317,19 +311,17 @@
{
TrieNode c0 = node.getChildZero();
TrieNode c1 = node.getChildOne();
- long key = node.getKey();
long mask = Constants.MAX_KEY_LENGTH - position;
String addrString;
- if (key == -1) {
+ if (node.getKey() == -1) {
addrString = "\"" + "0.0.0.0/0" + "\"";
currentKey = 0;
p.println(addrString + "
[shape=record,label=\"<f0>0.0.0.0/0|<f1>"
+ node.getChildCount()
+ "\"];" + " // COUNT: " + node.getChildCount());
} else {
- key = currentKey;
- String keyString = helper.longToIP(key);
+ String keyString = helper.longToIP(currentKey);
String unquotedAddrString = keyString + "/" + mask;
addrString = "\"" + keyString + "/" + mask + "\"";
if (node.getData() == null) {
@@ -373,15 +365,13 @@
{
TrieNode c0 = this.getChildZero();
TrieNode c1 = this.getChildOne();
- long key = this.getKey();
long mask = Constants.MAX_KEY_LENGTH - position;
TrieNode node = this;
- if (key == -1) {
+ if (this.getKey() == -1) {
currentKey = 0;
} else {
- key = currentKey;
- String keyString = helper.longToIP(key);
+ String keyString = helper.longToIP(currentKey);
String addrString = keyString + "/" + mask;
if (node.getData() == null) {
listOfNodes.add(addrString);
@@ -417,19 +407,15 @@
{
TrieNode c0 = this.getChildZero();
TrieNode c1 = this.getChildOne();
- long key = this.getKey();
long mask = Constants.MAX_KEY_LENGTH - position;
TrieNode node = this;
- if (key == -1) {
+ if (this.getKey() == -1) {
currentKey = 0;
} else {
- key = currentKey;
- String keyString = helper.longToIP(key);
+ String keyString = helper.longToIP(currentKey);
String addrString = keyString + "/" + mask;
- if (node.getData() == null &&
- (c0.getData() != null ||
- c1.getData() != null)) {
+ if (node.getData() == null && (c0.getData() != null ||
c1.getData() != null)) {
listOfNodes.add(addrString);
}
}
@@ -450,4 +436,4 @@
return listOfNodes;
}
-}
\ No newline at end of file
+}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/AxisClient.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -16,20 +16,20 @@
/**
* Simple client for AXIS Web Services connectivity
- * Just pass Document and address as arguments
+ * Just pass Document and address as arguments.
*
* @author Maciej Glowiak
*
*/
-public class AxisClient implements Client {
-
+public class AxisClient implements Client
+{
/* (non-Javadoc)
* @see org.perfsonar.client.axis.Client#sendRequest(java.lang.String,
org.w3c.dom.Document)
*/
@Override
public Document sendRequest(String endPoint, Document requestDocument)
- throws Exception {
-
+ throws Exception
+ {
// build a SOAPBodyElement from the document
SOAPBodyElement requestMessage =
new SOAPBodyElement(requestDocument.getDocumentElement());
@@ -41,9 +41,9 @@
// try {
// prepare to call - set service elements
Service service = new Service();
- Call call = (Call)service.createCall();
+ Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(endPoint));
- call.setOperationName(new
QName("http://soapinterop.org/","submit"));
+ call.setOperationName(new QName("http://soapinterop.org/",
"submit"));
// call on the end point
Object resultObject = call.invoke(new Object[] {requestMessage});
@@ -58,7 +58,7 @@
Document resultDocument;
- resultSBE= (SOAPBodyElement)((Vector)resultObject).get(0);
+ resultSBE = (SOAPBodyElement) ((Vector) resultObject).get(0);
// change it to document - here is where validity
// can be checked..
@@ -77,9 +77,9 @@
}
- public Message sendRequest(String endPoint, Message message, String
parserFile) throws Exception {
-
- // create document
+ public Message sendRequest(String endPoint, Message message, String
parserFile) throws Exception
+ {
+ // create document
DocumentBuilder builder = DocumentBuilderFactory.
newInstance().newDocumentBuilder();
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/Client.java
===================================================================
--- trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/Client.java
2012-10-08 12:49:17 UTC (rev 6024)
+++ trunk/perfsonar_base/src/main/java/org/perfsonar/client/axis/Client.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,9 +2,8 @@
import org.w3c.dom.Document;
-public interface Client {
-
- public abstract Document sendRequest(
+public interface Client
+{
+ Document sendRequest(
String serviceUrl, Document requestDocument) throws Exception;
-
-}
\ No newline at end of file
+}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNDataFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNDataFactory.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNDataFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -1,13 +1,18 @@
package org.perfsonar.client.base.authn;
-public class AuthNDataFactory {
- public static AuthNX509Data getDefaultAuthNX509Data() {
- AuthNX509Data data=new WSSAuthNX509Data();
- return data;
- }
+public final class AuthNDataFactory
+{
+ private AuthNDataFactory()
+ {
+ }
- public static AuthNSAMLData getDefaultAuthNSAMLData() {
- AuthNSAMLData data=new WSSAuthNSAMLData();
- return data;
- }
+ public static AuthNX509Data getDefaultAuthNX509Data()
+ {
+ return new WSSAuthNX509Data();
+ }
+
+ public static AuthNSAMLData getDefaultAuthNSAMLData()
+ {
+ return new WSSAuthNSAMLData();
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNSAMLData.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNSAMLData.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNSAMLData.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,7 +7,13 @@
import org.opensaml.SAMLAssertion;
import org.perfsonar.base.exceptions.PerfSONARException;
-public interface AuthNSAMLData {
- public Object addSAMLSTInMessage(Object message,SAMLAssertion
authAssertion,PrivateKey key,Collection<Certificate> certchain,String
cidPerfsonarResource,String cidPerfsonarClient) throws PerfSONARException;
- public Object addSAMLSTInMessage(Object message,SAMLAssertion
authAssertion,PrivateKey key,Collection<Certificate> certchain,String
cidPerfsonarResource,String cidPerfsonarClient,int ttl) throws
PerfSONARException;
+public interface AuthNSAMLData
+{
+ Object addSAMLSTInMessage(Object message, SAMLAssertion authAssertion,
PrivateKey key,
+ Collection<Certificate> certchain, String
cidPerfsonarResource,
+ String cidPerfsonarClient) throws
PerfSONARException;
+
+ Object addSAMLSTInMessage(Object message, SAMLAssertion authAssertion,
PrivateKey key,
+ Collection<Certificate> certchain, String
cidPerfsonarResource,
+ String cidPerfsonarClient, int ttl) throws
PerfSONARException;
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/AuthNX509Data.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -5,9 +5,14 @@
import org.perfsonar.base.exceptions.PerfSONARException;
-public interface AuthNX509Data {
- public Object addX509STInMessage(Object message,String
privKeyFile,String certFile) throws PerfSONARException;
- public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert) throws PerfSONARException;
- public Object addX509STInMessage(Object message,String
privKeyFile,String certFile,int ttl) throws PerfSONARException;
- public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert,int ttl) throws PerfSONARException;
+public interface AuthNX509Data
+{
+ Object addX509STInMessage(Object message, String privKeyFile, String
certFile) throws PerfSONARException;
+
+ Object addX509STInMessage(Object message, PrivateKey privateKey,
X509Certificate cert) throws PerfSONARException;
+
+ Object addX509STInMessage(Object message, String privKeyFile, String
certFile, int ttl) throws PerfSONARException;
+
+ Object addX509STInMessage(Object message, PrivateKey privateKey,
X509Certificate cert,
+ int ttl) throws PerfSONARException;
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNSAMLData.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNSAMLData.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNSAMLData.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -49,54 +49,59 @@
import org.w3c.dom.Element;
import org.w3c.dom.Text;
-public class WSSAuthNSAMLData implements AuthNSAMLData {
- private static final int defaultTtl=900;
+public class WSSAuthNSAMLData implements AuthNSAMLData
+{
+ private static final int DEFAULT_TTL = 900;
- private static final String sigalg =
XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1;
- private static final String digalg =
MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1;
+ private static final String SIGALG =
XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1;
+ private static final String DIGALG =
MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1;
- @Override
- public Object addSAMLSTInMessage(Object message,
- SAMLAssertion authAssertion, PrivateKey key,
Collection<Certificate> certchain,
- String cidPerfsonarResource, String
cidPerfsonarClient)
- throws PerfSONARException {
- return addSAMLSTInMessage(message, authAssertion, key,
certchain, cidPerfsonarResource, cidPerfsonarClient, defaultTtl);
- }
+ @Override
+ public Object addSAMLSTInMessage(Object message, SAMLAssertion
authAssertion, PrivateKey key,
+ Collection<Certificate> certchain,
String cidPerfsonarResource,
+ String cidPerfsonarClient) throws
PerfSONARException
+ {
+ return addSAMLSTInMessage(message, authAssertion, key, certchain,
cidPerfsonarResource, cidPerfsonarClient,
+ DEFAULT_TTL);
+ }
- @Override
- public Object addSAMLSTInMessage(Object message,
- SAMLAssertion authAssertion, PrivateKey key,
Collection<Certificate> certchain,
- String cidPerfsonarResource, String
cidPerfsonarClient, int ttl)
- throws PerfSONARException {
- if (!(message instanceof SOAPBodyElement)) {
- throw new
PerfSONARException("error.as.body","WSSAuthNSAMLData: the method
addSAMLSTInMessage requires a SOAPBodyElement object");
- }
+ @Override
+ public Object addSAMLSTInMessage(Object message, SAMLAssertion
authAssertion, PrivateKey key,
+ Collection<Certificate> certchain,
String cidPerfsonarResource,
+ String cidPerfsonarClient, int ttl)
throws PerfSONARException
+ {
+ if (!(message instanceof SOAPBodyElement)) {
+ throw new PerfSONARException("error.as.body",
+ "WSSAuthNSAMLData: the method
addSAMLSTInMessage requires a SOAPBodyElement "
+ + "object");
+ }
// add the security provider
- BouncyCastleProvider bcp = new BouncyCastleProvider();
+ BouncyCastleProvider bcp = new BouncyCastleProvider();
java.security.Security.addProvider(bcp);
// add the private and public keys
Crypto crypto;
try {
- crypto = new DynamicCrypto();
+ crypto = new DynamicCrypto();
} catch (CredentialException e) {
- throw new
PerfSONARException("error.as.crypto","WSSAuthNSAMLData: "+e.getMessage());
+ throw new PerfSONARException("error.as.crypto",
"WSSAuthNSAMLData: " + e.getMessage());
}
- KeyStore ks=crypto.getKeyStore();
+ KeyStore ks = crypto.getKeyStore();
try {
- Certificate[] certs = new Certificate[certchain.size()];
- certs = certchain.toArray(certs);
- ks.setKeyEntry("xmlsec", key, "security".toCharArray(),
certs);
+ Certificate[] certs = new Certificate[certchain.size()];
+ certs = certchain.toArray(certs);
+ ks.setKeyEntry("xmlsec", key, "security".toCharArray(), certs);
} catch (KeyStoreException e) {
- throw new PerfSONARException("error.as.crypto","WSSAuthNData:
"+e.getMessage());
+ throw new PerfSONARException("error.as.crypto", "WSSAuthNData: "
+ e.getMessage());
}
- SOAPBodyElement body=(SOAPBodyElement)message;
+ SOAPBodyElement body = (SOAPBodyElement) message;
SOAPEnvelope envelope = new SOAPEnvelope();
envelope.addBodyElement(body);
try {
- SAMLAssertion sa=getAssertionAsSecurityToken(authAssertion,
key, certchain, cidPerfsonarResource, cidPerfsonarClient);
+ SAMLAssertion sa = getAssertionAsSecurityToken(authAssertion,
key, certchain, cidPerfsonarResource,
+
cidPerfsonarClient);
Document doc = envelope.getAsDocument();
@@ -107,34 +112,28 @@
WSSecSignature sec509 = new WSSecSignature();
sec509.setUserInfo("xmlsec", "security");
SOAPConstants soapConstants =
WSSecurityUtil.getSOAPConstants(envelope.getAsDOM());
- Vector<WSEncryptionPart> parts = new
Vector<WSEncryptionPart>(1,1);
+ Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>(1,
1);
// Set up to use STRTransorm to sign the signature token
- WSEncryptionPart encP =
- new WSEncryptionPart(
- "STRTransform",
- soapConstants.getEnvelopeURI(),
- "Content");
+ WSEncryptionPart encP = new WSEncryptionPart("STRTransform",
soapConstants.getEnvelopeURI(), "Content");
parts.add(encP);
// Adding timestamp information
WSSecTimestamp timestamp = new WSSecTimestamp();
- timestamp.prepare(doc);
- adjustTime(timestamp,ttl/2);
- WSSecurityUtil.prependChildElement(doc, secHeader
- .getSecurityHeader(), timestamp.getElement(), false);
- parts.add(new WSEncryptionPart(timestamp.getId()));
+ timestamp.prepare(doc);
+ adjustTime(timestamp, ttl / 2);
+ WSSecurityUtil.prependChildElement(doc,
secHeader.getSecurityHeader(), timestamp.getElement(), false);
+ parts.add(new WSEncryptionPart(timestamp.getId()));
- // Adding the SAML assertion as a binary token
- BinarySecurity bs=new BinarySecurity(doc);
- bs.setID("SAML");
- bs.getElement().setAttributeNS(null, "ValueType",
"#SAMLBase64Binary");
-
((Text)bs.getElement().getFirstChild()).setData(Base64.encode(sa.toString().getBytes()));
- WSSecurityUtil.prependChildElement(doc, secHeader
- .getSecurityHeader(), bs.getElement(), false);
- parts.add(new WSEncryptionPart(bs.getID()));
+ // Adding the SAML assertion as a binary token
+ BinarySecurity bs = new BinarySecurity(doc);
+ bs.setID("SAML");
+ bs.getElement().setAttributeNS(null, "ValueType",
"#SAMLBase64Binary");
+ ((Text)
bs.getElement().getFirstChild()).setData(Base64.encode(sa.toString().getBytes()));
+ WSSecurityUtil.prependChildElement(doc,
secHeader.getSecurityHeader(), bs.getElement(), false);
+ parts.add(new WSEncryptionPart(bs.getID()));
- // Setting parts
+ // Setting parts
sec509.setParts(parts);
sec509.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
@@ -149,87 +148,90 @@
secHeader.insertSecurityHeader(doc);
WSSecTimestamp timestamp = new WSSecTimestamp();
- timestamp.prepare(doc);
-// sigParts.add(new WSEncryptionPart(timestamp.getId()));
+ timestamp.prepare(doc);
+// sigParts.add(new WSEncryptionPart(timestamp.getId()));
- WSSecSAMLToken samlToken = new WSSecSAMLToken();
+ WSSecSAMLToken samlToken = new WSSecSAMLToken();
Document signedDoc = samlToken.build(doc, , secHeader);
Message signedMsg = (Message) SOAPUtil.toSOAPMessage(signedDoc);
envelope = signedMsg.getSOAPEnvelope(); */
} catch (Exception e) {
- e.printStackTrace();
- throw new
PerfSONARException("error.as.signing","WSSAuthNSAMLData: "+e.getMessage());
+ e.printStackTrace();
+ throw new PerfSONARException("error.as.signing",
"WSSAuthNSAMLData: " + e.getMessage());
}
return envelope;
- }
+ }
- private SAMLAssertion getAssertionAsSecurityToken(SAMLAssertion
authAssertion,PrivateKey key,Collection<Certificate> certchain,String
cidPerfsonarResource,String cidPerfsonarClient) throws SAMLException {
- SAMLAssertion authStatementAssertion=new SAMLAssertion();
+ private SAMLAssertion getAssertionAsSecurityToken(SAMLAssertion
authAssertion, PrivateKey key,
+
Collection<Certificate> certchain, String cidPerfsonarResource,
+ String
cidPerfsonarClient) throws SAMLException
+ {
+ SAMLAssertion authStatementAssertion = new SAMLAssertion();
- // Adding the client information
- SAMLAudienceRestrictionCondition cond=new
SAMLAudienceRestrictionCondition();
- cond.addAudience(cidPerfsonarResource);
- authStatementAssertion.addCondition(cond);
- authStatementAssertion.setIssuer(cidPerfsonarClient);
+ // Adding the client information
+ SAMLAudienceRestrictionCondition cond = new
SAMLAudienceRestrictionCondition();
+ cond.addAudience(cidPerfsonarResource);
+ authStatementAssertion.addCondition(cond);
+ authStatementAssertion.setIssuer(cidPerfsonarClient);
- SAMLSubject subject=new SAMLSubject();
- subject.addConfirmationMethod("relayed-trust");
- Iterator<?> it=authAssertion.getStatements();
- while (it.hasNext()) {
- SAMLStatement st=(SAMLStatement)it.next();
- if (st instanceof SAMLAuthenticationStatement) {
- SAMLAuthenticationStatement
as=(SAMLAuthenticationStatement)st;
- SAMLNameIdentifier
old=as.getSubject().getNameIdentifier();
- subject.setNameIdentifier(new
SAMLNameIdentifier(old.getName(),old.getNameQualifier(),old.getFormat()));
- }
- }
- try {
- Document request =
authAssertion.toDOM().getOwnerDocument();
+ SAMLSubject subject = new SAMLSubject();
+ subject.addConfirmationMethod("relayed-trust");
+ Iterator<?> it = authAssertion.getStatements();
+ while (it.hasNext()) {
+ SAMLStatement st = (SAMLStatement) it.next();
+ if (st instanceof SAMLAuthenticationStatement) {
+ SAMLAuthenticationStatement as =
(SAMLAuthenticationStatement) st;
+ SAMLNameIdentifier old = as.getSubject().getNameIdentifier();
+ subject.setNameIdentifier(
+ new SAMLNameIdentifier(old.getName(),
old.getNameQualifier(), old.getFormat()));
+ }
+ }
+ try {
+ Document request = authAssertion.toDOM().getOwnerDocument();
- Element c=request.createElementNS(XML.SAML_NS,
"SubjectConfirmationData");
- c.appendChild(authAssertion.toDOM());
+ Element c = request.createElementNS(XML.SAML_NS,
"SubjectConfirmationData");
+ c.appendChild(authAssertion.toDOM());
- subject.setConfirmationData(c);
- } catch (Exception pce) {
- pce.printStackTrace();
- }
+ subject.setConfirmationData(c);
+ } catch (Exception pce) {
+ pce.printStackTrace();
+ }
- SAMLAuthenticationStatement authStatement=new
SAMLAuthenticationStatement();
-
authStatement.setAuthMethod(SAMLAuthenticationStatement.AuthenticationMethod_Unspecified);
- authStatement.setAuthInstant(new Date());
- authStatement.setSubject(subject);
- authStatementAssertion.addStatement(authStatement);
+ SAMLAuthenticationStatement authStatement = new
SAMLAuthenticationStatement();
+
authStatement.setAuthMethod(SAMLAuthenticationStatement.AuthenticationMethod_Unspecified);
+ authStatement.setAuthInstant(new Date());
+ authStatement.setSubject(subject);
+ authStatementAssertion.addStatement(authStatement);
- authStatementAssertion.sign(sigalg, digalg, key, certchain);
+ authStatementAssertion.sign(SIGALG, DIGALG, key, certchain);
- return authStatementAssertion;
- }
+ return authStatementAssertion;
+ }
- private void adjustTime(WSSecTimestamp timestamp, int range) throws
WSSecurityException {
+ private void adjustTime(WSSecTimestamp timestamp, int range) throws
WSSecurityException
+ {
DateFormat zulu;
if (WSSConfig.getDefaultWSConfig().isPrecisionInMilliSeconds()) {
- zulu = new XmlSchemaDateFormat();
+ zulu = new XmlSchemaDateFormat();
+ } else {
+ zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
}
- else {
- zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+ Element e = timestamp.getElement();
+ Timestamp ts = new Timestamp(e);
+ Element e2 = ts.getElement();
+ for (int i = 0; i < e2.getChildNodes().getLength(); i++) {
+ Element e3 = (Element) e2.getChildNodes().item(i);
+ if (e3.getNodeName().equals("wsu:Created")) {
+ ts.getCreated().add(Calendar.SECOND, -range);
+ e3.setTextContent(zulu.format(ts.getCreated().getTime()));
+ } else if (e3.getNodeName().equals("wsu:Expires")) {
+ ts.getExpires().add(Calendar.SECOND, -range);
+ e3.setTextContent(zulu.format(ts.getExpires().getTime()));
+ }
}
-
- Element e=timestamp.getElement();
- Timestamp ts=new Timestamp(e);
- Element e2=ts.getElement();
- for (int i=0; i<e2.getChildNodes().getLength(); i++) {
- Element e3=(Element)e2.getChildNodes().item(i);
- if (e3.getNodeName().equals("wsu:Created")) {
- ts.getCreated().add(Calendar.SECOND, -range);
-
e3.setTextContent(zulu.format(ts.getCreated().getTime()));
- }
- else if (e3.getNodeName().equals("wsu:Expires")) {
- ts.getExpires().add(Calendar.SECOND, -range);
-
e3.setTextContent(zulu.format(ts.getExpires().getTime()));
- }
- }
- }
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/WSSAuthNX509Data.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -41,63 +41,73 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class WSSAuthNX509Data implements AuthNX509Data {
- private static final int defaultTtl=900;
+public class WSSAuthNX509Data implements AuthNX509Data
+{
+ private static final int DEFAULT_TTL = 900;
- @Override
- public Object addX509STInMessage(Object message,String
privKeyFile,String certFile) throws PerfSONARException {
- return
addX509STInMessage(message,privKeyFile,certFile,defaultTtl);
- }
+ @Override
+ public Object addX509STInMessage(Object message, String privKeyFile,
String certFile) throws PerfSONARException
+ {
+ return addX509STInMessage(message, privKeyFile, certFile,
DEFAULT_TTL);
+ }
- @Override
- public Object addX509STInMessage(Object message,String
privKeyFile,String certFile,int ttl) throws PerfSONARException {
- if (!(message instanceof SOAPBodyElement)) {
- throw new
PerfSONARException("error.as.body","WSSAuthNData: the method
addX509STInMessage requires a SOAPBodyElement object");
- }
+ @Override
+ public Object addX509STInMessage(Object message, String privKeyFile,
String certFile,
+ int ttl) throws PerfSONARException
+ {
+ if (!(message instanceof SOAPBodyElement)) {
+ throw new PerfSONARException("error.as.body",
+ "WSSAuthNData: the method
addX509STInMessage requires a SOAPBodyElement "
+ + "object");
+ }
// add the security provider
- BouncyCastleProvider bcp = new BouncyCastleProvider();
+ BouncyCastleProvider bcp = new BouncyCastleProvider();
java.security.Security.addProvider(bcp);
// add the private and public keys
Crypto crypto;
try {
- crypto = new DynamicCrypto();
+ crypto = new DynamicCrypto();
} catch (CredentialException e) {
- throw new PerfSONARException("error.as.crypto","WSSAuthNData:
"+e.getMessage());
+ throw new PerfSONARException("error.as.crypto", "WSSAuthNData: "
+ e.getMessage());
}
- X509Certificate cert=addCertificate(crypto,certFile);
- PrivateKey privateKey=addPrivateKey(privKeyFile);
+ X509Certificate cert = addCertificate(crypto, certFile);
+ PrivateKey privateKey = addPrivateKey(privKeyFile);
return addX509STInMessage(message, privateKey, cert, ttl);
- }
+ }
- @Override
- public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert, int ttl) throws PerfSONARException {
- if (!(message instanceof SOAPBodyElement)) {
- throw new
PerfSONARException("error.as.body","WSSAuthNData: the method
addX509STInMessage requires a SOAPBodyElement object");
- }
- SOAPBodyElement body=(SOAPBodyElement)message;
+ @Override
+ public Object addX509STInMessage(Object message, PrivateKey privateKey,
X509Certificate cert,
+ int ttl) throws PerfSONARException
+ {
+ if (!(message instanceof SOAPBodyElement)) {
+ throw new PerfSONARException("error.as.body",
+ "WSSAuthNData: the method
addX509STInMessage requires a SOAPBodyElement "
+ + "object");
+ }
+ SOAPBodyElement body = (SOAPBodyElement) message;
SOAPEnvelope envelope = new SOAPEnvelope();
envelope.addBodyElement(body);
// add the security provider
- BouncyCastleProvider bcp = new BouncyCastleProvider();
+ BouncyCastleProvider bcp = new BouncyCastleProvider();
java.security.Security.addProvider(bcp);
Crypto crypto;
try {
- crypto = new DynamicCrypto();
+ crypto = new DynamicCrypto();
} catch (CredentialException e) {
- throw new PerfSONARException("error.as.crypto","WSSAuthNData:
"+e.getMessage());
+ throw new PerfSONARException("error.as.crypto", "WSSAuthNData: "
+ e.getMessage());
}
- KeyStore ks=crypto.getKeyStore();
+ KeyStore ks = crypto.getKeyStore();
try {
- ks.setKeyEntry("xmlsec", privateKey,
"security".toCharArray(), new Certificate[]{cert});
+ ks.setKeyEntry("xmlsec", privateKey, "security".toCharArray(),
new Certificate[]{cert});
} catch (KeyStoreException e) {
- throw new PerfSONARException("error.as.crypto","WSSAuthNData:
"+e.getMessage());
+ throw new PerfSONARException("error.as.crypto", "WSSAuthNData: "
+ e.getMessage());
}
try {
@@ -110,24 +120,19 @@
WSSecSignature sec509 = new WSSecSignature();
sec509.setUserInfo("xmlsec", "security");
SOAPConstants soapConstants =
WSSecurityUtil.getSOAPConstants(envelope.getAsDOM());
- Vector<WSEncryptionPart> parts = new
Vector<WSEncryptionPart>(1,1);
+ Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>(1,
1);
// Set up to use STRTransorm to sign the signature token
- WSEncryptionPart encP =
- new WSEncryptionPart(
- "STRTransform",
- soapConstants.getEnvelopeURI(),
- "Content");
+ WSEncryptionPart encP = new WSEncryptionPart("STRTransform",
soapConstants.getEnvelopeURI(), "Content");
parts.add(encP);
// Adding timestamp information
WSSecTimestamp timestamp = new WSSecTimestamp();
timestamp.setTimeToLive(ttl);
- timestamp.prepare(doc);
- adjustTime(timestamp,ttl/2);
- WSSecurityUtil.prependChildElement(doc, secHeader
- .getSecurityHeader(), timestamp.getElement(), false);
- parts.add(new WSEncryptionPart(timestamp.getId()));
+ timestamp.prepare(doc);
+ adjustTime(timestamp, ttl / 2);
+ WSSecurityUtil.prependChildElement(doc,
secHeader.getSecurityHeader(), timestamp.getElement(), false);
+ parts.add(new WSEncryptionPart(timestamp.getId()));
sec509.setParts(parts);
sec509.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
@@ -138,77 +143,80 @@
Message signedMsg = (Message) SOAPUtil.toSOAPMessage(signedDoc);
envelope = signedMsg.getSOAPEnvelope();
} catch (Exception e) {
- throw new
PerfSONARException("error.as.signing","WSSAuthNData: "+e.getMessage());
+ throw new PerfSONARException("error.as.signing", "WSSAuthNData:
" + e.getMessage());
}
return envelope;
}
- @Override
- public Object addX509STInMessage(Object message,PrivateKey
privateKey,X509Certificate cert) throws PerfSONARException {
- return addX509STInMessage(message,privateKey,cert,defaultTtl);
- }
+ @Override
+ public Object addX509STInMessage(Object message, PrivateKey privateKey,
+ X509Certificate cert) throws
PerfSONARException
+ {
+ return addX509STInMessage(message, privateKey, cert, DEFAULT_TTL);
+ }
- private PrivateKey addPrivateKey(String privKeyFile) throws
PerfSONARException {
- try {
- BufferedReader in = new BufferedReader(new
FileReader(privKeyFile));
- String str;
- String previousStr="";
- String data="";
- in.readLine();
- while ((str = in.readLine()) != null) {
- data+=previousStr;
- previousStr=str+"\n";
- }
- in.close();
+ private PrivateKey addPrivateKey(String privKeyFile) throws
PerfSONARException
+ {
+ try {
+ BufferedReader in = new BufferedReader(new
FileReader(privKeyFile));
+ String str;
+ String previousStr = "";
+ String data = "";
+ in.readLine();
+ while ((str = in.readLine()) != null) {
+ data += previousStr;
+ previousStr = str + "\n";
+ }
+ in.close();
- byte[] bytes=Base64.decode(data);
- PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes);
- KeyFactory keyFactory = KeyFactory.getInstance("RSA");
- PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
- return privateKey;
- } catch (Exception e) {
- throw new
PerfSONARException("error.as.getting_privkey","WSSAuthNData:
"+e.getMessage());
- }
- }
+ byte[] bytes = Base64.decode(data);
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes);
+ KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+ PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
+ return privateKey;
+ } catch (Exception e) {
+ throw new PerfSONARException("error.as.getting_privkey",
"WSSAuthNData: " + e.getMessage());
+ }
+ }
- private X509Certificate addCertificate(Crypto crypto,String certFile)
throws PerfSONARException {
- try {
- InputStream isCert=new FileInputStream(certFile);
+ private X509Certificate addCertificate(Crypto crypto, String certFile)
throws PerfSONARException
+ {
+ try {
+ InputStream isCert = new FileInputStream(certFile);
- X509Certificate cert=crypto.loadCertificate(isCert);
+ X509Certificate cert = crypto.loadCertificate(isCert);
- return cert;
- } catch (Exception e) {
- throw new
PerfSONARException("error.as.getting_cert","WSSAuthNData: "+e.getMessage());
- }
- }
+ return cert;
+ } catch (Exception e) {
+ throw new PerfSONARException("error.as.getting_cert",
"WSSAuthNData: " + e.getMessage());
+ }
+ }
- private void adjustTime(WSSecTimestamp timestamp, int range) throws
WSSecurityException {
+ private void adjustTime(WSSecTimestamp timestamp, int range) throws
WSSecurityException
+ {
DateFormat zulu;
if (WSSConfig.getDefaultWSConfig().isPrecisionInMilliSeconds()) {
- zulu = new XmlSchemaDateFormat();
+ zulu = new XmlSchemaDateFormat();
+ } else {
+ zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
}
- else {
- zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
+
+ Element e = timestamp.getElement();
+ Timestamp ts = new Timestamp(e);
+ Element e2 = ts.getElement();
+ for (int i = 0; i < e2.getChildNodes().getLength(); i++) {
+ Element e3 = (Element) e2.getChildNodes().item(i);
+ System.out.println(">>>>>> " + e3.getNodeName());
+ if (e3.getNodeName().equals("wsu:Created")) {
+ ts.getCreated().add(Calendar.SECOND, -range);
+ e3.setTextContent(zulu.format(ts.getCreated().getTime()));
+ } else if (e3.getNodeName().equals("wsu:Expires")) {
+ ts.getExpires().add(Calendar.SECOND, -range);
+ e3.setTextContent(zulu.format(ts.getExpires().getTime()));
+ }
+ System.out.println(">>>>>> " + e3.getTextContent());
}
-
- Element e=timestamp.getElement();
- Timestamp ts=new Timestamp(e);
- Element e2=ts.getElement();
- for (int i=0; i<e2.getChildNodes().getLength(); i++) {
- Element e3=(Element)e2.getChildNodes().item(i);
- System.out.println(">>>>>> "+e3.getNodeName());
- if (e3.getNodeName().equals("wsu:Created")) {
- ts.getCreated().add(Calendar.SECOND, -range);
-
e3.setTextContent(zulu.format(ts.getCreated().getTime()));
- }
- else if (e3.getNodeName().equals("wsu:Expires")) {
- ts.getExpires().add(Calendar.SECOND, -range);
-
e3.setTextContent(zulu.format(ts.getExpires().getTime()));
- }
- System.out.println(">>>>>> "+e3.getTextContent());
- }
- }
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINFilterHelper.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINFilterHelper.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINFilterHelper.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -10,31 +10,36 @@
import org.opensaml.SAMLResponse;
import org.opensaml.SAMLStatement;
-public class EduGAINFilterHelper {
-
- @SuppressWarnings("unchecked") // should be save
- public static SAMLAssertion getAuthenticationAssertion(HttpSession
session) {
- SAMLAssertion authStatementAssertion=null;
-
- Enumeration<String> attrs = session.getAttributeNames();
- while (attrs.hasMoreElements()&&authStatementAssertion==null)
{
- String attrName = attrs.nextElement();
- Object attrValRaw = session.getAttribute(attrName);
- if (attrValRaw instanceof SAMLResponse) {
- SAMLResponse
samlResponse=(SAMLResponse)attrValRaw;
- Iterator<SAMLAssertion>
it=samlResponse.getAssertions();
- while
(it.hasNext()&&authStatementAssertion==null) {
- SAMLAssertion assertion=it.next();
- Iterator<SAMLStatement>
it2=assertion.getStatements();
- while
(it2.hasNext()&&authStatementAssertion==null) {
- SAMLStatement
statement=it2.next();
- if (statement instanceof
SAMLAuthenticationStatement) {
-
authStatementAssertion=assertion;
- }
- }
- }
- }
- }
- return authStatementAssertion;
- }
+public final class EduGAINFilterHelper
+{
+ private EduGAINFilterHelper()
+ {
+ }
+
+ @SuppressWarnings("unchecked") // should be save
+ public static SAMLAssertion getAuthenticationAssertion(HttpSession
session)
+ {
+ SAMLAssertion authStatementAssertion = null;
+
+ Enumeration<String> attrs = session.getAttributeNames();
+ while (attrs.hasMoreElements() && authStatementAssertion == null) {
+ String attrName = attrs.nextElement();
+ Object attrValRaw = session.getAttribute(attrName);
+ if (attrValRaw instanceof SAMLResponse) {
+ SAMLResponse samlResponse = (SAMLResponse) attrValRaw;
+ Iterator<SAMLAssertion> it = samlResponse.getAssertions();
+ while (it.hasNext() && authStatementAssertion == null) {
+ SAMLAssertion assertion = it.next();
+ Iterator<SAMLStatement> it2 = assertion.getStatements();
+ while (it2.hasNext() && authStatementAssertion == null) {
+ SAMLStatement statement = it2.next();
+ if (statement instanceof
SAMLAuthenticationStatement) {
+ authStatementAssertion = assertion;
+ }
+ }
+ }
+ }
+ }
+ return authStatementAssertion;
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINMetadataService.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINMetadataService.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/edugain/EduGAINMetadataService.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -14,38 +14,48 @@
import org.opensaml.xml.XMLObject;
import org.perfsonar.base.exceptions.PerfSONARException;
-public class EduGAINMetadataService {
- private static final String
defaultUriMDS="http://mds.rediris.es:8080";
- private static final String
defaultUriCRL="http://sca.edugain.org/crl/cacrl.der";
-
- public static List<BEMetaData> getOrganizationList(String uriMds,
String fileKeystore, String passKeystore, String fileComponents) throws
PerfSONARException {
- Properties p = new Properties();
- p.put(Configurator.PROPS_KEYSTORE_FILE, fileKeystore);
- p.put(Configurator.PROPS_KEYSTORE_PASSWD, passKeystore);
- p.put(Configurator.PROPS_TRUSTSTORE_FILE, fileKeystore);
- p.put(Configurator.PROPS_TRUSTSTORE_PASSWD, passKeystore);
- p.put(Configurator.PROPS_CRL_URL, defaultUriCRL);
- p.put(Configurator.PROPS_VALID_COMPONENTS, fileComponents);
- p.put(Configurator.PROPS_SAML_VERSION, "1.1");
- p.put("net.geant.edugain.strict-mode","false");
+public final class EduGAINMetadataService
+{
+ private static final String DEFAULT_URI_MDS =
"http://mds.rediris.es:8080";
+ private static final String DEFAULT_URI_CRL =
"http://sca.edugain.org/crl/cacrl.der";
- Configurator.getInstance(p);
- List<BEMetaData> list=new LinkedList<BEMetaData>();
- try {
- MetaDataRequester requester=new MetaDataRequester();
- XMLObject xo=requester.getXMLMetaData(new
URL(uriMds), "md:EntitiesDescriptor");
- FederationMetaData fmd=requester.getFedMetaData(xo);
- ArrayList<BEMetaData> listBEs=fmd.getBeMetaDataList();
- list.addAll(listBEs);
-
- return list;
- } catch (Throwable e) {
- e.printStackTrace();
- throw new
PerfSONARException("error.as.mds_query","EduGAINMetadataService: a problem
querying the MDS: "+e.getMessage());
- }
- }
-
- public static List<BEMetaData> getOrganizationList(String
fileKeystore, String passKeystore, String fileComponents) throws
PerfSONARException {
- return getOrganizationList(defaultUriMDS, fileKeystore,
passKeystore, fileComponents);
- }
+ private EduGAINMetadataService()
+ {
+ }
+
+ public static List<BEMetaData> getOrganizationList(String uriMds, String
fileKeystore, String passKeystore,
+ String
fileComponents) throws PerfSONARException
+ {
+ Properties p = new Properties();
+ p.put(Configurator.PROPS_KEYSTORE_FILE, fileKeystore);
+ p.put(Configurator.PROPS_KEYSTORE_PASSWD, passKeystore);
+ p.put(Configurator.PROPS_TRUSTSTORE_FILE, fileKeystore);
+ p.put(Configurator.PROPS_TRUSTSTORE_PASSWD, passKeystore);
+ p.put(Configurator.PROPS_CRL_URL, DEFAULT_URI_CRL);
+ p.put(Configurator.PROPS_VALID_COMPONENTS, fileComponents);
+ p.put(Configurator.PROPS_SAML_VERSION, "1.1");
+ p.put("net.geant.edugain.strict-mode", "false");
+
+ Configurator.getInstance(p);
+ List<BEMetaData> list = new LinkedList<BEMetaData>();
+ try {
+ MetaDataRequester requester = new MetaDataRequester();
+ XMLObject xo = requester.getXMLMetaData(new URL(uriMds),
"md:EntitiesDescriptor");
+ FederationMetaData fmd = requester.getFedMetaData(xo);
+ ArrayList<BEMetaData> listBEs = fmd.getBeMetaDataList();
+ list.addAll(listBEs);
+
+ return list;
+ } catch (Throwable e) {
+ e.printStackTrace();
+ throw new PerfSONARException("error.as.mds_query",
+ "EduGAINMetadataService: a problem
querying the MDS: " + e.getMessage());
+ }
+ }
+
+ public static List<BEMetaData> getOrganizationList(String fileKeystore,
String passKeystore,
+ String
fileComponents) throws PerfSONARException
+ {
+ return getOrganizationList(DEFAULT_URI_MDS, fileKeystore,
passKeystore, fileComponents);
+ }
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClient.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -14,90 +14,93 @@
import edu.psu.sasl_ca.util.StringConstants;
import edu.psu.sasl_ca.util.Util;
-public class SASLCAClient {
- private ClientProtocolHandler clientProtocolHandler;
- private final UserID userID;
- private final UserIDCallbackHandler cbh;
- private final SASLCAClientConfiguration clientConfig;
+public class SASLCAClient
+{
+ private ClientProtocolHandler clientProtocolHandler;
+ private final UserID userID;
+ private final UserIDCallbackHandler cbh;
+ private final SASLCAClientConfiguration clientConfig;
- public SASLCAClient(UserID userID, SASLCAClientConfiguration
clientConfig) throws PerfSONARException {
- this.userID=userID;
- this.cbh=new UserIDCallbackHandler(userID);
- this.clientConfig=clientConfig;
- clientConfig.setCbh(cbh);
- try {
- clientProtocolHandler=new
ClientProtocolHandler(clientConfig.getServerName(),clientConfig.getServerPort(),
-
clientConfig.getCallbackHandler(),clientConfig.getSaslProperties());
- } catch (Exception e) {
- String m = "SASLCAClient: Error creating the Client
protocol handler: "+e.getMessage();
- throw new PerfSONARException(m);
- }
- }
-
- public KeyPair generateKeyPair() throws PerfSONARException {
- try {
- KeyPair eduGainKeyPair =
Util.generateKeyPair(clientConfig.getKeyAlgorithm(),
clientConfig.getKeySize());
- return eduGainKeyPair;
- } catch (NoSuchAlgorithmException e) {
- String m = "SASLCAClient: Wrong key algorithm ";
- throw new PerfSONARException(m);
- }
- }
-
- public X509Certificate getCertficate(KeyPair eduGainKeyPair) throws
PerfSONARException {
- CertificationRequest edugainCSR;
- Map<CertificationRequest, X509Certificate[]> certMap;
-
- Subject subj=new Subject();
- subj.getPrincipals().add(userID);
-
- try {
- edugainCSR = ClientProtocolHandler.generateCSR(
- StringConstants.edugainCertIdentifier,
- eduGainKeyPair,
- "SHA1withRSA"
- );
- } catch (Exception e) {
- String m = "SASLCAClient: Error generating the CSR:
"+e.getMessage();
- throw new PerfSONARException(m);
- }
- clientProtocolHandler.addCSR(edugainCSR);
+ public SASLCAClient(UserID userID, SASLCAClientConfiguration
clientConfig) throws PerfSONARException
+ {
+ this.userID = userID;
+ this.cbh = new UserIDCallbackHandler(userID);
+ this.clientConfig = clientConfig;
+ clientConfig.setCbh(cbh);
+ try {
+ clientProtocolHandler = new
ClientProtocolHandler(clientConfig.getServerName(),
+
clientConfig.getServerPort(),
+
clientConfig.getCallbackHandler(),
+
clientConfig.getSaslProperties());
+ } catch (Exception e) {
+ String m = "SASLCAClient: Error creating the Client protocol
handler: " + e.getMessage();
+ throw new PerfSONARException(m);
+ }
+ }
- try {
- certMap = Subject
- .doAs(subj, clientProtocolHandler);
- } catch (Exception e) {
- e.printStackTrace();
- String m = "SASLCAClient: Error getting the signed
CSR: "+e.getMessage();
- throw new PerfSONARException(m);
- }
+ public KeyPair generateKeyPair() throws PerfSONARException
+ {
+ try {
+ KeyPair eduGainKeyPair =
Util.generateKeyPair(clientConfig.getKeyAlgorithm(),
clientConfig.getKeySize());
+ return eduGainKeyPair;
+ } catch (NoSuchAlgorithmException e) {
+ String m = "SASLCAClient: Wrong key algorithm ";
+ throw new PerfSONARException(m);
+ }
+ }
- X509Certificate[] certChain = certMap.get(edugainCSR);
- boolean valid = Util.verifyCertChain(certChain);
- if (!valid) {
- String m = "SASLCAClient: Error verifying the signed
CSR. Received certs ("+certChain.length+")";
-/* for (int i=0; i<certChain.length; i++) {
- if (certChain[i]!=null) {
- m+="* Subject
DN("+certChain[i].getSubjectDN().toString()+") Issuer DN
("+certChain[i].getIssuerDN().toString()+") From
("+DateFormat.getInstance().format(certChain[i].getNotBefore())+") Until
("+DateFormat.getInstance().format(certChain[i].getNotAfter())+")\n";
- }
- else {
- m+="* Cert #"+i+" is null\n";
- }
- } */
- throw new PerfSONARException(m);
- }
+ public X509Certificate getCertficate(KeyPair eduGainKeyPair) throws
PerfSONARException
+ {
+ CertificationRequest edugainCSR;
+ Map<CertificationRequest, X509Certificate[]> certMap;
- try {
- for (X509Certificate certificate : certChain) {
- if (certificate.getSubjectDN()!=null) {
- return certificate;
- }
- }
- } catch (Exception e) {
- String m = "SASLCAClient: Error checking the public
key of the certificate: "+e.getMessage();
- throw new PerfSONARException(m);
- }
+ Subject subj = new Subject();
+ subj.getPrincipals().add(userID);
- return null;
- }
+ try {
+ edugainCSR =
ClientProtocolHandler.generateCSR(StringConstants.edugainCertIdentifier,
eduGainKeyPair,
+ "SHA1withRSA");
+ } catch (Exception e) {
+ String m = "SASLCAClient: Error generating the CSR: " +
e.getMessage();
+ throw new PerfSONARException(m);
+ }
+ clientProtocolHandler.addCSR(edugainCSR);
+
+ try {
+ certMap = Subject.doAs(subj, clientProtocolHandler);
+ } catch (Exception e) {
+ e.printStackTrace();
+ String m = "SASLCAClient: Error getting the signed CSR: " +
e.getMessage();
+ throw new PerfSONARException(m);
+ }
+
+ X509Certificate[] certChain = certMap.get(edugainCSR);
+ boolean valid = Util.verifyCertChain(certChain);
+ if (!valid) {
+ String m = "SASLCAClient: Error verifying the signed CSR.
Received certs (" + certChain.length + ")";
+/* for (int i=0; i<certChain.length; i++) {
+ if (certChain[i]!=null) {
+ m+="* Subject DN("+certChain[i].getSubjectDN().toString()+")
Issuer DN ("+certChain[i]
+ .getIssuerDN().toString()+") From
("+DateFormat.getInstance().format(certChain[i].getNotBefore
+ ())+") Until
("+DateFormat.getInstance().format(certChain[i].getNotAfter())+")\n";
+ } else {
+ m+="* Cert #"+i+" is null\n";
+ }
+ }*/
+ throw new PerfSONARException(m);
+ }
+
+ try {
+ for (X509Certificate certificate : certChain) {
+ if (certificate.getSubjectDN() != null) {
+ return certificate;
+ }
+ }
+ } catch (Exception e) {
+ String m = "SASLCAClient: Error checking the public key of the
certificate: " + e.getMessage();
+ throw new PerfSONARException(m);
+ }
+
+ return null;
+ }
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/SASLCAClientConfiguration.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -58,260 +58,291 @@
import edu.psu.sasl_ca.util.StringConstants;
-public class SASLCAClientConfiguration {
- private LoggerComponent logger;
+public class SASLCAClientConfiguration
+{
+ private LoggerComponent logger;
- private ConfigurationComponent config;
+ private ConfigurationComponent config;
- private static final String SASLCA_SERVER_PARAM =
"service.saslca.server";
+ private static final String SASLCA_SERVER_PARAM =
"service.saslca.server";
- private static final String SASLCA_SERVER_PORT =
"service.saslca.port";
+ private static final String SASLCA_SERVER_PORT = "service.saslca.port";
- private static final String SASLCA_KEY_ALG = "service.saslca.keyalg";
+ private static final String SASLCA_KEY_ALG = "service.saslca.keyalg";
- private static final String SASLCA_KEY_STRENGTH =
"server.saslca.keystrengh";
+ private static final String SASLCA_KEY_STRENGTH =
"server.saslca.keystrengh";
- private static final String SASLCA_SEC_LAYER =
"server.saslca.seclayer";
+ private static final String SASLCA_SEC_LAYER = "server.saslca.seclayer";
- /** hostname of the SASL-CA server */
- private String serverName = null;
+ /**
+ * hostname of the SASL-CA server.
+ */
+ private String serverName = null;
- /** host port of the SASL-CA server */
- private int serverPort = 4088;
+ /**
+ * host port of the SASL-CA server.
+ */
+ private int serverPort = 4088;
- /** JCE algorithm identifier for the CSR key generation algorithm */
- private String keyAlgorithm = "RSA";
+ /**
+ * JCE algorithm identifier for the CSR key generation algorithm.
+ */
+ private String keyAlgorithm = "RSA";
- /** keysize for the CSR keys */
- private int keySize = 1024;
+ /**
+ * keysize for the CSR keys.
+ */
+ private int keySize = 1024;
- /** the callback handler */
- private CallbackHandler cbh = null;
+ /**
+ * the callback handler.
+ */
+ private CallbackHandler cbh = null;
- /** The SASL security layer properties for each SASL mechanism. */
- private Map<String, String> saslProperties;
+ /**
+ * The SASL security layer properties for each SASL mechanism.
+ */
+ private Map<String, String> saslProperties;
- /** The list of TLS ciphersuites */
- private String[] cipherSuites = null;
+ /**
+ * The list of TLS ciphersuites.
+ */
+ private String[] cipherSuites = null;
- /** The list of TLS protocols */
- private String[] tlsProtocols = null;
+ /**
+ * The list of TLS protocols.
+ */
+ private String[] tlsProtocols = null;
- public SASLCAClientConfiguration() throws PerfSONARException {
- try {
- logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance()
- .getComponent(ComponentNames.LOGGER);
- } catch (PerfSONARException e) {
- String m = "SASLCAClientConfiguration: Can't obtain
Logger component ";
- throw new PerfSONARException(m);
- }
- try {
- config = (ConfigurationComponent)
AuxiliaryComponentManager
-
.getInstance().getComponent(ComponentNames.CONFIG);
- } catch (PerfSONARException e) {
+ public SASLCAClientConfiguration() throws PerfSONARException
+ {
+ try {
+ logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
+ } catch (PerfSONARException e) {
+ String m = "SASLCAClientConfiguration: Can't obtain Logger
component ";
+ throw new PerfSONARException(m);
+ }
+ try {
+ config = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(
+ ComponentNames.CONFIG);
+ } catch (PerfSONARException e) {
- String m = "SASLCAClientConfiguration: Can't obtain
Config component ";
- logger.error(m);
- throw new PerfSONARException(m);
- }
- try {
- serverName = config.getProperty(SASLCA_SERVER_PARAM);
- serverPort = Integer.parseInt(config
- .getProperty(SASLCA_SERVER_PORT));
- keyAlgorithm = config.getProperty(SASLCA_KEY_ALG);
- keySize =
Integer.parseInt(config.getProperty(SASLCA_KEY_STRENGTH));
- saslProperties = setupSaslSecurityLayer(config
- .getProperty(SASLCA_SEC_LAYER));
- /* s =
props.getProperty(OptionalPropertyNames.STARTTLS_CIPHERSUITES);
- if (s != null) {
- this.cipherSuites = s.trim().split(" ");
- }
+ String m = "SASLCAClientConfiguration: Can't obtain Config
component ";
+ logger.error(m);
+ throw new PerfSONARException(m);
+ }
+ try {
+ serverName = config.getProperty(SASLCA_SERVER_PARAM);
+ serverPort =
Integer.parseInt(config.getProperty(SASLCA_SERVER_PORT));
+ keyAlgorithm = config.getProperty(SASLCA_KEY_ALG);
+ keySize =
Integer.parseInt(config.getProperty(SASLCA_KEY_STRENGTH));
+ saslProperties =
setupSaslSecurityLayer(config.getProperty(SASLCA_SEC_LAYER));
+ /* s =
props.getProperty(OptionalPropertyNames.STARTTLS_CIPHERSUITES);
+ if (s != null) {
+ this.cipherSuites = s.trim().split(" ");
+ }
- s =
props.getProperty(OptionalPropertyNames.STARTTLS_PROTOCOLS);
- if (s != null) {
- this.tlsProtocols = s.trim().split(" ");
- } */
- } catch (Exception e) {
- String m = "AADispatchSOAPProtocol: Can't obtain
required parameters ";
- logger.error(m);
- throw new PerfSONARException(m);
- }
- }
-
- public SASLCAClientConfiguration(String serverName, int serverPort,
String keyAlgorithm, int keySize,
- String saslCASecLayer) {
- this.serverName=serverName;
- this.serverPort=serverPort;
- this.keyAlgorithm=keyAlgorithm;
- this.keySize=keySize;
- this.saslProperties = setupSaslSecurityLayer(saslCASecLayer);
- }
+ s =
props.getProperty(OptionalPropertyNames.STARTTLS_PROTOCOLS);
+ if (s != null) {
+ this.tlsProtocols = s.trim().split(" ");
+ } */
+ } catch (Exception e) {
+ String m = "AADispatchSOAPProtocol: Can't obtain required
parameters ";
+ logger.error(m);
+ throw new PerfSONARException(m);
+ }
+ }
- /**
- * Parse the SASL-CA properties and setup the SASL security layer
properties.
- *
- * A SASL security layer can be null (SASL only authenticates the
user), or it can optionally
- * provide integrity protection or confidentiality. Futher, it can
require mutual authentication
- * of the client and server.
- *
- * @param securityString A
{@link
String} representation of the security layer properties.
- *
- * @return A
{@link
Map} of SASL security layer properties.
- *
- * @see javax.security.sasl.Sasl#createSaslClient
- */
- public static Map<String, String> setupSaslSecurityLayer(
- final String securityString) {
+ public SASLCAClientConfiguration(String serverName, int serverPort,
String keyAlgorithm, int keySize,
+ String saslCASecLayer)
+ {
+ this.serverName = serverName;
+ this.serverPort = serverPort;
+ this.keyAlgorithm = keyAlgorithm;
+ this.keySize = keySize;
+ this.saslProperties = setupSaslSecurityLayer(saslCASecLayer);
+ }
- Map<String, String> securityLayerProps = new HashMap<String,
String>();
+ /**
+ * Parse the SASL-CA properties and setup the SASL security layer
properties.
+ * <p/>
+ * A SASL security layer can be null (SASL only authenticates the user),
or it can optionally
+ * provide integrity protection or confidentiality. Futher, it can
require mutual authentication
+ * of the client and server.
+ *
+ * @param securityString A
{@link
String} representation of the security layer properties.
+ * @return A
{@link
Map} of SASL security layer properties.
+ * @see javax.security.sasl.Sasl#createSaslClient
+ */
+ public static Map<String, String> setupSaslSecurityLayer(final String
securityString)
+ {
- if (securityString == null ||
securityString.trim().isEmpty()) {
- return securityLayerProps;
- }
+ Map<String, String> securityLayerProps = new HashMap<String,
String>();
- String temp = securityString.trim();
+ if (securityString == null || securityString.trim().isEmpty()) {
+ return securityLayerProps;
+ }
- StringBuilder qopString = new StringBuilder();
+ String temp = securityString.trim();
- for (String component : temp.split(" ")) {
+ StringBuilder qopString = new StringBuilder();
- if
(component.equals(StringConstants.secLayerMutualAuth)) {
-
securityLayerProps.put(javax.security.sasl.Sasl.SERVER_AUTH,
- "true");
- } else if
(component.equals(StringConstants.secLayerAuthOnly)) {
+ for (String component : temp.split(" ")) {
- if (qopString.length() > 0) {
- qopString.append(",");
- }
+ if (component.equals(StringConstants.secLayerMutualAuth)) {
+ securityLayerProps.put(javax.security.sasl.Sasl.SERVER_AUTH,
"true");
+ } else if (component.equals(StringConstants.secLayerAuthOnly)) {
- qopString.append("auth");
- } else if
(component.equals(StringConstants.secLayerAuthInt)) {
+ if (qopString.length() > 0) {
+ qopString.append(",");
+ }
- if (qopString.length() > 0) {
- qopString.append(",");
- }
+ qopString.append("auth");
+ } else if (component.equals(StringConstants.secLayerAuthInt)) {
- qopString.append("auth-int");
- } else if
(component.equals(StringConstants.secLayerAuthConf)) {
+ if (qopString.length() > 0) {
+ qopString.append(",");
+ }
- if (qopString.length() > 0) {
- qopString.append(",");
- }
+ qopString.append("auth-int");
+ } else if (component.equals(StringConstants.secLayerAuthConf)) {
- qopString.append("auth-conf");
- }
- }
+ if (qopString.length() > 0) {
+ qopString.append(",");
+ }
- String s = qopString.toString();
+ qopString.append("auth-conf");
+ }
+ }
- if (!s.isEmpty()) {
- securityLayerProps.put(javax.security.sasl.Sasl.QOP,
s);
- }
+ String s = qopString.toString();
- return securityLayerProps;
- }
+ if (!s.isEmpty()) {
+ securityLayerProps.put(javax.security.sasl.Sasl.QOP, s);
+ }
- /**
- * Returns the SASL-CA's server name.
- */
- public String getServerName() {
+ return securityLayerProps;
+ }
- return serverName;
- }
+ /**
+ * Returns the SASL-CA's server name.
+ */
+ public String getServerName()
+ {
- /**
- * Returns the SASL-CA's server port.
- */
- public int getServerPort() {
+ return serverName;
+ }
- return serverPort;
- }
+ /**
+ * Returns the SASL-CA's server port.
+ */
+ public int getServerPort()
+ {
- /**
- * Returns the JCE algorithm name for generating keypairs.
- */
- public String getKeyAlgorithm() {
+ return serverPort;
+ }
- return keyAlgorithm;
- }
+ /**
+ * Returns the JCE algorithm name for generating keypairs.
+ */
+ public String getKeyAlgorithm()
+ {
- /**
- * Returns the keysize for the algorithm in
{@link
#getKeyAlgorithm()}
- */
- public int getKeySize() {
+ return keyAlgorithm;
+ }
- return keySize;
- }
+ /**
+ * Returns the keysize for the algorithm in
{@link
#getKeyAlgorithm()}.
+ */
+ public int getKeySize()
+ {
- /**
- * Returns the SASL properties for this client.
- */
- public Map<String, String> getSaslProperties() {
+ return keySize;
+ }
- return this.saslProperties;
- }
+ /**
+ * Returns the SASL properties for this client.
+ */
+ public Map<String, String> getSaslProperties()
+ {
- /**
- * Returns the
{@link
CallbackHandler} for this client
- */
- public CallbackHandler getCallbackHandler() {
+ return this.saslProperties;
+ }
- return this.cbh;
- }
+ /**
+ * Returns the
{@link
CallbackHandler} for this client.
+ */
+ public CallbackHandler getCallbackHandler()
+ {
- /**
- * Returns the list of SSL/TLS protocols for this client
- */
- public String[] getTLSProtocols() {
+ return this.cbh;
+ }
- return this.tlsProtocols;
- }
+ /**
+ * Returns the list of SSL/TLS protocols for this client.
+ */
+ public String[] getTLSProtocols()
+ {
- /**
- * Returns the list of SSL/TLS ciphersuites for this client
- */
- public String[] getTLSCipherSuites() {
+ return this.tlsProtocols;
+ }
- return this.cipherSuites;
- }
+ /**
+ * Returns the list of SSL/TLS ciphersuites for this client.
+ */
+ public String[] getTLSCipherSuites()
+ {
- public CallbackHandler getCbh() {
- return cbh;
- }
+ return this.cipherSuites;
+ }
- public void setCbh(CallbackHandler cbh) {
- this.cbh = cbh;
- }
+ public CallbackHandler getCbh()
+ {
+ return cbh;
+ }
- public String[] getCipherSuites() {
- return cipherSuites;
- }
+ public void setCbh(CallbackHandler cbh)
+ {
+ this.cbh = cbh;
+ }
- public void setCipherSuites(String[] cipherSuites) {
- this.cipherSuites = cipherSuites;
- }
+ public String[] getCipherSuites()
+ {
+ return cipherSuites;
+ }
- public String[] getTlsProtocols() {
- return tlsProtocols;
- }
+ public void setCipherSuites(String[] cipherSuites)
+ {
+ this.cipherSuites = cipherSuites;
+ }
- public void setTlsProtocols(String[] tlsProtocols) {
- this.tlsProtocols = tlsProtocols;
- }
+ public String[] getTlsProtocols()
+ {
+ return tlsProtocols;
+ }
- public void setKeyAlgorithm(String keyAlgorithm) {
- this.keyAlgorithm = keyAlgorithm;
- }
+ public void setTlsProtocols(String[] tlsProtocols)
+ {
+ this.tlsProtocols = tlsProtocols;
+ }
- public void setKeySize(int keySize) {
- this.keySize = keySize;
- }
+ public void setKeyAlgorithm(String keyAlgorithm)
+ {
+ this.keyAlgorithm = keyAlgorithm;
+ }
- public void setServerName(String serverName) {
- this.serverName = serverName;
- }
+ public void setKeySize(int keySize)
+ {
+ this.keySize = keySize;
+ }
- public void setServerPort(int serverPort) {
- this.serverPort = serverPort;
- }
+ public void setServerName(String serverName)
+ {
+ this.serverName = serverName;
+ }
+
+ public void setServerPort(int serverPort)
+ {
+ this.serverPort = serverPort;
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/UserID.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/UserID.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/UserID.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,29 +2,35 @@
import java.security.Principal;
-public class UserID implements Principal {
- String name;
- String password;
-
- public UserID(String name,String password) {
- this.name=name;
- this.password=password;
- }
+public class UserID implements Principal
+{
+ private String name;
+ private String password;
- @Override
- public String getName() {
- return name;
- }
+ public UserID(String name, String password)
+ {
+ this.name = name;
+ this.password = password;
+ }
- public void setName(String name) {
- this.name=name;
- }
+ @Override
+ public String getName()
+ {
+ return name;
+ }
- public String getPassword() {
- return password;
- }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
- public void setPassword(String password) {
- this.password = password;
- }
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/UserIDCallbackHandler.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/UserIDCallbackHandler.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/authn/saslca/UserIDCallbackHandler.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,16 +8,18 @@
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
-public class UserIDCallbackHandler implements CallbackHandler {
- final UserID userId;
-
- public UserIDCallbackHandler(UserID userId) {
- this.userId=userId;
- }
+public class UserIDCallbackHandler implements CallbackHandler
+{
+ private final UserID userId;
- @Override
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
+ public UserIDCallbackHandler(UserID userId)
+ {
+ this.userId = userId;
+ }
+
+ @Override
+ public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException
+ {
for (Callback callback : callbacks) {
if (callback instanceof NameCallback) {
NameCallback nc = (NameCallback) callback;
@@ -29,6 +31,6 @@
throw new UnsupportedCallbackException(callback,
"Unrecognized Callback");
}
}
- }
+ }
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/RequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -9,23 +9,17 @@
/**
* @author Maciej Glowiak
- *
- * Common interface for all classes that are able to generate requests as
- * NMWG Message object
- *
+ * <p/>
+ * Common interface for all classes that are able to generate
requests as
+ * NMWG Message object
*/
-public interface RequestGenerator {
-
-
- // --------------------------------------------------------- Public
methods
-
+public interface RequestGenerator
+{
/**
- * Creates NMWG Message that contains particular request
- * @return NMWG Message containing 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
+ Message generateRequestMessage() throws PerfSONARException;
+} //RequestGenerator
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AttrEERequestGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AttrEERequestGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AttrEERequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,100 +17,112 @@
import org.perfsonar.client.base.requests.RequestGenerator;
import org.perfsonar.service.base.authn.AttrRequest;
-public class AttrEERequestGenerator implements RequestGenerator {
- private static final String metaId = "attrmetadata";
- private static final String paramsId = "keys";
- private static final String paramKey = "SecurityToken";
- private static final String dataId = "attr1";
- private static final String
WSS_X509="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
- private static final String messageType = "AttrEERequest";
+public class AttrEERequestGenerator implements RequestGenerator
+{
+ private static final String META_ID = "attrmetadata";
+ private static final String PARAMS_ID = "keys";
+ private static final String PARAM_KEY = "SecurityToken";
+ private static final String DATA_ID = "attr1";
+ private static final String WSS_X509 =
+ "http://docs.oasis-open" +
".org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
+ private static final String MESSAGE_TYPE = "AttrEERequest";
- @Override
- public Message generateRequestMessage() throws PerfSONARException {
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ @Override
+ public Message generateRequestMessage() throws PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(META_ID);
Parameters params = new Parameters();
- params.setId(paramsId);
- params.addParameter(paramKey, WSS_X509);
+ params.setId(PARAMS_ID);
+ params.addParameter(PARAM_KEY, WSS_X509);
meta.setParameters(params);
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(DATA_ID);
+ data.setMetadataIdRef(META_ID);
Message message = new Message();
- message.setType(messageType);
+ message.setType(MESSAGE_TYPE);
message.setMetadata(meta);
message.setData(data);
return message;
- }
+ }
- public Message generateRequestMessage(String secToken, AttrRequest
attrReq) throws PerfSONARException {
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ public Message generateRequestMessage(String secToken, AttrRequest
attrReq) throws PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(META_ID);
Parameters params = new Parameters();
- params.setId(paramsId);
- params.addParameter(paramKey, secToken);
+ params.setId(PARAMS_ID);
+ params.addParameter(PARAM_KEY, secToken);
meta.setParameters(params);
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(DATA_ID);
+ data.setMetadataIdRef(META_ID);
Message message = new Message();
- message.setType(messageType);
+ message.setType(MESSAGE_TYPE);
message.setMetadata(meta);
message.setData(data);
- Subject attrSub=new Subject();
- attrSub.setSubject(getSAMLMessage(attrReq));
- message.getMetadata(metaId).setSubject(attrSub);
+ Subject attrSub = new Subject();
+ attrSub.setSubject(getSAMLMessage(attrReq));
+ message.getMetadata(META_ID).setSubject(attrSub);
return message;
- }
+ }
- public Message generateRequestMessage(AttrRequest attrReq) throws
PerfSONARException {
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ public Message generateRequestMessage(AttrRequest attrReq) throws
PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(META_ID);
Parameters params = new Parameters();
- params.setId(paramsId);
- params.addParameter(paramKey, WSS_X509);
+ params.setId(PARAMS_ID);
+ params.addParameter(PARAM_KEY, WSS_X509);
meta.setParameters(params);
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(DATA_ID);
+ data.setMetadataIdRef(META_ID);
Message message = new Message();
- message.setType(messageType);
+ message.setType(MESSAGE_TYPE);
message.setMetadata(meta);
message.setData(data);
- Subject attrSub=new Subject();
- attrSub.setSubject(getSAMLMessage(attrReq));
- message.getMetadata(metaId).setSubject(attrSub);
+ Subject attrSub = new Subject();
+ attrSub.setSubject(getSAMLMessage(attrReq));
+ message.getMetadata(META_ID).setSubject(attrSub);
return message;
- }
+ }
- private String getSAMLMessage(AttrRequest attrReq) {
- Date date=new Date();
- Format formatter = new SimpleDateFormat("yyyy-MM-dd");
- Format formatter2 = new SimpleDateFormat("HH:mm:ss");
- String samlMessage = "<samlp:AttributeQuery
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"
xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"
ID=\""+UUID.randomUUID().toString()+"\" Version=\"2.0\"
IssueInstant=\""+formatter.format(date)+"T"+formatter2.format(date)+"Z\">" +
- "<saml:Issuer>"+attrReq.getIssuer()+"</saml:Issuer>" +
- "<saml:Subject><saml:NameID
Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified\">"+attrReq.getSubject()+"</saml:NameID></saml:Subject>";
+ private String getSAMLMessage(AttrRequest attrReq)
+ {
+ Date date = new Date();
+ Format formatter = new SimpleDateFormat("yyyy-MM-dd");
+ Format formatter2 = new SimpleDateFormat("HH:mm:ss");
+ String samlMessage = "<samlp:AttributeQuery
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"
xmlns:samlp=\"urn:oasis:names:tc:SAML:2"
+ + ".0:protocol\" ID=\"" + UUID.randomUUID().toString() + "\"
Version=\"2.0\" IssueInstant=\""
+ + formatter.format(date) + "T" + formatter2.format(date) +
"Z\">" + "<saml:Issuer>" + attrReq.getIssuer()
+ + "</saml:Issuer>"
+ + "<saml:Subject><saml:NameID
Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified\">"
+ + attrReq.getSubject() + "</saml:NameID></saml:Subject>";
Map<String, Map<String, List<String>>> attrs =
attrReq.getAttributes();
for (String urn : attrs.keySet()) {
Map<String, List<String>> data = attrs.get(urn);
Iterator<String> attrNames = data.keySet().iterator();
String friendlyName = attrNames.next();
- samlMessage += "<saml:Attribute
NameFormat=\"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\" Name=\"" + urn
+ "\" FriendlyName=\"" + friendlyName + "\">";
+ samlMessage +=
+ "<saml:Attribute
NameFormat=\"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\" Name=\"" + urn
+ + "\" FriendlyName=\"" + friendlyName + "\">";
List<String> attrsValues = data.get(friendlyName);
for (String attrsValue : attrsValues) {
@@ -119,8 +131,8 @@
samlMessage += "</saml:Attribute>";
}
- samlMessage += "</samlp:AttributeQuery>";
+ samlMessage += "</samlp:AttributeQuery>";
return samlMessage;
- }
+ }
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthNEERequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,55 +7,59 @@
import org.perfsonar.base.exceptions.PerfSONARException;
import org.perfsonar.client.base.requests.RequestGenerator;
-public class AuthNEERequestGenerator implements RequestGenerator {
- private static final String metaId = "authNmetadata";
- private static final String paramsId = "keys";
- private static final String paramKey = "SecurityToken";
- private static final String dataId = "authN1";
- private static final String
WSS_X509="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
- private static final String messageType = "AuthNEERequest";
+public class AuthNEERequestGenerator implements RequestGenerator
+{
+ private static final String META_ID = "authNmetadata";
+ private static final String PARAMS_ID = "keys";
+ private static final String PARAM_KEY = "SecurityToken";
+ private static final String DATA_ID = "authN1";
+ private static final String WSS_X509 =
+ "http://docs.oasis-open" +
".org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
+ private static final String MESSAGE_TYPE = "AuthNEERequest";
- @Override
- public Message generateRequestMessage() throws PerfSONARException {
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ @Override
+ public Message generateRequestMessage() throws PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(META_ID);
Parameters params = new Parameters();
- params.setId(paramsId);
- params.addParameter(paramKey, WSS_X509);
+ params.setId(PARAMS_ID);
+ params.addParameter(PARAM_KEY, WSS_X509);
meta.setParameters(params);
-
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(DATA_ID);
+ data.setMetadataIdRef(META_ID);
+
Message message = new Message();
- message.setType(messageType);
+ message.setType(MESSAGE_TYPE);
message.setMetadata(meta);
message.setData(data);
return message;
- }
+ }
- public Message generateRequestMessage(String secToken) throws
PerfSONARException {
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ public Message generateRequestMessage(String secToken) throws
PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(META_ID);
Parameters params = new Parameters();
- params.setId(paramsId);
- params.addParameter(paramKey, secToken);
+ params.setId(PARAMS_ID);
+ params.addParameter(PARAM_KEY, secToken);
meta.setParameters(params);
-
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(DATA_ID);
+ data.setMetadataIdRef(META_ID);
+
Message message = new Message();
- message.setType(messageType);
+ message.setType(MESSAGE_TYPE);
message.setMetadata(meta);
message.setData(data);
return message;
- }
+ }
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/authService/AuthREERequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,54 +7,58 @@
import org.perfsonar.base.exceptions.PerfSONARException;
import org.perfsonar.client.base.requests.RequestGenerator;
-public class AuthREERequestGenerator implements RequestGenerator {
- private static final String metaId = "authRmetadata";
- private static final String paramsId = "keys";
- private static final String paramKey = "SecurityToken";
- private static final String dataId = "authR1";
- private static final String
WSS_X509="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
- private static final String messageType = "AuthREERequest";
+public class AuthREERequestGenerator implements RequestGenerator
+{
+ private static final String META_ID = "authRmetadata";
+ private static final String PARAMS_ID = "keys";
+ private static final String PARAM_KEY = "SecurityToken";
+ private static final String DATA_ID = "authR1";
+ private static final String WSS_X509 =
+ "http://docs.oasis-open" +
".org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
+ private static final String MESSAGE_TYPE = "AuthREERequest";
- @Override
- public Message generateRequestMessage() throws PerfSONARException {
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ @Override
+ public Message generateRequestMessage() throws PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(META_ID);
Parameters params = new Parameters();
- params.setId(paramsId);
- params.addParameter(paramKey, WSS_X509);
+ params.setId(PARAMS_ID);
+ params.addParameter(PARAM_KEY, WSS_X509);
meta.setParameters(params);
-
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(DATA_ID);
+ data.setMetadataIdRef(META_ID);
+
Message message = new Message();
- message.setType(messageType);
+ message.setType(MESSAGE_TYPE);
message.setMetadata(meta);
message.setData(data);
return message;
- }
+ }
- public Message generateRequestMessage(String secToken) throws
PerfSONARException {
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ public Message generateRequestMessage(String secToken) throws
PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(META_ID);
Parameters params = new Parameters();
- params.setId(paramsId);
- params.addParameter(paramKey, secToken);
+ params.setId(PARAMS_ID);
+ params.addParameter(PARAM_KEY, secToken);
meta.setParameters(params);
-
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(DATA_ID);
+ data.setMetadataIdRef(META_ID);
+
Message message = new Message();
- message.setType(messageType);
+ message.setType(MESSAGE_TYPE);
message.setMetadata(meta);
message.setData(data);
return message;
- }
+ }
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/EchoRequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -14,61 +14,63 @@
/**
* @author Maciej Glowiak
- *
- * This class can generate simple LSKDeregisterRequest as a Message element
- * The only parameter you must set is "ls key value"
+ * <p/>
+ * This class can generate simple LSKDeregisterRequest as a Message
element
+ * The only parameter you must set is "ls key value"
*/
-public class EchoRequestGenerator implements RequestGenerator {
+public class EchoRequestGenerator implements RequestGenerator
+{
+ // --------------------------------------------------------------
Constants
- // --------------------------------------------------------------
Constants
-
/**
- * Message Type
+ * Message Type.
*/
- private static final String MESSAGE_TYPE = "EchoRequest";
+ 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 YES = "yes";
- // ----------------------------------------------------- Instance
variables
+ // ----------------------------------------------------- Instance
variables
- /**
- * metadata Id
- */
- private String metaId = "echo-metadata";
-
- /**
- * data Id
- */
- private String dataId = "echo-trigger";
-
+ /**
+ * metadata Id.
+ */
+ private String metaId = "echo-metadata";
+
+ /**
+ * data Id.
+ */
+ private String dataId = "echo-trigger";
+
private boolean testDBConnection = true;
private boolean testDBSchema = true;
- // --------------------------------------------------- Public
constructors
-
+ // --------------------------------------------------- Public
constructors
+
/**
- * Sets query and query type
+ * Sets query and query type.
*/
- public EchoRequestGenerator() {
+ public EchoRequestGenerator()
+ {
super();
}
// ------------------------------------------- public methods
-
+
/**
- * generates Request as Message
+ * generates Request as Message.
*/
- @Override
- public Message generateRequestMessage() throws PerfSONARException {
-
- Metadata meta = new Metadata();
- meta.setId(metaId);
+ @Override
+ public Message generateRequestMessage() throws PerfSONARException
+ {
+ Metadata meta = new Metadata();
+ meta.setId(metaId);
+
EventType evt = new EventType();
evt.setId("query-type");
evt.setEventType(LS_ECHO_EVENT_TYPE);
@@ -83,9 +85,9 @@
params.addParameter("testDBSchema", YES);
}
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
+ Data data = new Data();
+ data.setId(dataId);
+ data.setMetadataIdRef(metaId);
Message message = new Message();
message.setType(MESSAGE_TYPE);
@@ -93,41 +95,45 @@
meta.setEventType(evt);
message.setMetadata(meta);
message.setData(data);
-
- return message;
- }
+ return message;
+ }
- public String getDataId() {
- return dataId;
- }
+ public String getDataId()
+ {
+ return dataId;
+ }
- public void setDataId(String dataId) {
- this.dataId = dataId;
- }
+ public void setDataId(String dataId)
+ {
+ this.dataId = dataId;
+ }
- public String getMetaId() {
- return metaId;
- }
+ public String getMetaId()
+ {
+ return metaId;
+ }
- public void setMetaId(String metaId) {
- this.metaId = metaId;
- }
- public void setTestDBConnection(boolean testDBConnection) {
+ public void setMetaId(String metaId)
+ {
+ this.metaId = metaId;
+ }
+
+ public void setTestDBConnection(boolean testDBConnection)
+ {
this.testDBConnection = testDBConnection;
}
- public void setTestDBSchema(boolean testDBSchema) {
+ public void setTestDBSchema(boolean testDBSchema)
+ {
this.testDBSchema = testDBSchema;
}
-
-
// -------------- TEST
---------------------------------------------------
// public static void main(String[] args) throws PerfSONARException {
@@ -141,5 +147,4 @@
// }
-
} //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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSDeregisterRequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -15,120 +15,129 @@
/**
* @author Maciej Glowiak
- *
- * This class can generate simple LSKDeregisterRequest as a Message element
- * The only parameter you must set is "ls key value"
+ * <p/>
+ * This class can generate simple LSKDeregisterRequest as a Message
element
+ * The only parameter you must set is "ls key value"
*/
-public class LSDeregisterRequestGenerator implements RequestGenerator {
+public class LSDeregisterRequestGenerator implements RequestGenerator
+{
- // --------------------------------------------------------------
Constants
-
+ // --------------------------------------------------------------
Constants
+
/**
- * Message Type
+ * Message Type.
*/
- private static final String MESSAGE_TYPE = "LSKeepaliveRequest";
-
- // ----------------------------------------------------- Instance
variables
+ private static final String MESSAGE_TYPE = "LSKeepaliveRequest";
+ // ----------------------------------------------------- Instance
variables
- /**
- * metadata Id
- */
- private String metaId = "keepalive-metadata";
-
- /**
- * data Id
- */
- private String dataId = "keepalive-trigger";
-
- /**
- * data Id
- */
- private static final String keyName = "lsKey";
- /**
- * Default query
- */
- private String lsKey = "";
+ /**
+ * metadata Id.
+ */
+ private String metaId = "keepalive-metadata";
- // --------------------------------------------------- Public
constructors
-
/**
- * Sets query and query type
+ * data Id.
*/
- public LSDeregisterRequestGenerator(String lsKey) {
+ private String dataId = "keepalive-trigger";
+ /**
+ * data Id.
+ */
+ private static final String KEY_NAME = "lsKey";
+
+ /**
+ * Default query.
+ */
+ private String lsKey = "";
+
+ // --------------------------------------------------- Public
constructors
+
+ /**
+ * Sets query and query type.
+ */
+ public LSDeregisterRequestGenerator(String lsKey)
+ {
+
super();
setLsKey(lsKey);
}
// ------------------------------------------- public methods
-
+
/**
- * generates Request as Message
+ * generates Request as Message.
*/
- @Override
- public Message generateRequestMessage() throws PerfSONARException {
+ @Override
+ public Message generateRequestMessage() throws PerfSONARException
+ {
- Message message = new Message();
- message.setType(MESSAGE_TYPE);
-
- Metadata meta = new Metadata();
- meta.setId(metaId);
-
- Key key = new Key();
- key.setId("key");
- meta.setKey(key);
-
- Parameters params = new Parameters();
- params.setId("keys");
- params.addParameter(keyName, lsKey);
-
- key.setParameters(params);
- meta.setKey(key);
- message.setMetadata(meta);
+ Message message = new Message();
+ message.setType(MESSAGE_TYPE);
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
- message.setData(data);
-
- return message;
- }
+ Metadata meta = new Metadata();
+ meta.setId(metaId);
+ Key key = new Key();
+ key.setId("key");
+ meta.setKey(key);
- public String getDataId() {
- return dataId;
- }
+ Parameters params = new Parameters();
+ params.setId("keys");
+ params.addParameter(KEY_NAME, lsKey);
+ key.setParameters(params);
+ meta.setKey(key);
+ message.setMetadata(meta);
- public void setDataId(String dataId) {
- this.dataId = dataId;
- }
+ Data data = new Data();
+ data.setId(dataId);
+ data.setMetadataIdRef(metaId);
+ message.setData(data);
+ return message;
+ }
- public String getMetaId() {
- return metaId;
- }
+ public String getDataId()
+ {
+ return dataId;
+ }
- public void setMetaId(String metaId) {
- this.metaId = metaId;
- }
+ public void setDataId(String dataId)
+ {
+ this.dataId = dataId;
+ }
- public String getLsKey() {
- return lsKey;
- }
- public void setLsKey(String lsKey) {
- this.lsKey = lsKey;
- }
+ public String getMetaId()
+ {
+ return metaId;
+ }
- // -------------- TEST ---------------------------------------------------
+ public void setMetaId(String metaId)
+ {
+ this.metaId = metaId;
+ }
+
+ public String getLsKey()
+ {
+ return lsKey;
+ }
+
+ public void setLsKey(String lsKey)
+ {
+ this.lsKey = lsKey;
+ }
+
+
+ // -------------- TEST
---------------------------------------------------
+
// public static void main(String[] args) throws PerfSONARException {
//
// LSDeregisterRequestGenerator request =
@@ -140,5 +149,4 @@
//}
-
} //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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSKeepaliveRequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -13,121 +13,130 @@
import org.perfsonar.client.base.requests.RequestGenerator;
/**
+ * This class can generate simple LSKeepaliveRequest as a Message element.
+ * The only parameter you must set is "ls key value"
+ *
* @author Maciej Glowiak
- *
- * This class can generate simple LSKeepaliveRequest as a Message element
- * The only parameter you must set is "ls key value"
*/
-public class LSKeepaliveRequestGenerator implements RequestGenerator {
+public class LSKeepaliveRequestGenerator implements RequestGenerator
+{
- // --------------------------------------------------------------
Constants
-
+ // --------------------------------------------------------------
Constants
+
/**
- * Message Type
+ * Message Type.
*/
- private static final String MESSAGE_TYPE = "LSDeregisterRequest";
-
- // ----------------------------------------------------- Instance
variables
+ private static final String MESSAGE_TYPE = "LSDeregisterRequest";
+ // ----------------------------------------------------- Instance
variables
- /**
- * metadata Id
- */
- private String metaId = "deregister-metadata";
-
- /**
- * data Id
- */
- private String dataId = "deregister-trigger";
-
- /**
- * data Id
- */
- private static final String keyName = "lsKey";
- /**
- * Default query
- */
- private String lsKey = "";
+ /**
+ * metadata Id.
+ */
+ private String metaId = "deregister-metadata";
- // --------------------------------------------------- Public
constructors
-
/**
- * Sets query and query type
+ * data Id.
*/
- public LSKeepaliveRequestGenerator(String lsKey) {
+ private String dataId = "deregister-trigger";
+ /**
+ * data Id.
+ */
+ private static final String KEY_NAME = "lsKey";
+
+ /**
+ * Default query.
+ */
+ private String lsKey = "";
+
+ // --------------------------------------------------- Public
constructors
+
+ /**
+ * Sets query and query type.
+ */
+ public LSKeepaliveRequestGenerator(String lsKey)
+ {
+
super();
setLsKey(lsKey);
}
// ------------------------------------------- public methods
-
+
/**
- * generates Request as Message
+ * generates Request as Message.
*/
- @Override
- public Message generateRequestMessage() throws PerfSONARException {
+ @Override
+ public Message generateRequestMessage() throws PerfSONARException
+ {
- Message message = new Message();
- message.setType(MESSAGE_TYPE);
-
- Metadata meta = new Metadata();
- meta.setId(metaId);
-
- Key key = new Key();
- key.setId("key");
- meta.setKey(key);
-
- Parameters params = new Parameters();
- params.setId("keys");
- params.addParameter(keyName, lsKey);
-
- key.setParameters(params);
- meta.setKey(key);
- message.setMetadata(meta);
+ Message message = new Message();
+ message.setType(MESSAGE_TYPE);
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
- message.setData(data);
-
- return message;
- }
+ Metadata meta = new Metadata();
+ meta.setId(metaId);
+ Key key = new Key();
+ key.setId("key");
+ meta.setKey(key);
- public String getDataId() {
- return dataId;
- }
+ Parameters params = new Parameters();
+ params.setId("keys");
+ params.addParameter(KEY_NAME, lsKey);
+ key.setParameters(params);
+ meta.setKey(key);
+ message.setMetadata(meta);
- public void setDataId(String dataId) {
- this.dataId = dataId;
- }
+ Data data = new Data();
+ data.setId(dataId);
+ data.setMetadataIdRef(metaId);
+ message.setData(data);
+ return message;
+ }
- public String getMetaId() {
- return metaId;
- }
+ public String getDataId()
+ {
+ return dataId;
+ }
- public void setMetaId(String metaId) {
- this.metaId = metaId;
- }
+ public void setDataId(String dataId)
+ {
+ this.dataId = dataId;
+ }
- public String getLsKey() {
- return lsKey;
- }
- public void setLsKey(String lsKey) {
- this.lsKey = lsKey;
- }
+ public String getMetaId()
+ {
+ return metaId;
+ }
- // -------------- TEST ---------------------------------------------------
+ public void setMetaId(String metaId)
+ {
+ this.metaId = metaId;
+ }
+
+ public String getLsKey()
+ {
+ return lsKey;
+ }
+
+ public void setLsKey(String lsKey)
+ {
+ this.lsKey = lsKey;
+ }
+
+
+ // -------------- TEST
---------------------------------------------------
+
// public static void main(String[] args) throws PerfSONARException {
//
// LSKeepaliveRequestGenerator request =
@@ -139,5 +148,4 @@
// }
-
} //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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSQueryRequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -15,53 +15,55 @@
/**
* @author Maciej Glowiak
- *
- * This class can generate simple LSQueryRequest as a Message element
- * The only parameter you must set is "query"
+ * <p/>
+ * This class can generate simple LSQueryRequest as a Message element
+ * The only parameter you must set is "query"
*/
-public class LSQueryRequestGenerator implements RequestGenerator {
+public class LSQueryRequestGenerator implements RequestGenerator
+{
- // --------------------------------------------------------------
Constants
-
+ // --------------------------------------------------------------
Constants
+
/**
- * Default query type to LS (eventType element)
+ * Default query type to LS (eventType element).
*/
private static final String DEFAULT_QUERY_TYPE = "service.lookup.xquery";
-
+
/**
- * Message Type
+ * Message Type.
*/
- private static final String MESSAGE_TYPE = "LSQueryRequest";
-
- // ----------------------------------------------------- Instance
variables
-
- /**
- * metadata Id
- */
- private String metaId = "query-metadata";
-
- /**
- * data Id
- */
- private String dataId = "query-trigger";
-
- /**
- * Query Type - eventType
- */
- private String queryType = DEFAULT_QUERY_TYPE;
-
- /**
- * Default query
- */
- private String query = "";
+ private static final String MESSAGE_TYPE = "LSQueryRequest";
- // --------------------------------------------------- Public
constructors
-
+ // ----------------------------------------------------- Instance
variables
+
/**
- * Sets query and query type
+ * metadata Id.
*/
- public LSQueryRequestGenerator(String query, String queryType) {
+ private String metaId = "query-metadata";
+ /**
+ * data Id.
+ */
+ private String dataId = "query-trigger";
+
+ /**
+ * Query Type - eventType.
+ */
+ private String queryType = DEFAULT_QUERY_TYPE;
+
+ /**
+ * Default query.
+ */
+ private String query = "";
+
+ // --------------------------------------------------- Public
constructors
+
+ /**
+ * Sets query and query type.
+ */
+ public LSQueryRequestGenerator(String query, String queryType)
+ {
+
super();
setQuery(query);
setQueryType(queryType);
@@ -71,9 +73,11 @@
/**
* Sets query. Query type is set to default - see: DEFAULT_QUERY_TYPE
+ *
* @param query
*/
- public LSQueryRequestGenerator(String query) {
+ public LSQueryRequestGenerator(String query)
+ {
super();
setQuery(query);
@@ -82,82 +86,91 @@
}
// ------------------------------------------- public methods
-
+
/**
- * generates Request as Message
+ * generates Request as Message.
*/
- @Override
- public Message generateRequestMessage() throws PerfSONARException {
+ @Override
+ public Message generateRequestMessage() throws PerfSONARException
+ {
- Message message = new Message();
- message.setType(MESSAGE_TYPE);
-
- Metadata meta = new Metadata();
- meta.setId(metaId);
-
- Subject subject = new Subject();
- subject.setId("query");
- subject.setSubject(query );
- meta.setSubject(subject);
-
- EventType evt = new EventType();
- evt.setId("query-type");
- evt.setEventType(queryType);
- meta.setEventType(evt);
-
- Data data = new Data();
- data.setId(dataId);
- data.setMetadataIdRef(metaId);
-
- message.setMetadata(meta);
- message.setData(data);
-
- return message;
- }
+ Message message = new Message();
+ message.setType(MESSAGE_TYPE);
+ Metadata meta = new Metadata();
+ meta.setId(metaId);
- public String getDataId() {
- return dataId;
- }
+ Subject subject = new Subject();
+ subject.setId("query");
+ subject.setSubject(query);
+ meta.setSubject(subject);
+ EventType evt = new EventType();
+ evt.setId("query-type");
+ evt.setEventType(queryType);
+ meta.setEventType(evt);
- public void setDataId(String dataId) {
- this.dataId = dataId;
- }
+ Data data = new Data();
+ data.setId(dataId);
+ data.setMetadataIdRef(metaId);
+ message.setMetadata(meta);
+ message.setData(data);
- public String getMetaId() {
- return metaId;
- }
+ return message;
+ }
- public void setMetaId(String metaId) {
- this.metaId = metaId;
- }
+ public String getDataId()
+ {
+ return dataId;
+ }
- public String getQuery() {
- return query;
- }
+ public void setDataId(String dataId)
+ {
+ this.dataId = dataId;
+ }
- public void setQuery(String query) {
- this.query = query;
- }
+ public String getMetaId()
+ {
+ return metaId;
+ }
- public String getQueryType() {
- return queryType;
- }
+ public void setMetaId(String metaId)
+ {
+ this.metaId = metaId;
+ }
- public void setQueryType(String queryType) {
- this.queryType = queryType;
- }
+ public String getQuery()
+ {
+ return query;
+ }
- // -------------- TEST ---------------------------------------------------
+ public void setQuery(String query)
+ {
+ this.query = query;
+ }
+
+ public String getQueryType()
+ {
+ return queryType;
+ }
+
+
+ public void setQueryType(String queryType)
+ {
+ this.queryType = queryType;
+ }
+
+
+ // -------------- TEST
---------------------------------------------------
+
// public static void main(String[] args) throws PerfSONARException {
//
// LSQueryRequestGenerator request =
@@ -169,5 +182,4 @@
// }
-
} //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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/requests/lookupService/LSRegisterRequestGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -28,28 +28,31 @@
import org.perfsonar.client.base.requests.RequestGenerator;
/**
- * This class is responsible for creating LSRegisterRequest
+ * This class is responsible for creating LSRegisterRequest.
+ *
* @author Maciej Glowiak
- *
*/
-public class LSRegisterRequestGenerator implements RequestGenerator {
+public class LSRegisterRequestGenerator implements RequestGenerator
+{
private static final String METADATA_ID = "serviceLookupInfo";
- public final static String SERVICE_EVENT_TYPE =
"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/service/2.0";
- public final static String SUMMARY_EVENT_TYPE =
"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/summary/2.0";
+ public static final String SERVICE_EVENT_TYPE =
+ "http://ogf" +
".org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/service/2.0";
+ public static final String SUMMARY_EVENT_TYPE =
+ "http://ogf" +
".org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/summary/2.0";
- String eventType = SERVICE_EVENT_TYPE;
+ private String eventType = SERVICE_EVENT_TYPE;
// ----------------------------------------------------- Instance
variables
/**
- * Map of common parameters (in metadata)
+ * Map of common parameters (in metadata).
*/
- private Map<String,String> commonParameters;
+ private Map<String, String> commonParameters;
/**
- * data blocks as Strings
+ * data blocks as Strings.
*/
private String[] metadataElements;
@@ -60,14 +63,15 @@
@Override
- public Message generateRequestMessage() throws PerfSONARException {
+ public Message generateRequestMessage() throws PerfSONARException
+ {
//System.out.println("LSRegisterRequestGenerator: generateRequest");
//message
Message message = new Message();
message.setType("LSRegisterRequest");
-
message.setId("automatic-ls-registration-"+System.currentTimeMillis());
+ message.setId("automatic-ls-registration-" +
System.currentTimeMillis());
//metadata
Metadata metadata = new Metadata();
@@ -95,48 +99,42 @@
subject.setService(service);
//access point -- mandatory
- String accessPointString= commonParameters.get("access_point");
- if (accessPointString==null) {
- throw new PerfSONARException(
- "error.lsregistrator.no_accesspoint",
- "AccessPoint parameter was not found. Registration failed");
+ String accessPointString = commonParameters.get("access_point");
+ if (accessPointString == null) {
+ throw new
PerfSONARException("error.lsregistrator.no_accesspoint",
+ "AccessPoint parameter was not
found. Registration failed");
}
if (accessPointString != null && accessPointString.isEmpty()) {
- throw new PerfSONARException(
- "error.lsregistrator.no_accesspoint",
- "AccessPoint parameter was empty. Registration failed");
+ throw new
PerfSONARException("error.lsregistrator.no_accesspoint",
+ "AccessPoint parameter was empty.
Registration failed");
}
AccessPoint ap = new AccessPoint();
ap.setAccessPoint(accessPointString);
service.setAccessPoint(ap);
//service name -- mandatory
- String serviceNameString= commonParameters.get("service_name");
- if (serviceNameString==null) {
- throw new PerfSONARException(
- "error.lsregistrator.no_servicename",
- "ServiceName parameter was not found. Registration failed");
+ String serviceNameString = commonParameters.get("service_name");
+ if (serviceNameString == null) {
+ throw new
PerfSONARException("error.lsregistrator.no_servicename",
+ "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");
+ throw new
PerfSONARException("error.lsregistrator.no_servicename",
+ "ServiceName parameter was empty.
Registration failed");
}
ServiceName sn = new ServiceName();
sn.setServiceName(serviceNameString);
service.setServiceName(sn);
//service type -- mandatory
- String serviceTypeString= commonParameters.get("service_type");
- if (serviceTypeString==null) {
- throw new PerfSONARException(
- "error.lsregistrator.no_servicetype",
- "ServiceType parameter was not found. Registration failed");
+ String serviceTypeString = commonParameters.get("service_type");
+ if (serviceTypeString == null) {
+ throw new
PerfSONARException("error.lsregistrator.no_servicetype",
+ "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");
+ throw new
PerfSONARException("error.lsregistrator.no_servicename",
+ "ServiceType parameter was empty.
Registration failed");
}
ServiceType st = new ServiceType();
st.setServiceType(serviceTypeString);
@@ -144,8 +142,8 @@
String param;
//service description -- optional
- param= commonParameters.get("service_description");
- if (param!=null) {
+ param = commonParameters.get("service_description");
+ if (param != null) {
//System.out.println(param);
ServiceDescription sd = new ServiceDescription();
sd.setServiceDescription(param);
@@ -153,40 +151,40 @@
}
//organization name - optional
- param= commonParameters.get("organization_name");
- if (param!=null) {
+ param = commonParameters.get("organization_name");
+ if (param != null) {
Organization o = new Organization();
o.setOrganization(param);
service.setOrganization(o);
}
//service version - optional
- param= commonParameters.get("service_version");
- if (param!=null) {
+ param = commonParameters.get("service_version");
+ if (param != null) {
ServiceVersion sv = new ServiceVersion();
sv.setServiceVersion(param);
service.setServiceVersion(sv);
}
//contact-email - optional
- param= commonParameters.get("contact_email");
- if (param!=null) {
+ param = commonParameters.get("contact_email");
+ if (param != null) {
ContactEmail ce = new ContactEmail();
ce.setContactEmail(param);
service.setContactEmail(ce);
}
//add supported event types
- param= commonParameters.get("supported_event_types");
- if (param!=null) {
+ 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];
+ for (int i = 0; i < supportedEventTypes.length; i++) {
+ String et = supportedEventTypes[i];
if (!(et != null && et.isEmpty())) {
eventTypes.addParameter("supportedEventType_" + i, et);
}
@@ -202,44 +200,39 @@
//Create DATAs
- if (metadataElements!=null) {
+ 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
- if (parserFile==null) {
- parserFile = ((ConfigurationComponent)
AuxiliaryComponentManager.getInstance()
-
.getComponent(ComponentNames.CONFIG)).getProperty("service.sax_parser.config");
+ if (parserFile == null) {
+ parserFile = ((ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(
+
ComponentNames.CONFIG)).getProperty("service.sax_parser.config");
File file = AuxiliaryComponentManager.lookupFile(parserFile);
- if(file!=null) {
- parserFile = file.getAbsolutePath();
+ if (file != null) {
+ parserFile = file.getAbsolutePath();
}
}
- for (int i=0; i<metadataElements.length; i++) {
+ 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/\" "
+ 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/\" "
+ "xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\" "
+ "xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\" "
- +
"xmlns:nmwgtopo=\"http://ggf.org/ns/nmwg/topology/2.0/\" "
- + ">\n"
+ +
"xmlns:nmwgtopo=\"http://ggf.org/ns/nmwg/topology/2.0/\" " + ">\n"
- + "<nmwg:data id=\"data"+i+"\"
metadataIdRef=\"serviceLookupInfo\">\n"
- + metadataElements[i]
+ + "<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",
- parserFile);
+ Map<String, Element> dataFromXML =
XMLUtils.getElementFromXML(xml, "data", parserFile);
- if (dataFromXML!=null) {
+ if (dataFromXML != null) {
Collection<Element> collection = dataFromXML.values();
for (Element elem : collection) {
@@ -253,7 +246,7 @@
}
//finally if there are no data elements, create one
- if (message.getDataArray().length==0) {
+ if (message.getDataArray().length == 0) {
Data d = new Data();
d.setId("data");
@@ -266,40 +259,47 @@
}
- public void setCommonParameters(Map<String,String> commonParameters) {
+ public void setCommonParameters(Map<String, String> commonParameters)
+ {
this.commonParameters = commonParameters;
}
- public String[] getMetadataElements() {
+ public String[] getMetadataElements()
+ {
return metadataElements;
}
- public void setMetadataElements(String[] metadata) {
+ public void setMetadataElements(String[] metadata)
+ {
this.metadataElements = metadata;
}
- public Map<String,String> getCommonParameters() {
+ public Map<String, String> getCommonParameters()
+ {
return commonParameters;
}
- public String getParserFile() {
+ public String getParserFile()
+ {
return parserFile;
}
- public void setParserFile(String parserFile) {
+ public void setParserFile(String parserFile)
+ {
this.parserFile = parserFile;
}
- public void setEventType(String evt) {
+ public void setEventType(String evt)
+ {
eventType = evt;
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/XQueryExpression.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,53 +7,53 @@
/**
* @author Maciej Glowiak
- *
- * XQuery expression. Can generate specific XQuery expression string
- *
+ * <p/>
+ * XQuery expression. Can generate specific XQuery expression string
*/
-public interface XQueryExpression {
+public interface XQueryExpression
+{
/**
- * The name of the store collection (containing LS data/metadata
+ * The name of the store collection (containing LS data/metadata.
*/
- public static final String LS_STORE_COLLECTION_TYPE = "LSStore";
+ String LS_STORE_COLLECTION_TYPE = "LSStore";
/**
- * The name of the control collection of LS
+ * The name of the control collection of LS.
*/
- public static final String LS_STORE_CONTROL_COLLECTION_TYPE =
"LSStore-control";
+ String LS_STORE_CONTROL_COLLECTION_TYPE = "LSStore-control";
- public final static String DECLARE_NMWG_NAMESPACE =
- "declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/'; \n";
+ 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 =
- "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";
+ 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";
- public static final String SERVICE_TYPE = "psservice:serviceType";
- public static final String SERVICE_NAME = "psservice:serviceName";
- public static final String ACCESS_POINT = "psservice:accessPoint";
-
- public static final String SERVICE_DESCRIPTION =
"psservice:serviceDescription";
- 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";
+ String SERVICE_TYPE = "psservice:serviceType";
+ String SERVICE_NAME = "psservice:serviceName";
+ String ACCESS_POINT = "psservice:accessPoint";
- public static final String EVENT_TYPE = "nmwg:eventType";
+ String SERVICE_DESCRIPTION = "psservice:serviceDescription";
+ String ORGANIZATION_NAME = "psservice:organization_name";
+ String SERVICE_VERSION = "psservice:serviceVersion";
+ String CONTACT_EMAIL = "psservice:contact_email";
+ String EVENT_TYPE = "nmwg:eventType";
+
/**
- * Method returns XQuery expression
+ * Method returns XQuery expression.
+ *
* @return
*/
- public String generateExpression();
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/base/xquery/lookupService/GenericXQueryExpression.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,15 +7,13 @@
/**
* This class represents generic XQuery Expression.
- * @author Maciej Glowiak
*
+ * @author Maciej Glowiak
*/
-public class GenericXQueryExpression implements XQueryExpression {
-
-
+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;
@@ -27,8 +25,7 @@
// ---------------------------------------------------- instance
variables
- private final HashMap<String,Condition> conditions
- = new HashMap<String,Condition>();
+ private final HashMap<String, Condition> conditions = new
HashMap<String, Condition>();
private int resultType = RETURN_SERVICE_URL;
@@ -36,7 +33,8 @@
// ------------------------------------------------------------
constructor
- public GenericXQueryExpression() {
+ public GenericXQueryExpression()
+ {
}
@@ -44,7 +42,8 @@
@Override
- public String generateExpression() {
+ public String generateExpression()
+ {
StringBuffer xq = new StringBuffer();
@@ -66,17 +65,17 @@
}
+ protected StringBuffer addLetDataExpression(StringBuffer xq)
+ {
- protected StringBuffer addLetDataExpression(StringBuffer xq) {
-
- xq.append(
- "let $d :=
/nmwg:store[@type='LSStore']/nmwg:data[@metadataIdRef=$m/@id]");
+ xq.append("let $d :=
/nmwg:store[@type='LSStore']/nmwg:data[@metadataIdRef=$m/@id]");
return xq;
}
- protected StringBuffer addDeclarations(StringBuffer xq) {
+ protected StringBuffer addDeclarations(StringBuffer xq)
+ {
//DECLARE expression - namespace declaration
@@ -86,7 +85,8 @@
}
- protected StringBuffer addForExpression(StringBuffer xq) {
+ protected StringBuffer addForExpression(StringBuffer xq)
+ {
//FOR expression
@@ -96,21 +96,20 @@
}
- protected StringBuffer addWhereExpression(
- StringBuffer xq, Collection<Condition> conditions) {
+ protected StringBuffer addWhereExpression(StringBuffer xq,
Collection<Condition> conditions)
+ {
//WHERE expression
if (!conditions.isEmpty()) {
xq.append("where\n");
- int i=0;
+ int i = 0;
for (Condition c : conditions) {
if (i > 0) {
xq.append("and\n");
}
i++;
- xq.append(c.getXQueryCondition(
- ""));
+ xq.append(c.getXQueryCondition(""));
xq.append("\n");
}
}
@@ -118,7 +117,8 @@
}
- protected StringBuffer addReturnExpression(StringBuffer xq, int
resultType) {
+ protected StringBuffer addReturnExpression(StringBuffer xq, int
resultType)
+ {
//RETURN expression
xq.append("return ");
@@ -141,108 +141,76 @@
return xq;
}
- public void addMetadataCondition_Is(String name, String value) {
+ public void addMetadataConditionIs(String name, String value)
+ {
- conditions.put(
- name,
- new Condition(
- PSSERVICE_PREFIX+name,
- value,
- Condition.IS));
+ conditions.put(name, new Condition(PSSERVICE_PREFIX + name, value,
Condition.IS));
}
- public void addMetadataCondition_Contains(String name, String value) {
+ public void addMetadataConditionContains(String name, String value)
+ {
- conditions.put(
- name,
- new Condition(
- PSSERVICE_PREFIX+name,
- value,
- Condition.CONTAINS));
+ conditions.put(name, new Condition(PSSERVICE_PREFIX + name, value,
Condition.CONTAINS));
}
- public void addMetadataCondition_Prefix(String name, String value) {
+ public void addMetadataConditionPrefix(String name, String value)
+ {
- conditions.put(
- name,
- new Condition(
- PSSERVICE_PREFIX+name,
- value,
- Condition.PREFIX));
+ conditions.put(name, new Condition(PSSERVICE_PREFIX + name, value,
Condition.PREFIX));
}
- public void addMetadataCondition_Suffix(String name, String value) {
+ public void addMetadataConditionSuffix(String name, String value)
+ {
- conditions.put(
- name,
- new Condition(
- PSSERVICE_PREFIX+name,
- value,
- Condition.SUFFIX));
+ conditions.put(name, new Condition(PSSERVICE_PREFIX + name, value,
Condition.SUFFIX));
}
- public void addDataCondition_Is(String name, String value) {
+ public void addDataConditionIs(String name, String value)
+ {
isLetData = true;
- conditions.put(
- name,
- new Condition(
- DATA_PREFIX+name,
- value,
- Condition.IS));
+ conditions.put(name, new Condition(DATA_PREFIX + name, value,
Condition.IS));
}
- public void addDataCondition_Contains(String name, String value) {
+ public void addDataConditionContains(String name, String value)
+ {
isLetData = true;
- conditions.put(
- name,
- new Condition(
- DATA_PREFIX+name,
- value,
- Condition.CONTAINS));
+ conditions.put(name, new Condition(DATA_PREFIX + name, value,
Condition.CONTAINS));
}
- public void addDataCondition_Prefix(String name, String value) {
+ public void addDataConditionPrefix(String name, String value)
+ {
isLetData = true;
- conditions.put(
- name,
- new Condition(
- DATA_PREFIX+name,
- value,
- Condition.PREFIX));
+ conditions.put(name, new Condition(DATA_PREFIX + name, value,
Condition.PREFIX));
}
- public void addDataCondition_Suffix(String name, String value) {
+ public void addDataConditionSuffix(String name, String value)
+ {
isLetData = true;
- conditions.put(
- name,
- new Condition(
- DATA_PREFIX+name,
- value,
- Condition.SUFFIX));
+ conditions.put(name, new Condition(DATA_PREFIX + name, value,
Condition.SUFFIX));
}
+ public void setResultType(int resultType)
+ {
- public void setResultType(int resultType) {
-
- if (resultType==RETURN_FULL_LOOKUP_INFO) {
+ if (resultType == RETURN_FULL_LOOKUP_INFO) {
isLetData = true;
}
@@ -254,44 +222,50 @@
// ------------------------------------------------------------ Inner
class
- protected class Condition {
+ protected class Condition
+ {
+ public static final int IS = 0;
+ public static final int PREFIX = 1;
+ public static final int SUFFIX = 2;
+ public static final int CONTAINS = 3;
- 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 final String name;
+ private final String value;
+ private int conditionType = 0;
- private final String name;
- private final String value;
- private int conditionType = 0;
+ public Condition(String name, String value, int conditionType)
+ {
+ this.name = name;
+ this.value = value;
+ this.conditionType = conditionType;
+ }
- public Condition(String name, String value, int conditionType) {
- this.name = name;
- this.value = value;
- this.conditionType = conditionType;
- }
-
- public int getConditionType() {
+ public int getConditionType()
+ {
return conditionType;
}
- public String getName() {
+ public String getName()
+ {
return name;
}
- public String getValue() {
+ public String getValue()
+ {
return value;
}
- public String getXQueryCondition() {
+ public String getXQueryCondition()
+ {
return getXQueryCondition(null);
}
- public String getXQueryCondition(String prefix) {
+ public String getXQueryCondition(String prefix)
+ {
StringBuilder sb = new StringBuilder();
if (getConditionType() == IS) {
sb.append("(");
- if (prefix!=null) {
+ if (prefix != null) {
sb.append(prefix);
}
sb.append(name);
@@ -301,7 +275,7 @@
sb.append("')");
} else if (getConditionType() == CONTAINS) {
sb.append("contains(");
- if (prefix!=null) {
+ if (prefix != null) {
sb.append(prefix);
}
sb.append(name);
@@ -311,7 +285,7 @@
sb.append("')");
} else if (getConditionType() == PREFIX) {
sb.append("starts-with(");
- if (prefix!=null) {
+ if (prefix != null) {
sb.append(prefix);
}
sb.append(name);
@@ -321,7 +295,7 @@
sb.append("')");
} else if (getConditionType() == SUFFIX) {
sb.append("ends-with(");
- if (prefix!=null) {
+ if (prefix != null) {
sb.append(prefix);
}
sb.append(name);
@@ -338,11 +312,12 @@
// ----------------------------------------------------------- Main -
test
- public static void main (String[] s) {
+ public static void main(String[] s)
+ {
GenericXQueryExpression g = new GenericXQueryExpression();
- g.addMetadataCondition_Is(SERVICE_TYPE, "MA");
- g.addMetadataCondition_Contains(SERVICE_NAME, "PSNC");
- //g.addDataCondition_Is(EVENT_TYPE,"utilization");
+ g.addMetadataConditionIs(SERVICE_TYPE, "MA");
+ g.addMetadataConditionContains(SERVICE_NAME, "PSNC");
+ //g.addDataConditionIs(EVENT_TYPE,"utilization");
//g.setResultType(RETURN_FULL_LOOKUP_INFO);
String xquery = g.generateExpression();
System.out.println(xquery);
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClient.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -28,23 +28,20 @@
/**
- * Class which provides the basic web service (Doc/Lit) client capability
- * without stubs.
+ * Class which provides the basic web service (Doc/Lit) client capability
+ * without stubs.
*
- * @author loukik
+ * @author loukik
*/
-public class SOAPClient {
-
-
+public class SOAPClient
+{
// suppress deprication for outputter.setIndent/setNewlines methods
// jwb
- @SuppressWarnings(value={"deprecation"})
- public void makeRequest(String[] args) {
-
-
+ @SuppressWarnings(value = { "deprecation" })
+ public void makeRequest(String[] args)
+ {
try {
-
String endPoint;
String inputFile;
String outputFile;
@@ -57,7 +54,7 @@
} else {
- System.out.println("Error: Wrong number of parameters!!!");
+ System.out.println("Error: Wrong number of parameters!!!");
return;
}
@@ -68,9 +65,9 @@
// prepare to call - set service elements
Service service = new Service();
- Call call = (Call)service.createCall();
+ Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(endPoint));
- call.setOperationName(new
QName("http://soapinterop.org/","submit"));
+ call.setOperationName(new QName("http://soapinterop.org/",
"submit"));
// read the request into a org.w3c.DOM.Document
@@ -85,21 +82,18 @@
// build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
- new SOAPBodyElement(request.getDocumentElement());
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(request.getDocumentElement());
// get a timestamp.
- double startTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double startTime = new
Long(System.currentTimeMillis()).doubleValue();
// call on the end point
- Object resultObject = call.invoke(new Object[] {requestMessage});
+ Object resultObject = call.invoke(new Object[]{requestMessage});
// get another timestamp
- double endTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ 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
@@ -109,7 +103,7 @@
try {
- resultSBE= (SOAPBodyElement)((Vector)resultObject).get(0);
+ resultSBE = (SOAPBodyElement) ((Vector) resultObject).get(0);
// change it to document - here is where validity
// can be checked..
@@ -119,18 +113,18 @@
File response = new File(outputFile);
FileWriter outWriter = new FileWriter(response);
- OutputFormat format = new OutputFormat( result );
+ OutputFormat format = new OutputFormat(result);
format.setIndent(4);
format.setIndenting(true);
format.setLineSeparator("\n");
- XMLSerializer serial = new XMLSerializer(outWriter, format );
+ XMLSerializer serial = new XMLSerializer(outWriter, format);
serial.asDOMSerializer();
- serial.serialize( result.getDocumentElement() );
+ serial.serialize(result.getDocumentElement());
outWriter.close();
-
+
} catch (ClassCastException e) {
e.printStackTrace();
System.out.println("SOAPClient.makeRequest: We didn't get a
Vector of SOAPBodyElements!");
@@ -140,9 +134,9 @@
}
- System.out.println("time taken :"+((endTime-startTime)/1000d)+"
secs");
+ System.out.println("time taken :" + ((endTime - startTime) /
1000d) + " secs");
- } catch(Exception e) {
+ } catch (Exception e) {
System.err.println("SOAPClient.makeRequest: General exception
encountered by client");
e.printStackTrace();
}
@@ -150,65 +144,60 @@
System.out.println("Client exiting");
}
- public Document makeRequest(String endPoint, Message request) throws
PerfSONARException{
- Document result = null;
- try {
+ public Document makeRequest(String endPoint, Message request) throws
PerfSONARException
+ {
+ Document result = null;
+ try {
- // 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"));
+ // 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"));
- Document requestDocument =
XMLUtils.convertMessageToDOM(request);
+ Document requestDocument = XMLUtils.convertMessageToDOM(request);
- // build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage = new SOAPBodyElement(
- requestDocument.getDocumentElement());
+ // build a SOAPBodyElement from the document
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(requestDocument.getDocumentElement());
- // call on the end point
- Object resultObject = call.invoke(new Object[] {
requestMessage });
+ // call on the end point
+ Object resultObject = call.invoke(new Object[]{requestMessage});
- // 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;
-
- try {
+ // 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;
- resultSBE = (SOAPBodyElement) ((Vector)
resultObject).get(0);
+ try {
- // change it to document - here is where
validity
- // can be checked..
- result = resultSBE.getAsDocument();
-
- } catch (ClassCastException e) {
- e.printStackTrace();
- System.out
-
.println("SOAPClient.makeRequest: We didn't get a Vector of
SOAPBodyElements!");
- } catch (Exception e) {
- System.out
-
.println("SOAPClient.makeRequest: General exception while retrieving report");
- e.printStackTrace();
- }
-
- } catch (Exception e) {
- System.err
- .println("SOAPClient.makeRequest:
General exception encountered by client");
- e.printStackTrace();
- }
- return result;
- }
+ resultSBE = (SOAPBodyElement) ((Vector) resultObject).get(0);
- public static void main(String[] args) {
+ // change it to document - here is where validity
+ // can be checked..
+ result = resultSBE.getAsDocument();
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ System.out.println("SOAPClient.makeRequest: We didn't get a
Vector of SOAPBodyElements!");
+ } catch (Exception e) {
+ System.out.println("SOAPClient.makeRequest: General
exception while retrieving report");
+ e.printStackTrace();
+ }
+
+ } catch (Exception e) {
+ System.err.println("SOAPClient.makeRequest: General exception
encountered by client");
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ public static void main(String[] args)
+ {
+
SOAPClient doclitClient = new SOAPClient();
doclitClient.makeRequest(args);
}
-
} //SOAPClient
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPClientMulti.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -25,15 +25,16 @@
/**
- * 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.
+ * 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.
*
- * @author urosj
+ * @author urosj
*/
-public class SOAPClientMulti extends Thread {
+public class SOAPClientMulti extends Thread
+{
private String endPoint = null;
private String inputFile = null;
@@ -45,13 +46,14 @@
private int threadCount = 0;
// Dummy constructor used by static object
- public SOAPClientMulti() {
+ public SOAPClientMulti()
+ {
parent = null;
}
// Constructor filling endPoint, inputFile, outputFile vars
- private SOAPClientMulti(SOAPClientMulti parent,
- String endPoint, String inputFile, String outputFile) {
+ private SOAPClientMulti(SOAPClientMulti parent, String endPoint, String
inputFile, String outputFile)
+ {
this.parent = parent;
this.endPoint = endPoint;
this.inputFile = inputFile;
@@ -61,16 +63,19 @@
// suppress deprication for outputter.setIndent/setNewlines methods
// jwb
- private String getThreadPrefix() {
+ private String getThreadPrefix()
+ {
return "[" + Thread.currentThread().getId() + "] ";
}
// Our println, which prefixes each println with getThreadPrefix
- private void println(String str) {
+ private void println(String str)
+ {
System.out.println(getThreadPrefix() + str);
}
- public void makeMultiRequest(String[] args) {
+ public void makeMultiRequest(String[] args)
+ {
// Requires triples of endPoint, inputFile, outputFile,
// example of args:
// http://localhost:8080/axis/services/TCMPService infile1 outfile1
@@ -78,7 +83,7 @@
if (args.length < 3 || args.length % 3 != 0) {
System.err.println("Usage: SOAPClientMulti endPoint1 inputFile1 "
- + "outputfile1 [ endPoint2 inputFile2 outputFile2 [ ... ]
]");
+ + "outputfile1 [ endPoint2 inputFile2
outputFile2 [ ... ] ]");
System.exit(1);
}
@@ -105,20 +110,22 @@
}
@Override
- public void run() {
+ public void run()
+ {
try {
synchronized (parent) {
parent.threadCount++;
parent.wait();
}
} catch (Exception e) {
- println("Caught exception while waiting: " + e);
+ println("Caught exception while waiting: " + e);
}
makeRequest();
}
- @SuppressWarnings(value={"deprecation"})
- private void makeRequest() {
+ @SuppressWarnings(value = { "deprecation" })
+ private void makeRequest()
+ {
try {
@@ -129,9 +136,9 @@
// prepare to call - set service elements
Service service = new Service();
- Call call = (Call)service.createCall();
+ Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(this.endPoint));
- call.setOperationName(new
QName("http://soapinterop.org/","submit"));
+ call.setOperationName(new QName("http://soapinterop.org/",
"submit"));
// read the request into a org.w3c.DOM.Document- this is read
@@ -147,21 +154,18 @@
// build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
- new SOAPBodyElement(request.getDocumentElement());
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(request.getDocumentElement());
// get a timestamp.
- double startTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double startTime = new
Long(System.currentTimeMillis()).doubleValue();
// call on the end point
- Object resultObject = call.invoke(new Object[] {requestMessage});
+ Object resultObject = call.invoke(new Object[]{requestMessage});
// get another timestamp
- double endTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ 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
@@ -171,7 +175,7 @@
try {
- resultSBE= (SOAPBodyElement)((Vector)resultObject).get(0);
+ resultSBE = (SOAPBodyElement) ((Vector) resultObject).get(0);
// change it to document - here is where validity
// can be checked..
@@ -181,14 +185,14 @@
File response = new File(this.outputFile);
FileWriter outWriter = new FileWriter(response);
- OutputFormat format = new OutputFormat( result );
+ OutputFormat format = new OutputFormat(result);
format.setIndent(4);
format.setIndenting(true);
format.setLineSeparator("\n");
- XMLSerializer serial = new XMLSerializer(outWriter, format );
+ XMLSerializer serial = new XMLSerializer(outWriter, format);
serial.asDOMSerializer();
- serial.serialize( result.getDocumentElement() );
+ serial.serialize(result.getDocumentElement());
outWriter.close();
@@ -201,9 +205,9 @@
}
println(result.toString());
- println("time taken :"+((endTime-startTime)/1000d)+" secs");
+ println("time taken :" + ((endTime - startTime) / 1000d) + "
secs");
- } catch(Exception e) {
+ } catch (Exception e) {
println("SOAPClient.makeRequest: General exception encountered
by client");
e.printStackTrace();
}
@@ -212,14 +216,13 @@
}
+ public static void main(String[] args)
+ {
- public static void main(String[] args) {
-
SOAPClientMulti doclitClient = new SOAPClientMulti();
doclitClient.makeMultiRequest(args);
}
-
} //SOAPClient
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPUbCClient.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -41,74 +41,76 @@
import org.perfsonar.client.base.authn.saslca.UserID;
import org.w3c.dom.Document;
-public class SOAPUbCClient {
- private UserID userID;
+public class SOAPUbCClient
+{
+ private UserID userID;
- private SASLCAClientConfiguration clientConfig;
+ private SASLCAClientConfiguration clientConfig;
- private SASLCAClient client;
+ private SASLCAClient client;
- public void test(String[] args) {
- try {
- String saslCAServer;
- String saslCAPort;
- String tsFile;
- String tsPassword;
- String tsType;
- String username;
- String userpassword;
- String endPoint;
- String messageFile;
+ public void test(String[] args)
+ {
+ try {
+ String saslCAServer;
+ String saslCAPort;
+ String tsFile;
+ String tsPassword;
+ String tsType;
+ String username;
+ String userpassword;
+ String endPoint;
+ String messageFile;
- if (args.length == 9) {
- saslCAServer = args[0];
- saslCAPort = args[1];
- tsFile = args[2];
- tsPassword = args[3];
- tsType = args[4];
- username = args[5];
- userpassword = args[6];
- endPoint = args[7];
- messageFile = args[8];
- } else {
- System.out.println("Error: Wrong number (" +
args.length
- + "!= 9) of parameters!!!");
- return;
- }
- System.out.println("SASL CA Server: " + saslCAServer);
- System.out.println("SASL CA Port: " + saslCAPort);
- System.out.println("TrustStore File: " + tsFile);
- System.out.println("TrustStore Password: " +
tsPassword);
- System.out.println("TrustStore Type: " + tsType);
- System.out.println("Username: " + username);
- System.out.println("Password: " + userpassword);
- System.out.println("End Point: " + endPoint);
- System.out.println("Message file: " + messageFile);
-
- System.setProperty("javax.net.ssl.trustStore",
tsFile);
-
System.setProperty("javax.net.ssl.trustStorePassword", tsPassword);
- System.setProperty("javax.net.ssl.trustStoreType",
tsType);
+ if (args.length == 9) {
+ saslCAServer = args[0];
+ saslCAPort = args[1];
+ tsFile = args[2];
+ tsPassword = args[3];
+ tsType = args[4];
+ username = args[5];
+ userpassword = args[6];
+ endPoint = args[7];
+ messageFile = args[8];
+ } else {
+ System.out.println("Error: Wrong number (" + args.length +
"!= 9) of parameters!!!");
+ return;
+ }
+ System.out.println("SASL CA Server: " + saslCAServer);
+ System.out.println("SASL CA Port: " + saslCAPort);
+ System.out.println("TrustStore File: " + tsFile);
+ System.out.println("TrustStore Password: " + tsPassword);
+ System.out.println("TrustStore Type: " + tsType);
+ System.out.println("Username: " + username);
+ System.out.println("Password: " + userpassword);
+ System.out.println("End Point: " + endPoint);
+ System.out.println("Message file: " + messageFile);
- userID = new UserID(username, userpassword);
- clientConfig = new
SASLCAClientConfiguration(saslCAServer,Integer.parseInt(saslCAPort),"RSA",1024,"auth-only");
- client = new SASLCAClient(userID, clientConfig);
+ System.setProperty("javax.net.ssl.trustStore", tsFile);
+ System.setProperty("javax.net.ssl.trustStorePassword",
tsPassword);
+ System.setProperty("javax.net.ssl.trustStoreType", tsType);
- KeyPair keyPair = client.generateKeyPair();
- checkCertificate(keyPair);
- sendRequest(keyPair,endPoint,messageFile);
- } catch (PerfSONARException e) {
- e.printStackTrace();
- } catch (CertificateParsingException e) {
- e.printStackTrace();
- }
- }
-
- public void checkCertificate(KeyPair keyPair) throws
CertificateParsingException, PerfSONARException {
- X509Certificate certificate = client.getCertficate(keyPair);
- System.out.println("Issuer DN:
"+certificate.getIssuerDN().toString());
- System.out.println("Subject DN:
"+certificate.getSubjectDN().toString());
- Collection<List<?>> collection = certificate
- .getSubjectAlternativeNames();
+ userID = new UserID(username, userpassword);
+ clientConfig = new SASLCAClientConfiguration(saslCAServer,
Integer.parseInt(saslCAPort), "RSA", 1024,
+ "auth-only");
+ client = new SASLCAClient(userID, clientConfig);
+
+ KeyPair keyPair = client.generateKeyPair();
+ checkCertificate(keyPair);
+ sendRequest(keyPair, endPoint, messageFile);
+ } catch (PerfSONARException e) {
+ e.printStackTrace();
+ } catch (CertificateParsingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void checkCertificate(KeyPair keyPair) throws
CertificateParsingException, PerfSONARException
+ {
+ X509Certificate certificate = client.getCertficate(keyPair);
+ System.out.println("Issuer DN: " +
certificate.getIssuerDN().toString());
+ System.out.println("Subject DN: " +
certificate.getSubjectDN().toString());
+ Collection<List<?>> collection =
certificate.getSubjectAlternativeNames();
for (List<?> list : collection) {
for (Object aList : list) {
if (aList.toString().startsWith("http")) {
@@ -116,18 +118,19 @@
}
}
}
- System.out.println("Valid from:
"+DateFormat.getInstance().format(certificate.getNotBefore()));
- System.out.println("Valid until:
"+DateFormat.getInstance().format(certificate.getNotAfter()));
- }
-
- public void sendRequest(KeyPair keyPair,String endPoint,String
messageFile) throws PerfSONARException {
- try {
- // 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"));
+ System.out.println("Valid from: " +
DateFormat.getInstance().format(certificate.getNotBefore()));
+ System.out.println("Valid until: " +
DateFormat.getInstance().format(certificate.getNotAfter()));
+ }
+ public void sendRequest(KeyPair keyPair, String endPoint, String
messageFile) throws PerfSONARException
+ {
+ try {
+ // 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"));
+
Document request;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
@@ -135,49 +138,43 @@
DocumentBuilder builder = factory.newDocumentBuilder();
request = builder.parse(new File(messageFile));
- // build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
- new SOAPBodyElement(request.getDocumentElement());
- SOAPEnvelope envelope = new SOAPEnvelope();
- envelope.addBodyElement(requestMessage);
+ // build a SOAPBodyElement from the document
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(request.getDocumentElement());
+ SOAPEnvelope envelope = new SOAPEnvelope();
+ envelope.addBodyElement(requestMessage);
- // add the security provider
- BouncyCastleProvider bcp = new BouncyCastleProvider();
- java.security.Security.addProvider(bcp);
-
+ // add the security provider
+ BouncyCastleProvider bcp = new BouncyCastleProvider();
+ java.security.Security.addProvider(bcp);
+
Crypto crypto = new DynamicCrypto();
- KeyStore ks=crypto.getKeyStore();
+ KeyStore ks = crypto.getKeyStore();
Document doc = envelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.setActor("test");
secHeader.insertSecurityHeader(doc);
- PrivateKey privateKey=keyPair.getPrivate();
- X509Certificate cert = client.getCertficate(keyPair);
+ PrivateKey privateKey = keyPair.getPrivate();
+ X509Certificate cert = client.getCertficate(keyPair);
ks.setKeyEntry("xmlsec", privateKey, "security".toCharArray(),
new Certificate[]{cert});
WSSecSignature sec509 = new WSSecSignature();
sec509.setUserInfo("xmlsec", "security");
SOAPConstants soapConstants =
WSSecurityUtil.getSOAPConstants(envelope.getAsDOM());
- Vector<WSEncryptionPart> parts = new
Vector<WSEncryptionPart>(1,1);
+ Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>(1,
1);
// Set up to use STRTransorm to sign the signature token
- WSEncryptionPart encP =
- new WSEncryptionPart(
- "STRTransform",
- soapConstants.getEnvelopeURI(),
- "Content");
+ WSEncryptionPart encP = new WSEncryptionPart("STRTransform",
soapConstants.getEnvelopeURI(), "Content");
parts.add(encP);
// Adding timestamp information
WSSecTimestamp timestamp = new WSSecTimestamp();
timestamp.setTimeToLive(900);
- timestamp.prepare(doc);
- WSSecurityUtil.prependChildElement(doc, secHeader
- .getSecurityHeader(), timestamp.getElement(), false);
- parts.add(new WSEncryptionPart(timestamp.getId()));
-
- sec509.setParts(parts);
+ timestamp.prepare(doc);
+ WSSecurityUtil.prependChildElement(doc,
secHeader.getSecurityHeader(), timestamp.getElement(), false);
+ parts.add(new WSEncryptionPart(timestamp.getId()));
+
+ sec509.setParts(parts);
sec509.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
// Signing the message
@@ -193,39 +190,40 @@
SOAPBodyElement resultSBE;
Document result;
- envelopeResult= (SOAPEnvelope)resultObject;
- resultSBE= envelopeResult.getFirstBody();
+ envelopeResult = (SOAPEnvelope) resultObject;
+ resultSBE = envelopeResult.getFirstBody();
// change it to document - here is where validity
// can be checked..
result = resultSBE.getAsDocument();
- // output it to a string
- StringWriter outWriter = new StringWriter();
+ // output it to a string
+ StringWriter outWriter = new StringWriter();
- OutputFormat format = new OutputFormat( result );
- format.setIndent(4);
- format.setIndenting(true);
- format.setLineSeparator("\n");
+ OutputFormat format = new OutputFormat(result);
+ format.setIndent(4);
+ format.setIndenting(true);
+ format.setLineSeparator("\n");
- XMLSerializer serial = new XMLSerializer(outWriter,
format );
- serial.asDOMSerializer();
- serial.serialize( result.getDocumentElement() );
+ XMLSerializer serial = new XMLSerializer(outWriter, format);
+ serial.asDOMSerializer();
+ serial.serialize(result.getDocumentElement());
- outWriter.close();
-
- System.out.println("---- Response message");
- System.out.println(outWriter.toString());
- System.out.println("---------------------");
- } catch (Exception e) {
- throw new PerfSONARException(e.getMessage());
- }
- }
+ outWriter.close();
- public static void main(String[] args) {
- SOAPUbCClient client = new SOAPUbCClient();
- client.test(args);
- }
+ System.out.println("---- Response message");
+ System.out.println(outWriter.toString());
+ System.out.println("---------------------");
+ } catch (Exception e) {
+ throw new PerfSONARException(e.getMessage());
+ }
+ }
+ public static void main(String[] args)
+ {
+ SOAPUbCClient client = new SOAPUbCClient();
+ client.test(args);
+ }
+
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPX509Client.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPX509Client.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/SOAPX509Client.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -24,17 +24,19 @@
import org.w3c.dom.Document;
/**
- * Class which provides the basic web service (Doc/Lit) client capability
- * without stubs but including the possibility of sending the X.509
- * certificate security token.
+ * Class which provides the basic web service (Doc/Lit) client capability
+ * without stubs but including the possibility of sending the X.509
+ * certificate security token.
*
- * @author kan
+ * @author kan
*/
-public class SOAPX509Client {
+public class SOAPX509Client
+{
- @SuppressWarnings(value={"deprecation"})
- public void makeRequest(String[] args) {
+ @SuppressWarnings(value = { "deprecation" })
+ public void makeRequest(String[] args)
+ {
try {
String endPoint;
String inputFile;
@@ -48,7 +50,7 @@
keyFile = args[3];
certFile = args[4];
} else {
- System.out.println("Error: Wrong number ("+args.length+") of
parameters!!!");
+ System.out.println("Error: Wrong number (" + args.length +
") of parameters!!!");
return;
}
System.out.println("End point: " + endPoint);
@@ -56,19 +58,19 @@
System.out.println("Response file: " + outputFile);
System.out.println("Private key file: " + keyFile);
System.out.println("Certificate file: " + certFile);
- DateFormat zulu = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
- Calendar cal=Calendar.getInstance();
- System.out.println("Date host: "+zulu.format(cal.getTime()));
+ DateFormat zulu = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ zulu.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Calendar cal = Calendar.getInstance();
+ System.out.println("Date host: " + zulu.format(cal.getTime()));
// read the certificate... more or less...
// InputStream isCert=new FileInputStream(certFile);
// prepare to call - set service elements
Service service = new Service();
- Call call = (Call)service.createCall();
+ Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(endPoint));
- call.setOperationName(new
QName("http://soapinterop.org/","submit"));
+ call.setOperationName(new QName("http://soapinterop.org/",
"submit"));
// read the request into a org.w3c.DOM.Document
Document request;
@@ -79,35 +81,32 @@
request = builder.parse(new File(inputFile));
// build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
- new SOAPBodyElement(request.getDocumentElement());
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(request.getDocumentElement());
- AuthNX509Data
authnData=AuthNDataFactory.getDefaultAuthNX509Data();
- Object reqRaw=authnData.addX509STInMessage(requestMessage,
keyFile, certFile);
- SOAPEnvelope envelope=(SOAPEnvelope)reqRaw;
+ AuthNX509Data authnData =
AuthNDataFactory.getDefaultAuthNX509Data();
+ Object reqRaw = authnData.addX509STInMessage(requestMessage,
keyFile, certFile);
+ SOAPEnvelope envelope = (SOAPEnvelope) reqRaw;
// Saving SOAP message
saveSOAPMessage(envelope.getAsDocument(), inputFile);
// get a timestamp.
- double startTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double startTime = new
Long(System.currentTimeMillis()).doubleValue();
// call on the end point
Object resultObject = call.invoke(envelope);
// get another timestamp
- double endTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double endTime = new
Long(System.currentTimeMillis()).doubleValue();
SOAPEnvelope envelopeResult;
SOAPBodyElement resultSBE;
Document result;
try {
- envelopeResult= (SOAPEnvelope)resultObject;
+ envelopeResult = (SOAPEnvelope) resultObject;
saveSOAPMessage(envelopeResult.getAsDocument(), outputFile);
- resultSBE= envelopeResult.getFirstBody();
+ resultSBE = envelopeResult.getFirstBody();
// change it to document - here is where validity
// can be checked..
@@ -117,14 +116,14 @@
File response = new File(outputFile);
FileWriter outWriter = new FileWriter(response);
- OutputFormat format = new OutputFormat( result );
+ OutputFormat format = new OutputFormat(result);
format.setIndent(4);
format.setIndenting(true);
format.setLineSeparator("\n");
- XMLSerializer serial = new XMLSerializer(outWriter, format );
+ XMLSerializer serial = new XMLSerializer(outWriter, format);
serial.asDOMSerializer();
- serial.serialize( result.getDocumentElement() );
+ serial.serialize(result.getDocumentElement());
outWriter.close();
} catch (ClassCastException e) {
@@ -134,8 +133,8 @@
System.out.println("SOAPX509Client.makeRequest: General
exception while retrieving report");
e.printStackTrace();
}
- System.out.println("time taken :"+((endTime-startTime)/1000d)+"
secs");
- } catch(Exception e) {
+ System.out.println("time taken :" + ((endTime - startTime) /
1000d) + " secs");
+ } catch (Exception e) {
System.err.println("SOAPX509Client.makeRequest: General
exception encountered by client");
e.printStackTrace();
}
@@ -143,11 +142,12 @@
System.out.println("Client exiting");
}
- private void saveSOAPMessage(Document doc, String file) {
+ private void saveSOAPMessage(Document doc, String file)
+ {
try {
- File response = new File(file+".soap.xml");
+ File response = new File(file + ".soap.xml");
FileWriter outWriter = new FileWriter(response);
-
XMLUtils.PrettyElementToWriter(doc.getDocumentElement(),outWriter);
+ XMLUtils.PrettyElementToWriter(doc.getDocumentElement(),
outWriter);
outWriter.close();
} catch (Exception e) {
System.out.println("SOAPX509Client.saveSOAPMessage: General
exception while writing SOAP message");
@@ -155,7 +155,8 @@
}
}
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
SOAPX509Client doclitClient = new SOAPX509Client();
doclitClient.makeRequest(args);
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCMDSTest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCMDSTest.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCMDSTest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,15 +8,18 @@
import org.perfsonar.base.exceptions.PerfSONARException;
import org.perfsonar.client.base.authn.edugain.EduGAINMetadataService;
-public class UbCMDSTest {
-
- public void testMDS(String[] args) {
- try {
- String defaultMDS="http://mds.rediris.es:8080";
- if (args.length==1) {
- defaultMDS=args[0];
- }
- List<BEMetaData>
bes=EduGAINMetadataService.getOrganizationList(defaultMDS,"/tmp/eduGAINtruststore.jks","12345678","/tmp/ValidComponentsFile");
+public class UbCMDSTest
+{
+
+ public void testMDS(String[] args)
+ {
+ try {
+ String defaultMDS = "http://mds.rediris.es:8080";
+ if (args.length == 1) {
+ defaultMDS = args[0];
+ }
+ List<BEMetaData> bes =
EduGAINMetadataService.getOrganizationList(defaultMDS,
"/tmp/eduGAINtruststore.jks",
+
"12345678", "/tmp/ValidComponentsFile");
for (BEMetaData be : bes) {
System.out.println("Bridging Element " +
be.getComponentID());
CAInterface caonline = be.getCAInterface();
@@ -24,16 +27,17 @@
System.out.println("*** CA online: " +
caonline.getContactURL());
}
}
- } catch (PerfSONARException e) {
- }
- }
+ } catch (PerfSONARException e) {
+ }
+ }
- /**
- * @param args
- */
- public static void main(String[] args) {
- UbCMDSTest mdsTest=new UbCMDSTest();
- mdsTest.testMDS(args);
- }
+ /**
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ UbCMDSTest mdsTest = new UbCMDSTest();
+ mdsTest.testMDS(args);
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCSaslTest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCSaslTest.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/client/testHarness/UbCSaslTest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -53,85 +53,84 @@
import org.perfsonar.service.base.authn.AuthRRequest;
import org.w3c.dom.Document;
-public class UbCSaslTest {
- private UserID userID;
+public class UbCSaslTest
+{
+ private UserID userID;
- private SASLCAClientConfiguration clientConfig;
+ private SASLCAClientConfiguration clientConfig;
- private SASLCAClient client;
+ private SASLCAClient client;
- public void test(String[] args) {
- try {
- String saslCAServer;
- String saslCAPort;
- String tsFile;
- String tsPassword;
- String tsType;
- String username;
- String userpassword;
- String oper;
- String endPoint;
+ public void test(String[] args)
+ {
+ try {
+ String saslCAServer;
+ String saslCAPort;
+ String tsFile;
+ String tsPassword;
+ String tsType;
+ String username;
+ String userpassword;
+ String oper;
+ String endPoint;
- if (args.length == 9) {
- saslCAServer = args[0];
- saslCAPort = args[1];
- tsFile = args[2];
- tsPassword = args[3];
- tsType = args[4];
- username = args[5];
- userpassword = args[6];
- oper = args[7];
- endPoint = args[8];
- } else {
- System.out.println("Error: Wrong number (" +
args.length
- + "!= 9) of parameters!!!");
- return;
- }
- System.out.println("SASL CA Server: " + saslCAServer);
- System.out.println("SASL CA Port: " + saslCAPort);
- System.out.println("TrustStore File: " + tsFile);
- System.out.println("TrustStore Password: " +
tsPassword);
- System.out.println("TrustStore Type: " + tsType);
- System.out.println("Username: " + username);
- System.out.println("Password: " + userpassword);
- System.out.println("Operation: " + oper);
- System.out.println("End Point: " + endPoint);
+ if (args.length == 9) {
+ saslCAServer = args[0];
+ saslCAPort = args[1];
+ tsFile = args[2];
+ tsPassword = args[3];
+ tsType = args[4];
+ username = args[5];
+ userpassword = args[6];
+ oper = args[7];
+ endPoint = args[8];
+ } else {
+ System.out.println("Error: Wrong number (" + args.length +
"!= 9) of parameters!!!");
+ return;
+ }
+ System.out.println("SASL CA Server: " + saslCAServer);
+ System.out.println("SASL CA Port: " + saslCAPort);
+ System.out.println("TrustStore File: " + tsFile);
+ System.out.println("TrustStore Password: " + tsPassword);
+ System.out.println("TrustStore Type: " + tsType);
+ System.out.println("Username: " + username);
+ System.out.println("Password: " + userpassword);
+ System.out.println("Operation: " + oper);
+ System.out.println("End Point: " + endPoint);
- System.setProperty("javax.net.ssl.trustStore",
tsFile);
-
System.setProperty("javax.net.ssl.trustStorePassword", tsPassword);
- System.setProperty("javax.net.ssl.trustStoreType",
tsType);
+ System.setProperty("javax.net.ssl.trustStore", tsFile);
+ System.setProperty("javax.net.ssl.trustStorePassword",
tsPassword);
+ System.setProperty("javax.net.ssl.trustStoreType", tsType);
- userID = new UserID(username, userpassword);
- clientConfig = new
SASLCAClientConfiguration(saslCAServer,Integer.parseInt(saslCAPort),"RSA",1024,"auth-only");
- client = new SASLCAClient(userID, clientConfig);
+ userID = new UserID(username, userpassword);
+ clientConfig = new SASLCAClientConfiguration(saslCAServer,
Integer.parseInt(saslCAPort), "RSA", 1024,
+ "auth-only");
+ client = new SASLCAClient(userID, clientConfig);
- KeyPair keyPair = client.generateKeyPair();
- if (oper.equals("get")) {
- checkCertificate(keyPair);
- }
- else if (oper.equals("authn")) {
- sendAuthNEERequest(keyPair,endPoint);
- }
- else if (oper.equals("authr")) {
- sendAuthREERequest(keyPair,endPoint);
- }
- else if (oper.equals("attr")) {
- sendAttrEERequest(keyPair, endPoint);
- }
+ KeyPair keyPair = client.generateKeyPair();
+ if (oper.equals("get")) {
+ checkCertificate(keyPair);
+ } else if (oper.equals("authn")) {
+ sendAuthNEERequest(keyPair, endPoint);
+ } else if (oper.equals("authr")) {
+ sendAuthREERequest(keyPair, endPoint);
+ } else if (oper.equals("attr")) {
+ sendAttrEERequest(keyPair, endPoint);
+ }
- } catch (PerfSONARException e) {
- e.printStackTrace();
- } catch (CertificateParsingException e) {
- e.printStackTrace();
- }
- }
+ } catch (PerfSONARException e) {
+ e.printStackTrace();
+ } catch (CertificateParsingException e) {
+ e.printStackTrace();
+ }
+ }
- public void checkCertificate(KeyPair keyPair) throws
CertificateParsingException, PerfSONARException {
- X509Certificate certificate = client.getCertficate(keyPair);
- System.out.println("Issuer DN:
"+certificate.getIssuerDN().toString());
- System.out.println("Subject DN:
"+certificate.getSubjectDN().toString());
- Collection<List<?>> collection = certificate
- .getSubjectAlternativeNames();
+ public void checkCertificate(KeyPair keyPair) throws
CertificateParsingException, PerfSONARException
+ {
+ X509Certificate certificate = client.getCertficate(keyPair);
+ System.out.println("Issuer DN: " +
certificate.getIssuerDN().toString());
+ System.out.println("Subject DN: " +
certificate.getSubjectDN().toString());
+ Collection<List<?>> collection =
certificate.getSubjectAlternativeNames();
for (List<?> list : collection) {
for (Object aList : list) {
if (aList.toString().startsWith("http")) {
@@ -139,55 +138,51 @@
}
}
}
- System.out.println("Valid from:
"+DateFormat.getInstance().format(certificate.getNotBefore()));
- System.out.println("Valid until:
"+DateFormat.getInstance().format(certificate.getNotAfter()));
- }
+ System.out.println("Valid from: " +
DateFormat.getInstance().format(certificate.getNotBefore()));
+ System.out.println("Valid until: " +
DateFormat.getInstance().format(certificate.getNotAfter()));
+ }
- public void sendAuthNEERequest(KeyPair keyPair,String endPoint)
throws PerfSONARException {
- try {
- // 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"));
+ public void sendAuthNEERequest(KeyPair keyPair, String endPoint) throws
PerfSONARException
+ {
+ try {
+ // 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
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
+ // read the request into a org.w3c.DOM.Document
+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
- AuthNEERequestGenerator rg=new AuthNEERequestGenerator();
- Message rm=rg.generateRequestMessage();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document request = builder.newDocument();
- request = rm.getDOM(request);
+ AuthNEERequestGenerator rg = new AuthNEERequestGenerator();
+ Message rm = rg.generateRequestMessage();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document request = builder.newDocument();
+ request = rm.getDOM(request);
- // build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
- new SOAPBodyElement(request.getDocumentElement());
- SOAPEnvelope envelope = new SOAPEnvelope();
- envelope.addBodyElement(requestMessage);
+ // build a SOAPBodyElement from the document
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(request.getDocumentElement());
+ SOAPEnvelope envelope = new SOAPEnvelope();
+ envelope.addBodyElement(requestMessage);
- // add the security provider
- BouncyCastleProvider bcp = new BouncyCastleProvider();
- java.security.Security.addProvider(bcp);
+ // add the security provider
+ BouncyCastleProvider bcp = new BouncyCastleProvider();
+ java.security.Security.addProvider(bcp);
Crypto crypto = new DynamicCrypto();
- KeyStore ks=crypto.getKeyStore();
+ KeyStore ks = crypto.getKeyStore();
- PrivateKey privateKey=keyPair.getPrivate();
- X509Certificate cert = client.getCertficate(keyPair);
+ PrivateKey privateKey = keyPair.getPrivate();
+ X509Certificate cert = client.getCertficate(keyPair);
ks.setKeyEntry("xmlsec", privateKey, "security".toCharArray(),
new Certificate[]{cert});
WSSecSignature sec509 = new WSSecSignature();
sec509.setUserInfo("xmlsec", "security");
SOAPConstants soapConstants =
WSSecurityUtil.getSOAPConstants(envelope.getAsDOM());
- Vector<WSEncryptionPart> parts = new
Vector<WSEncryptionPart>(1,1);
+ Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>(1,
1);
// Set up to use STRTransorm to sign the signature token
- WSEncryptionPart encP =
- new WSEncryptionPart(
- "STRTransform",
- soapConstants.getEnvelopeURI(),
- "Content");
+ WSEncryptionPart encP = new WSEncryptionPart("STRTransform",
soapConstants.getEnvelopeURI(), "Content");
parts.add(encP);
sec509.setParts(parts);
@@ -205,248 +200,244 @@
envelope = signedMsg.getSOAPEnvelope();
// get a timestamp.
- double startTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double startTime = new
Long(System.currentTimeMillis()).doubleValue();
// call on the end point
Object resultObject = call.invoke(envelope);
// get another timestamp
- double endTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double endTime = new
Long(System.currentTimeMillis()).doubleValue();
SOAPEnvelope envelopeResult;
SOAPBodyElement resultSBE;
Document result;
- envelopeResult= (SOAPEnvelope)resultObject;
- resultSBE= envelopeResult.getFirstBody();
+ envelopeResult = (SOAPEnvelope) resultObject;
+ resultSBE = envelopeResult.getFirstBody();
// change it to document - here is where validity
// can be checked..
result = resultSBE.getAsDocument();
- // output it to a string
- StringWriter outWriter = new StringWriter();
+ // output it to a string
+ StringWriter outWriter = new StringWriter();
- OutputFormat format = new OutputFormat( result );
- format.setIndent(4);
- format.setIndenting(true);
- format.setLineSeparator("\n");
+ OutputFormat format = new OutputFormat(result);
+ format.setIndent(4);
+ format.setIndenting(true);
+ format.setLineSeparator("\n");
- XMLSerializer serial = new XMLSerializer(outWriter,
format );
- serial.asDOMSerializer();
- serial.serialize( result.getDocumentElement() );
+ XMLSerializer serial = new XMLSerializer(outWriter, format);
+ serial.asDOMSerializer();
+ serial.serialize(result.getDocumentElement());
- outWriter.close();
+ outWriter.close();
- System.out.println("---- Response message");
- System.out.println(outWriter.toString());
- System.out.println("---------------------");
- } catch (Exception e) {
- throw new PerfSONARException(e.getMessage());
- }
- }
+ System.out.println("---- Response message");
+ System.out.println(outWriter.toString());
+ System.out.println("---------------------");
+ } catch (Exception e) {
+ throw new PerfSONARException(e.getMessage());
+ }
+ }
- public void sendAttrEERequest(KeyPair keyPair,String endPoint) throws
PerfSONARException {
- try {
- checkCertificate(keyPair);
+ public void sendAttrEERequest(KeyPair keyPair, String endPoint) throws
PerfSONARException
+ {
+ try {
+ checkCertificate(keyPair);
- PrivateKey privateKey=keyPair.getPrivate();
- X509Certificate cert = client.getCertficate(keyPair);
+ PrivateKey privateKey = keyPair.getPrivate();
+ X509Certificate cert = client.getCertficate(keyPair);
- AttrRequest attrReq = new AttrRequest();
- attrReq.setIssuer("Issuer");
-
attrReq.setSubject("urn:geant:edugain:component:be:gidp:user:first_candido-perfSONAR.net");
- List<String> listValues = new LinkedList<String>();
- listValues.add("perfSONAR.net");
- attrReq.addAttribute("urn:oid:1.3.6.1.4.1.25178.1.2.9",
"schacHomeOrganization", listValues);
+ AttrRequest attrReq = new AttrRequest();
+ attrReq.setIssuer("Issuer");
+
attrReq.setSubject("urn:geant:edugain:component:be:gidp:user:first_candido-perfSONAR.net");
+ List<String> listValues = new LinkedList<String>();
+ listValues.add("perfSONAR.net");
+ attrReq.addAttribute("urn:oid:1.3.6.1.4.1.25178.1.2.9",
"schacHomeOrganization", listValues);
- // 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"));
+ // 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
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
+ // read the request into a org.w3c.DOM.Document
+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
- AttrEERequestGenerator rg = new AttrEERequestGenerator();
- Message rm=rg.generateRequestMessage(attrReq);
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document request = builder.newDocument();
- request = rm.getDOM(request);
- System.out.println("++++++++++++++++");
- System.out.println(XMLUtils.serializeDOM(request));
+ AttrEERequestGenerator rg = new AttrEERequestGenerator();
+ Message rm = rg.generateRequestMessage(attrReq);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document request = builder.newDocument();
+ request = rm.getDOM(request);
+ System.out.println("++++++++++++++++");
+ System.out.println(XMLUtils.serializeDOM(request));
- // build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
- new SOAPBodyElement(request.getDocumentElement());
+ // build a SOAPBodyElement from the document
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(request.getDocumentElement());
- AuthNX509Data
authnData=AuthNDataFactory.getDefaultAuthNX509Data();
- Object reqRaw=authnData.addX509STInMessage(requestMessage,
privateKey, cert);
- SOAPEnvelope envelope = (SOAPEnvelope)reqRaw;
+ AuthNX509Data authnData =
AuthNDataFactory.getDefaultAuthNX509Data();
+ Object reqRaw = authnData.addX509STInMessage(requestMessage,
privateKey, cert);
+ SOAPEnvelope envelope = (SOAPEnvelope) reqRaw;
Document signedDoc = envelope.getAsDocument();
- System.out.println("&&&&&&&&&&&&&");
- System.out.println(XMLUtils.serializeDOM(signedDoc));
+ System.out.println("&&&&&&&&&&&&&");
+ System.out.println(XMLUtils.serializeDOM(signedDoc));
org.apache.axis.Message signedMsg = (org.apache.axis.Message)
SOAPUtil.toSOAPMessage(signedDoc);
envelope = signedMsg.getSOAPEnvelope();
// get a timestamp.
- double startTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double startTime = new
Long(System.currentTimeMillis()).doubleValue();
// call on the end point
Object resultObject = call.invoke(envelope);
// get another timestamp
- double endTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double endTime = new
Long(System.currentTimeMillis()).doubleValue();
SOAPEnvelope envelopeResult;
SOAPBodyElement resultSBE;
Document result;
- envelopeResult= (SOAPEnvelope)resultObject;
- resultSBE= envelopeResult.getFirstBody();
+ envelopeResult = (SOAPEnvelope) resultObject;
+ resultSBE = envelopeResult.getFirstBody();
// change it to document - here is where validity
// can be checked..
result = resultSBE.getAsDocument();
- // output it to a string
- StringWriter outWriter = new StringWriter();
+ // output it to a string
+ StringWriter outWriter = new StringWriter();
- OutputFormat format = new OutputFormat( result );
- format.setIndent(4);
- format.setIndenting(true);
- format.setLineSeparator("\n");
+ OutputFormat format = new OutputFormat(result);
+ format.setIndent(4);
+ format.setIndenting(true);
+ format.setLineSeparator("\n");
- XMLSerializer serial = new XMLSerializer(outWriter,
format );
- serial.asDOMSerializer();
- serial.serialize( result.getDocumentElement() );
+ XMLSerializer serial = new XMLSerializer(outWriter, format);
+ serial.asDOMSerializer();
+ serial.serialize(result.getDocumentElement());
- outWriter.close();
+ outWriter.close();
- System.out.println("---- Response message");
- System.out.println(outWriter.toString());
- System.out.println("---------------------");
- } catch (Exception e) {
- e.printStackTrace();
- throw new PerfSONARException(e.getMessage());
- }
- }
+ System.out.println("---- Response message");
+ System.out.println(outWriter.toString());
+ System.out.println("---------------------");
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new PerfSONARException(e.getMessage());
+ }
+ }
- public void sendAuthREERequest(KeyPair keyPair,String endPoint)
throws PerfSONARException {
- try {
- checkCertificate(keyPair);
+ public void sendAuthREERequest(KeyPair keyPair, String endPoint) throws
PerfSONARException
+ {
+ try {
+ checkCertificate(keyPair);
- PrivateKey privateKey=keyPair.getPrivate();
- X509Certificate cert = client.getCertficate(keyPair);
+ PrivateKey privateKey = keyPair.getPrivate();
+ X509Certificate cert = client.getCertficate(keyPair);
- AuthRRequest authrReq = new AuthRRequest();
- authrReq.setAction("EchoRequest");
-
authrReq.setSubject("urn:geant:edugain:component:be:gidp:user:first_candido-perfSONAR.net");
-
authrReq.setResource("urn:geant:edugain:component:perfsonarresource:rediris:geant2-java-sql-ma-1.0:http%3A//localhost%3A8889/geant2-java-sql-ma/services/measurementArchiveService");
+ AuthRRequest authrReq = new AuthRRequest();
+ authrReq.setAction("EchoRequest");
+
authrReq.setSubject("urn:geant:edugain:component:be:gidp:user:first_candido-perfSONAR.net");
+
authrReq.setResource("urn:geant:edugain:component:perfsonarresource:rediris:geant2-java-sql-ma-1"
+ +
".0:http%3A//localhost%3A8889/geant2-java-sql-ma/services/measurementArchiveService");
- Message authrRequest = new
AuthREERequestGenerator().generateRequestMessage();
+ Message authrRequest = new
AuthREERequestGenerator().generateRequestMessage();
- SimpleRequest simpleRequest;
- simpleRequest =
RequestFactory.getDefaultSimpleRequest();
- simpleRequest.setResource(authrReq.getResource());
- simpleRequest.setAction(authrReq.getAction());
- simpleRequest.setSubject(authrReq.getSubject());
- String reqString=simpleRequest.getMessage();
- reqString = reqString.replaceAll("\n", "");
- reqString = reqString.replaceAll("\r", "");
- reqString = reqString.replaceAll("\t", "");
- reqString = reqString.replaceAll(" ", "");
- Subject authrElement = new Subject();
- authrElement.setSubject(reqString);
-
authrRequest.getMetadata("authRmetadata").setSubject(authrElement);
+ SimpleRequest simpleRequest;
+ simpleRequest = RequestFactory.getDefaultSimpleRequest();
+ simpleRequest.setResource(authrReq.getResource());
+ simpleRequest.setAction(authrReq.getAction());
+ simpleRequest.setSubject(authrReq.getSubject());
+ String reqString = simpleRequest.getMessage();
+ reqString = reqString.replaceAll("\n", "");
+ reqString = reqString.replaceAll("\r", "");
+ reqString = reqString.replaceAll("\t", "");
+ reqString = reqString.replaceAll(" ", "");
+ Subject authrElement = new Subject();
+ authrElement.setSubject(reqString);
+
authrRequest.getMetadata("authRmetadata").setSubject(authrElement);
- // 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"));
+ // 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
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
+ // read the request into a org.w3c.DOM.Document
+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document request = builder.newDocument();
- request = authrRequest.getDOM(request);
- System.out.println("++++++++++++++++");
- System.out.println(XMLUtils.serializeDOM(request));
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document request = builder.newDocument();
+ request = authrRequest.getDOM(request);
+ System.out.println("++++++++++++++++");
+ System.out.println(XMLUtils.serializeDOM(request));
- // build a SOAPBodyElement from the document
- SOAPBodyElement requestMessage =
- new SOAPBodyElement(request.getDocumentElement());
+ // build a SOAPBodyElement from the document
+ SOAPBodyElement requestMessage = new
SOAPBodyElement(request.getDocumentElement());
- AuthNX509Data
authnData=AuthNDataFactory.getDefaultAuthNX509Data();
- Object reqRaw=authnData.addX509STInMessage(requestMessage,
privateKey, cert);
- SOAPEnvelope envelope = (SOAPEnvelope)reqRaw;
+ AuthNX509Data authnData =
AuthNDataFactory.getDefaultAuthNX509Data();
+ Object reqRaw = authnData.addX509STInMessage(requestMessage,
privateKey, cert);
+ SOAPEnvelope envelope = (SOAPEnvelope) reqRaw;
Document signedDoc = envelope.getAsDocument();
- System.out.println("&&&&&&&&&&&&&");
- System.out.println(XMLUtils.serializeDOM(signedDoc));
+ System.out.println("&&&&&&&&&&&&&");
+ System.out.println(XMLUtils.serializeDOM(signedDoc));
org.apache.axis.Message signedMsg = (org.apache.axis.Message)
SOAPUtil.toSOAPMessage(signedDoc);
envelope = signedMsg.getSOAPEnvelope();
// get a timestamp.
- double startTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double startTime = new
Long(System.currentTimeMillis()).doubleValue();
// call on the end point
Object resultObject = call.invoke(envelope);
// get another timestamp
- double endTime =
- new Long(System.currentTimeMillis()).doubleValue();
+ double endTime = new
Long(System.currentTimeMillis()).doubleValue();
SOAPEnvelope envelopeResult;
SOAPBodyElement resultSBE;
Document result;
- envelopeResult= (SOAPEnvelope)resultObject;
- resultSBE= envelopeResult.getFirstBody();
+ envelopeResult = (SOAPEnvelope) resultObject;
+ resultSBE = envelopeResult.getFirstBody();
// change it to document - here is where validity
// can be checked..
result = resultSBE.getAsDocument();
- // output it to a string
- StringWriter outWriter = new StringWriter();
+ // output it to a string
+ StringWriter outWriter = new StringWriter();
- OutputFormat format = new OutputFormat( result );
- format.setIndent(4);
- format.setIndenting(true);
- format.setLineSeparator("\n");
+ OutputFormat format = new OutputFormat(result);
+ format.setIndent(4);
+ format.setIndenting(true);
+ format.setLineSeparator("\n");
- XMLSerializer serial = new XMLSerializer(outWriter,
format );
- serial.asDOMSerializer();
- serial.serialize( result.getDocumentElement() );
+ XMLSerializer serial = new XMLSerializer(outWriter, format);
+ serial.asDOMSerializer();
+ serial.serialize(result.getDocumentElement());
- outWriter.close();
+ outWriter.close();
- System.out.println("---- Response message");
- System.out.println(outWriter.toString());
- System.out.println("---------------------");
- } catch (Exception e) {
- e.printStackTrace();
- throw new PerfSONARException(e.getMessage());
- }
- }
+ System.out.println("---- Response message");
+ System.out.println(outWriter.toString());
+ System.out.println("---------------------");
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new PerfSONARException(e.getMessage());
+ }
+ }
- public static void main(String[] args) {
- UbCSaslTest ubcSasl = new UbCSaslTest();
- ubcSasl.test(args);
- }
+ public static void main(String[] args)
+ {
+ UbCSaslTest ubcSasl = new UbCSaslTest();
+ ubcSasl.test(args);
+ }
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchManager.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -4,7 +4,7 @@
public class AADispatchManager
{
- final AADispatchProtocol protocol;
+ private final AADispatchProtocol protocol;
public AADispatchManager(AADispatchProtocol prot)
{
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocol.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocol.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocol.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -4,9 +4,9 @@
public interface AADispatchProtocol
{
- public AuthNResponse getAuthentication(AuthNRequest req) throws
PerfSONARException;
+ AuthNResponse getAuthentication(AuthNRequest req) throws
PerfSONARException;
- public AuthRResponse getAuthorization(AuthRRequest req) throws
PerfSONARException;
+ AuthRResponse getAuthorization(AuthRRequest req) throws
PerfSONARException;
- public AttrResponse getAttributes(AttrRequest req) throws
PerfSONARException;
+ AttrResponse getAttributes(AttrRequest req) throws PerfSONARException;
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocolFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocolFactory.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchProtocolFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,8 +2,12 @@
import org.perfsonar.base.exceptions.PerfSONARException;
-public class AADispatchProtocolFactory
+public final class AADispatchProtocolFactory
{
+ private AADispatchProtocolFactory()
+ {
+ }
+
public static AADispatchProtocol getDefaultAADispatchProtocol() throws
PerfSONARException
{
return new AADispatchSOAPProtocol();
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AADispatchSOAPProtocol.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -41,8 +41,10 @@
public class AADispatchSOAPProtocol implements AADispatchProtocol
{
- public static final String WSS_X509 =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
- public static final String WSS_SAML =
"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
+ public static final String WSS_X509 =
+
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3";
+ public static final String WSS_SAML =
+
"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
private static final String AS_POINT_PARAM = "service.as.point";
private static final String SAX_PARSER_CONFIG =
"service.sax_parser.config";
@@ -106,7 +108,8 @@
return "";
}
- private Document updateSecurityTokenParameter(Document request, Message
requestMessage, SecurityToken token) throws TransformerException
+ private Document updateSecurityTokenParameter(Document request, Message
requestMessage,
+ SecurityToken token)
throws TransformerException
{
// get the parameter which specifies the format of the security token
Parameters params;
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AttrRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AttrRequest.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AttrRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,9 +8,9 @@
public class AttrRequest extends AuthNRequest
{
- String issuer;
- String subject;
- final Map<String, Map<String, List<String>>> attrs;
+ private String issuer;
+ private String subject;
+ private final Map<String, Map<String, List<String>>> attrs;
public AttrRequest()
{
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AttrResponse.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AttrResponse.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AttrResponse.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -96,8 +96,8 @@
while (it.hasNext()) {
Element elem = (Element) it.next();
System.out.println(elem.getNamespaceURI() + " ---- " +
elem.getNodeName());
- if
(elem.getNamespaceURI().equals("http://ggf.org/ns/nmwg/tools/org/perfsonar/service/as/attr/1.0/")
&&
- elem.getNodeName().equals("subject")) {
+ if
(elem.getNamespaceURI().equals("http://ggf.org/ns/nmwg/tools/org/perfsonar/service/as/attr/1.0/")
+ && elem.getNodeName().equals("subject")) {
String samlResponse = elem.getTextContent();
res.setSAMLResponse(samlResponse);
res.loadAttributes();
@@ -112,7 +112,8 @@
{
Document doc = getDocumentFromString(getSAMLResponse());
try {
- XPathExpression expression =
xpath.compile("//samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute");
+ XPathExpression expression =
+
xpath.compile("//samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute");
NodeList nodes = (NodeList) expression.evaluate(doc,
XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
org.w3c.dom.Element elem = (org.w3c.dom.Element)
nodes.item(i);
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AuthRRequest.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AuthRRequest.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/AuthRRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -7,10 +7,10 @@
public static final String URN_PREFIX_ACTION =
"urn:geant:edugain:action:perfsonar:";
public static final String DEFAULT_ACTION = "send";
- String messageType;
- String resource;
- String action;
- String subject;
+ private String messageType;
+ private String resource;
+ private String action;
+ private String subject;
public AuthRRequest()
{
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManager.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -4,9 +4,9 @@
public interface SecTokenManager
{
- public boolean hasSTInRequest() throws PerfSONARException;
+ boolean hasSTInRequest() throws PerfSONARException;
- public Object getSTFromRequest() throws PerfSONARException;
+ Object getSTFromRequest() throws PerfSONARException;
- public Object getSTValue() throws PerfSONARException;
+ Object getSTValue() throws PerfSONARException;
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManagerFactory.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManagerFactory.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenManagerFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,8 +2,12 @@
import org.perfsonar.base.exceptions.PerfSONARException;
-public class SecTokenManagerFactory
+public final class SecTokenManagerFactory
{
+ private SecTokenManagerFactory()
+ {
+ }
+
public static SecTokenManager getDefaultSecTokenManager() throws
PerfSONARException
{
return new SecTokenSOAPManager();
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/authn/tokens/SecTokenSOAPManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -42,7 +42,8 @@
public class SecTokenSOAPManager implements SecTokenManager
{
- private static final String WSSECHEADER_NS =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+ private static final String WSSECHEADER_NS =
+
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
private static final String WSSECHEADER = "Security";
private static final String URN_USER_FED = ":user:";
@@ -99,24 +100,24 @@
}
Object res = null;
SOAPHeader sh = (SOAPHeader) getSTFromRequest();
-/* Iterator it=sh.examineAllHeaderElements();
- while (it.hasNext()) {
- SOAPHeaderElement he=(SOAPHeaderElement)it.next();
- Node assertion=he.getFirstChild();
- if (assertion.getNodeName().equals("saml:Assertion"))
{
- try {
- Element e=(Element)assertion;
- SAMLAssertion samlAs=new
SAMLAssertion(e);
- res=samlAs;
- } catch (Throwable t) {
- t.printStackTrace();
- String m = "SecTokenSOAPManager:
"+t.getMessage();
- logger.info(m);
- throw new
PerfSONARException("error.authn.getting_sec_token",m);
- }
- }
- }
- if (res==null) { */
+/* Iterator it=sh.examineAllHeaderElements();
+ while (it.hasNext()) {
+ SOAPHeaderElement he=(SOAPHeaderElement)it.next();
+ Node assertion=he.getFirstChild();
+ if (assertion.getNodeName().equals("saml:Assertion")) {
+ try {
+ Element e=(Element)assertion;
+ SAMLAssertion samlAs=new SAMLAssertion(e);
+ res=samlAs;
+ } catch (Throwable t) {
+ t.printStackTrace();
+ String m = "SecTokenSOAPManager: "+t.getMessage();
+ logger.info(m);
+ throw new
PerfSONARException("error.authn.getting_sec_token",m);
+ }
+ }
+ }
+ if (res==null) { */
try {
Document doc = sh.getAsDocument();
Crypto crypto = new DynamicCrypto();
@@ -132,7 +133,8 @@
NodeList nodes = (NodeList) result;
for (int i = 0; i < nodes.getLength(); i++) {
Element e = (Element) nodes.item(i);
- if
(e.getAttribute("ValueType").equals("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"))
{
+ if (e.getAttribute("ValueType")
+
.equals("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"))
{
byte[] bytes = Base64.decode(e.getTextContent());
ByteArrayInputStream bais = new
ByteArrayInputStream(bytes);
X509Certificate cert = crypto.loadCertificate(bais);
@@ -149,7 +151,7 @@
logger.info(m);
throw new PerfSONARException("error.authn.getting_sec_token", m);
}
-// }
+// }
return res;
}
@@ -173,7 +175,8 @@
return isDelegated;
}
- public static String getSubject(SecurityToken token) throws
TransformerException, CertificateParsingException,
UnsupportedEncodingException, SAMLException
+ public static String getSubject(SecurityToken token) throws
TransformerException, CertificateParsingException,
+ UnsupportedEncodingException, SAMLException
{
Object stValue = token.getSecTokenValue();
if (!isDelegated(token)) {
@@ -202,7 +205,8 @@
Element confData = subject.getConfirmationData();
SAMLAssertion relayed = new SAMLAssertion((Element)
confData.getFirstChild());
- return relayed.getIssuer() +
SecTokenSOAPManager.URN_USER_FED + subject.getNameIdentifier().getName();
+ return relayed.getIssuer() +
SecTokenSOAPManager.URN_USER_FED
+ + subject.getNameIdentifier().getName();
}
}
}
@@ -233,4 +237,4 @@
throw new UnsupportedOperationException();
}
}
-}
\ No newline at end of file
+}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -59,10 +59,10 @@
// AuxiliaryComponent
try {
- Iterator<Map.Entry<String, AuxiliaryComponent>> it =
AuxiliaryComponentManager.getInstance().componentsIterator();
+ 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) {
@@ -74,10 +74,8 @@
((AuxiliaryThreadedComponent) e.getValue()).stopThread();
}
}
-
} 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ActionType.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -6,45 +6,42 @@
package org.perfsonar.service.base.engine;
/**
- * Class holding static values of action types that can be asked from
service engines
+ * Class holding static values of action types that can be asked from
service engines.
*
* @author loukik
* @author Maciej Glowiak
* @author romradz
*/
-public class ActionType
+public final class ActionType
{
-
-
// ----------------------------------------- Measurement Archive Actions
-
/**
- * Action type to ask for a key for the specified metadata
+ * Action type to ask for a key for the specified metadata.
*/
public static final String GET_KEY = "GET_KEY";
/**
- * Action type to ask for data
+ * Action type to ask for data.
*/
public static final String GET_DATA = "GET_DATA";
/**
- * Action type to store measurements
+ * Action type to store measurements.
*/
public static final String STORE_DATA = "STORE_DATA";
/**
- * Action type to store keys
+ * Action type to store keys.
*/
public static final String STORE_KEY = "STORE_KEY";
/**
- * Action type to replace complete metadata configuration file
+ * Action type to replace complete metadata configuration file.
*/
public static final String STORE_METADATA_CONFIGURATION =
"STORE_METADATA_CONFIGURATION";
@@ -53,37 +50,37 @@
/**
- * Action type to request a measurement
+ * Action type to request a measurement.
*/
public static final String LS_REGISTER = "LS_REGISTER";
/**
- * Action type to request a measurement
+ * Action type to request a measurement.
*/
public static final String LS_LOOKUP = "LS_LOOKUP";
/**
- * Action type to request a measurement
+ * Action type to request a measurement.
*/
public static final String LS_DEREGISTER = "LS_DEREGISTER";
/**
- * Action type to request a measurement
+ * Action type to request a measurement.
*/
public static final String LS_KEEPALIVE = "LS_KEEPALIVE";
/**
- * Action type to LS Cleanup
+ * Action type to 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";
@@ -92,7 +89,7 @@
/**
- * Action type to check service status
+ * Action type to check service status.
*/
public static final String ECHO = "ECHO";
@@ -101,7 +98,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";
@@ -110,7 +107,7 @@
/**
- * Action type to request a measurement
+ * Action type to request a measurement.
*/
public static final String MAKE_MEASUREMENT = "MeasurementRequest";
@@ -119,7 +116,7 @@
/**
- * Action type to request a full topology database download
+ * Action type to request a full topology database download.
*/
public static final String SETUP_DATA_DB = "SETUP_DATA_DB";
@@ -128,22 +125,24 @@
/**
- * Action type to request the authentication of the client/user
+ * Action type to request the authentication of the client/user.
*/
public static final String AUTHN_EE_REQUEST = "AuthNEERequest";
/**
- * Action type to request the authorization of the client/user
+ * Action type to request the authorization of the client/user.
*/
public static final String AUTHR_EE_REQUEST = "AuthREERequest";
/**
- * Action type to request attributes of the client/user
+ * Action type to request attributes of the client/user.
*/
public static final String ATTR_EE_REQUEST = "AttrEERequest";
-
+ private ActionType()
+ {
+ }
} //ActionType
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngine.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -11,7 +11,7 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Interface specification for all types of Service Engines
+ * Interface specification for all types of Service Engines.
*
* @author loukik
*/
@@ -23,7 +23,7 @@
*
* @return String type of Service Engine
*/
- public String getType();
+ String getType();
/**
* Executes an action.
@@ -38,5 +38,5 @@
* @see org.perfsonar.service.commons.engine.ServiceEngineRequest
* @see org.perfsonar.service.commons.engine.ServiceEngineResponse
*/
- public Message takeAction(String actionType, Message request) throws
PerfSONARException;
+ Message takeAction(String actionType, Message request) throws
PerfSONARException;
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/engine/ServiceEngineFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -11,14 +11,17 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Factory class which can be used to get ServiceEngine instances
+ * Factory class which can be used to get ServiceEngine instances.
*
* @author loukik
* @see org.perfsonar.service.commons.engine.ServiceEngine
* TODO provided a
{@link
ServiceEngine} is state-less
{@link
ServiceEngine}'s should be cached.
*/
-public class ServiceEngineFactory
+public final class ServiceEngineFactory
{
+ private ServiceEngineFactory()
+ {
+ }
/**
* Returns the instance of Service Engine.
@@ -30,9 +33,9 @@
*/
public static ServiceEngine getServiceEngine(String engineClassName)
throws PerfSONARException
{
-
// get a logger
- LoggerComponent logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
+ LoggerComponent logger =
+ (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
Class<?> engineClass;
@@ -60,10 +63,12 @@
"ServiceEngineFactory: specified class(" + engineClassName +
") doesn't implement ServiceEngine"
);
} catch (InstantiationException e1) {
- logger.fatal("ServiceEngineFactory: Couldn't instanciate class
(" + engineClassName + ") Perhaps there isn't a no arg constructor?");
+ logger.fatal("ServiceEngineFactory: Couldn't instanciate class
(" + engineClassName
+ + ") Perhaps there isn't a no arg
constructor?");
throw new PerfSONARException(
"error.common.service_engine.creation_failure",
- "ServiceEngineFactory: Couldn't instanciate class (" +
engineClassName + ") Perhaps there isn't a no arg constructor?"
+ "ServiceEngineFactory: Couldn't instanciate class (" +
engineClassName
+ + ") Perhaps there isn't a no arg constructor?"
);
} catch (IllegalAccessException e1) {
logger.fatal("ServiceEngineFactory: IllegalAccessException
couldn't instanciate: " + engineClassName);
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/measurementExecutor/MeasurementExecutor.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -9,19 +9,19 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * This is an interface specification for MeasurementExecutor
+ * This is an interface specification for MeasurementExecutor.
*
* @author Loukik
*/
public interface MeasurementExecutor
{
- // ---------------------------------- public methods
+ // ---------------------------------- public methods
/**
* @return the type of MeasurementExecutor
*/
- public String getType();
+ String getType();
/**
* Operation which takes in a Message and gives out a Message.
Implementations
@@ -33,6 +33,5 @@
* @throws SystemException
* @throws RequestException
*/
- public Message makeMeasurement(Message request) throws
PerfSONARException;
-
+ Message makeMeasurement(Message request) throws PerfSONARException;
}
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/BaseChaining.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/BaseChaining.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/BaseChaining.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,7 +17,7 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * This class handles base chaining of metadata blocks
+ * This class handles base chaining of metadata blocks.
*
* @author romradz
*/
@@ -97,7 +97,7 @@
/**
- * Finds base chaining and calls merge method
+ * Finds base chaining and calls merge method.
*/
protected Metadata processMetadataChaining(
Metadata metadata, Map metadataMap, Metadata newMetadata)
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/DataRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -24,8 +24,6 @@
*/
public abstract class DataRequest extends Request
{
-
-
// ---------------------------------- class fields
@@ -46,7 +44,7 @@
*/
protected void addChainList(
Metadata head,
- Map<String,Metadata> mdMap,
+ Map<String, Metadata> mdMap,
List<Metadata> mdChain,
boolean mustKey)
throws PerfSONARException
@@ -62,11 +60,9 @@
// chain is not a "key" chain.
logger.fatal(
- "SetupDataRequest: Metadata MUST hold a key " +
- "for GET_DATA");
+ "SetupDataRequest: Metadata MUST hold a key for GET_DATA");
throw new PerfSONARException(
- "SetupDataRequest: Metadata MUST hold a key " +
- "for GET_DATA");
+ "SetupDataRequest: Metadata MUST hold a key for GET_DATA");
}
// filter chaining is done using the Subject element.
@@ -74,10 +70,9 @@
if (subj != null) {
// Recurse again if this metadata is chained
addChainList(mdMap.get(subj.getMetadataIdRef()), mdMap, mdChain,
mustKey);
- }
- // If there was no subject, a key is required or this is an invalid
- // metadata
- else if (key == null) {
+ } else if (key == null) {
+ // If there was no subject, a key is required or this is an
invalid
+ // metadata
logger.fatal(
"SetupDataRequest: Metadata MUST have subject or key");
throw new PerfSONARException(
@@ -88,8 +83,7 @@
mdChain.add(0, head);
logger.debug(
- "DataRequest.addChainList: Adding metadata(Id=" +
- head.getId() + ")");
+ "DataRequest.addChainList: Adding metadata(Id=" + head.getId() +
")");
}
/**
@@ -133,16 +127,13 @@
if (reqmd == null) {
logger.fatal(
- "DataRequest.metaToKey: Data element must refer to " +
- "a metadata element.");
+ "DataRequest.metaToKey: Data element must refer to a
metadata element.");
throw new PerfSONARException(
- "DataRequest.metaToKey: Data element must refer to " +
- "a metadata element.");
+ "DataRequest.metaToKey: Data element must refer to a
metadata element.");
}
logger.debug(
- "DataRequest.metaToKey: Build chain from metadataIdRef=" +
- reqdata.getMetadataIdRef());
+ "DataRequest.metaToKey: Build chain from metadataIdRef=" +
reqdata.getMetadataIdRef());
// clear ArrayList to build new chain
mdChain.clear();
@@ -206,14 +197,11 @@
}
if (hasData > hasMd) {
- logger.fatal("MetadataKeyRequest: Invalid data/metadata " +
- "mapping returned from service");
+ logger.fatal("MetadataKeyRequest: Invalid data/metadata
mapping returned from service");
throw new PerfSONARException(
- "MetadataKeyRequest: Invalid data/metadata " +
- "mapping returned from service");
+ "MetadataKeyRequest: Invalid data/metadata mapping
returned from service");
}
- logger.debug("DataRequest.metaToKey: respMessage: " +
- respMessage.toString());
+ logger.debug("DataRequest.metaToKey: respMessage: " +
respMessage.toString());
}
logger.debug("DataRequest.metaToKey: returning respMessage");
return respMessage;
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/EchoRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -81,9 +81,9 @@
respMessage,
new PerfSONARException(
"warning.common.no_metadata",
- "No output metadata was returned by MessageHandler." +
- " Maybe there was no data trigger, or data trigger "
+
- " didn't have valid metadataIdRef? ")
+ "No output metadata was returned by MessageHandler."
+ + " Maybe there was no data trigger, or data trigger
"
+ + " didn't have valid metadataIdRef? ")
);
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LSRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -10,13 +10,12 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * General MessageHangler for LS
+ * General MessageHangler for LS.
*
* @author Maciej Glowiak
*/
public abstract class LSRequest extends Request
{
-
/**
* @throws SystemException
*/
@@ -29,7 +28,7 @@
}
/**
- * Merge chained metadata elements
+ * Merge chained metadata elements.
*
* @param metadatas map of metadata elements
* @return metadatas map of merged metadata elements
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LinkRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -66,8 +66,8 @@
//prevent endless loop
if (metadata.getSubject() != null) {
- if (!(metadata.getSubject().getMetadataIdRef() != null &&
metadata.getSubject().getMetadataIdRef().isEmpty()) &&
-
!(metadata.getId().equals(metadata.getSubject().getMetadataIdRef()))) {
+ if (!(metadata.getSubject().getMetadataIdRef() != null &&
metadata.getSubject().getMetadataIdRef()
+ .isEmpty()) &&
!(metadata.getId().equals(metadata.getSubject().getMetadataIdRef()))) {
getChaining(
inputMessage,
@@ -94,8 +94,8 @@
String chainedMetadataId = metadata.getMetadataIdRef();
//get other chain, prevent endless loop
- if (!(chainedMetadataId != null && chainedMetadataId.isEmpty()) &&
- !(metadata.getId().equals(chainedMetadataId))) {
+ if (!(chainedMetadataId != null && chainedMetadataId.isEmpty())
+ && !(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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/LookupInfoRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -100,9 +100,9 @@
respMessage,
new PerfSONARException(
"warning.common.no_metadata",
- "No output metadata was returned by MessageHandler." +
- " Maybe there was no data trigger, or data trigger "
+
- " didn't have valid metadataIdRef? ")
+ "No output metadata was returned by MessageHandler."
+ + " Maybe there was no data trigger, or data trigger
"
+ + " didn't have valid metadataIdRef? ")
);
}
@@ -142,7 +142,7 @@
PropertiesServiceDescription serviceDescription =
new PropertiesServiceDescription();
- Map<String,String> commonParameters =
serviceDescription.getServiceDescription();
+ Map<String, String> commonParameters =
serviceDescription.getServiceDescription();
response = getResponse(commonParameters);
@@ -157,7 +157,7 @@
}
- protected Message getResponse(Map<String,String> commonParameters)
+ protected Message getResponse(Map<String, String> commonParameters)
{
logger.debug("LookupInfoRequest: getResponse()");
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MeasurementRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -13,7 +13,7 @@
import org.perfsonar.service.base.engine.ActionType;
/**
- * MessageHandler for MeasurementRequest messages
+ * MessageHandler for MeasurementRequest messages.
*
* @author boote
*/
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandler.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -5,24 +5,15 @@
package org.perfsonar.service.base.messages;
-
-/**
- * Interface specification for MessageHandler
- *
- * @author boote
- */
-
import org.ggf.ns.nmwg.base.v2_0.Message;
import org.perfsonar.base.exceptions.PerfSONARException;
public interface MessageHandler
{
-
-
/**
- * Returns thge type of messagehandler
+ * Returns thge type of messagehandler.
*/
- public String getType();
+ String getType();
/**
@@ -31,8 +22,6 @@
* Runs the correct ServiceEngine for the given request message
* and returns the result.
*/
- public Message execute(Message reqMessage)
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/MessageHandlerFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -19,36 +19,40 @@
*
* @author boote
*/
-public class MessageHandlerFactory
+public final class MessageHandlerFactory
{
- private final static Map<String, String> m2c = new Hashtable<String,
String>();
- private final static Object mutex = new Object();
+ private static final Map<String, String> M_TO_C = new Hashtable<String,
String>();
+ private static final Object MUTEX = new Object();
+ private MessageHandlerFactory()
+ {
+ }
+
public static MessageHandler getMessageHandler(String messageType)
throws PerfSONARException
{
// get a logger
- LoggerComponent logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
+ LoggerComponent logger =
+ (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
// one time initialization to determine what message types are
// supported by the service.
- if (m2c.isEmpty()) {
+ if (M_TO_C.isEmpty()) {
init();
}
- if (m2c.isEmpty()) {
+ if (M_TO_C.isEmpty()) {
logger.error("MessageHandlerFactory: no known allowed Message
Types");
}
// get the classname for this message type
- String className = m2c.get(messageType);
+ String className = M_TO_C.get(messageType);
logger.debug("MessageHandlerFactory: classname asked for is " +
className);
if (className == null) {
throw new PerfSONARException(
"error.common.action_not_supported",
- "Action [" + messageType + "] is not supported by " +
- "the service or cannot be served - " +
- "cannot instantiate Message Handler"
+ "Action [" + messageType + "] is not supported by "
+ + "the service or cannot be served - cannot instantiate
Message Handler"
);
}
@@ -62,21 +66,24 @@
logger.fatal("MessageHandlerFactory: because of Instatiation
Problems " + e.getMessage());
throw new PerfSONARException(
"error.common.action_not_supported",
- "MessageHandlerFactory: Unable to create messageHandler for:
" + messageType + " because: " + e.getMessage()
+ "MessageHandlerFactory: Unable to create messageHandler for:
" + messageType + " because: "
+ + e.getMessage()
);
} catch (IllegalAccessException e) {
logger.fatal("MessageHandlerFactory: Unable to Instantiate
messageHandler for: " + messageType);
logger.fatal("MessageHandlerFactory: because of illegalAccess" +
e.getMessage());
throw new PerfSONARException(
"error.common.action_not_supported",
- "MessageHandlerFactory: Unable to create messageHandler for:
" + messageType + " because: " + e.getMessage()
+ "MessageHandlerFactory: Unable to create messageHandler for:
" + messageType + " because: "
+ + e.getMessage()
);
} catch (ClassNotFoundException e) {
logger.fatal("MessageHandlerFactory: Unable to Instantiate
messageHandler for: " + messageType);
logger.fatal("MessageHandlerFactory: because classNotFound :" +
e.getMessage());
throw new PerfSONARException(
"error.common.action_not_supported",
- "MessageHandlerFactory: Unable to create messageHandler for:
" + messageType + " because: " + e.getMessage()
+ "MessageHandlerFactory: Unable to create messageHandler for:
" + messageType + " because: "
+ + e.getMessage()
);
}
@@ -93,19 +100,20 @@
private static void init() throws PerfSONARException
{
- synchronized (mutex) {
- if (!m2c.isEmpty()) {
+ synchronized (MUTEX) {
+ if (!M_TO_C.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);
+ 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*");
for (String allowedMesgType : allowedMesgTypes) {
- m2c.put(allowedMesgType,
"org.perfsonar.service.base.messages." + allowedMesgType);
+ M_TO_C.put(allowedMesgType,
"org.perfsonar.service.base.messages." + allowedMesgType);
}
}
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/Request.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -139,9 +139,9 @@
respMessage,
new PerfSONARException(
"warning.common.no_metadata",
- "No output metadata was returned by MessageHandler." +
- " Maybe there was no data trigger, or data trigger "
+
- " didn't have valid metadataIdRef? ")
+ "No output metadata was returned by MessageHandler."
+ + " Maybe there was no data trigger, or data trigger
"
+ + " didn't have valid metadataIdRef? ")
);
}
@@ -163,7 +163,7 @@
// Supports only M1<-D1, M1<-D2, .... M2<-D3, ....
/**
- * Joins all messages in arraylist
+ * Joins all messages in arraylist.
*/
protected Message mergeMultipleResponses(ArrayList<Message> messages)
{
@@ -309,7 +309,7 @@
/**
- * Find metadata chain for metadata ID (the last metadata in chain)
+ * 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
@@ -335,10 +335,9 @@
//metadataIdRef in Subject
//prevent endless loop
- if (metadata.getSubject() != null &&
- !(metadata.getSubject().getMetadataIdRef() != null &&
metadata.getSubject().getMetadataIdRef().isEmpty()) &&
-
!(metadata.getId().equals(metadata.getSubject().getMetadataIdRef()))) {
-
+ if ((metadata.getSubject() != null) &&
!(metadata.getSubject().getMetadataIdRef() != null
+ && metadata.getSubject().getMetadataIdRef().isEmpty()) &&
!(metadata.getId().equals(
+ metadata.getSubject().getMetadataIdRef()))) {
getChaining(
inputMessage,
metadata.getSubject().getMetadataIdRef(),
@@ -348,8 +347,8 @@
String chainedMetadataId = metadata.getMetadataIdRef();
//get other chain, prevent endless loop
- if (!(chainedMetadataId != null && chainedMetadataId.isEmpty()) &&
- !(metadata.getId().equals(chainedMetadataId))) {
+ if (!(chainedMetadataId != null && chainedMetadataId.isEmpty())
+ && !(metadata.getId().equals(chainedMetadataId))) {
getChaining(inputMessage, chainedMetadataId, metadatas);
}
@@ -363,7 +362,7 @@
/**
- * Merge chained metadata elements
+ * Merge chained metadata elements.
*
* @param metadatas map of metadata elements
* @return metadatas map of merged metadata elements
@@ -376,8 +375,7 @@
/**
* Exception thrown when Metadata could not be found. It's internal
- * Message Handler
- * exception.
+ * 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/messages/TOPSRequest.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -11,7 +11,7 @@
/**
- * General MessageHangler for TOPS
+ * General MessageHangler for TOPS.
*
* @author Maciej Glowiak, modified by Ulisses Alonso
*/
@@ -31,7 +31,7 @@
}
/**
- * Merge chained metadata elements
+ * Merge chained metadata elements.
*
* @param metadatas map of metadata elements
* @return metadatas map of merged 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/GenericServiceLSRegistrator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -49,7 +49,7 @@
// ------------------------------------------------ Public methods
/**
- * Initializes Registrator
+ * Initializes Registrator.
*/
@Override
public void initRegistrator() throws PerfSONARException
@@ -115,7 +115,8 @@
throw new PerfSONARException("error.common.parse_error",
"GenericServiceLSRegistrator: " + e.getMessage());
} catch (Exception e) {
logger.error("GenericServiceLSRegistrator: " + e.getMessage());
- throw new PerfSONARException("error.lsregistrator.other",
"GenericServiceLSRegistrator: Error while sending request to LS: " +
e.getMessage());
+ throw new PerfSONARException("error.lsregistrator.other",
+ "GenericServiceLSRegistrator: Error
while sending request to LS: " + e.getMessage());
}
}
@@ -143,7 +144,7 @@
/**
* Obtains configuration parameters (service description) and
* service content metadata (service content)
- * returms LS Registration Request as NMWG Message
+ * returns LS Registration Request as NMWG Message.
*
* @return Message NMWG
*/
@@ -166,9 +167,8 @@
if (ls) {
lsRegisterGenerator.setEventType(LSRegisterRequestGenerator.SUMMARY_EVENT_TYPE);
logger.debug(
- "GenericServiceLSRegistrator: " +
- "send registration from hLS to gLS - eventType " +
- LSRegisterRequestGenerator.SUMMARY_EVENT_TYPE);
+ "GenericServiceLSRegistrator: send registration from hLS to
gLS - eventType "
+ + LSRegisterRequestGenerator.SUMMARY_EVENT_TYPE);
}
if (serviceContent != null) {
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationContextServiceContent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -21,7 +21,7 @@
public static final String REGISTRATION_DATA =
"service.ls.registration_data";
/**
- * Creates a InformationContextServiceContent
+ * Creates a InformationContextServiceContent.
*
* @throws PerfSONARException if it's unable to get a loggerComponent
*/
@@ -34,7 +34,8 @@
protected PerfsonarContextComponent getContext() throws
PerfSONARException
{
if (context == null) {
- context = (PerfsonarContextComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONTEXT);
+ context = (PerfsonarContextComponent)
+
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONTEXT);
}
return context;
}
@@ -52,10 +53,12 @@
try {
data = (String[]) context.get(REGISTRATION_DATA);
} catch (ClassCastException e) {
-
logger.error("InformationContextServiceContent.getServiceContent: Wrong type
of " + REGISTRATION_DATA + " in context!");
+
logger.error("InformationContextServiceContent.getServiceContent: Wrong type
of "
+ + REGISTRATION_DATA + " in context!");
}
if (data == null) {
- logger.warn("InformationContextServiceContent.getServiceContent:
No value for " + REGISTRATION_DATA + " on the context.");
+ logger.warn("InformationContextServiceContent.getServiceContent:
No value for "
+ + REGISTRATION_DATA + " on the context.");
return new String[]{""};
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationExistDbXmlrpcServiceContent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,7 +8,7 @@
/**
- * Get metadatas from eXist xml database
+ * Get metadatas from eXist xml database.
*/
public class InformationExistDbXmlrpcServiceContent implements ServiceContent
{
@@ -34,7 +34,7 @@
/**
- * Get metadata blocks from the metadata configuration stored in xml
database
+ * Get metadata blocks from the metadata configuration stored in xml
database.
*
* @return array of Strings
*/
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/InformationXMLFileServiceContent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -5,7 +5,7 @@
import org.perfsonar.service.base.storage.xmlfile.XmlFileStorageManager;
/**
- * Get metadatas from XML Information File
+ * Get metadatas from XML Information File.
*
* @author Maciej Glowiak
*/
@@ -30,7 +30,7 @@
// ------------------------------------------------------- Methods
/**
- * Get metadata blocks from RRD information file
+ * Get metadata blocks from RRD information file.
*
* @return array of Strings
*/
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSListAddresses.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -3,13 +3,12 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Collection;
/**
- * This class populates list of LS urls to register to
+ * This class populates list of LS urls to register to.
*
* @author Maciej Glowiak
*/
@@ -18,7 +17,7 @@
/**
- * Populates urls collection with multiple urls from list separated by
comma sign , )
+ * Populates urls collection with multiple urls from list separated by
comma sign , ).
*
* @param urls
* @param multiUrlString
@@ -41,7 +40,7 @@
/**
- * Populates urls collection with multiple remote resources (list in
multiUrlString separated by comma sign , )
+ * Populates urls collection with multiple remote resources (list in
multiUrlString separated by comma sign , ).
*
* @param urls
* @param multiUrlString
@@ -65,16 +64,15 @@
}
/**
- * Populates urls collection with urls/lines downloaded from urlString
+ * Populates urls collection with urls/lines downloaded from urlString.
*
* @param urls
* @param urlString
* @throws MalformedURLException
* @throws IOException
*/
- public void addFromURL(Collection<String> urls, String urlString) throws
MalformedURLException, IOException
+ public void addFromURL(Collection<String> urls, String urlString) throws
IOException
{
-
URL rootHintsUrl = new URL(urlString);
URLConnection rhc = rootHintsUrl.openConnection();
BufferedReader in = new BufferedReader(
@@ -91,8 +89,5 @@
} catch (RuntimeException rex) { /* just omit this line */ }
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,7 +17,7 @@
import org.perfsonar.base.exceptions.PerfSONARException;
/**
- * Action for simple Scheduler that registers with the LS
+ * Action for simple Scheduler that registers with the LS.
*
* @author Maciej Glowiak (main author)
* @author romradz (contributor)
@@ -33,7 +33,7 @@
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
@@ -118,7 +118,7 @@
// ---------------------------------- public methods
/**
- * Scheduler action
+ * Scheduler action.
*/
@Override
public void runAction()
@@ -131,26 +131,22 @@
switch (type) {
case EMPTY:
- case FILE: {
+ case FILE:
content = getXMLFileContent();
- }
- break;
+ break;
- case XMLDB: {
+ case XMLDB:
content = getXMLDBContent();
- }
- break;
+ break;
- case CONTEXT: {
+ case CONTEXT:
content = getContextContent();
- }
- break;
+ break;
- case LSSUMMARY: {
+ case LSSUMMARY:
content = getLSSummaryContent();
+ break;
}
- break;
- }
logger.debug("LSRegistrationComponent.runAction: register
ServiceContent = " + content);
ServiceLSRegistrator registrator = new
GenericServiceLSRegistrator(
@@ -179,7 +175,8 @@
list.addFromString(urls, localLsUrls);
int i = 1;
for (String url : urls) {
- logger.debug("LSRegistrationComponent send to [" + i +
"/" + urls.size() + "] url: [" + url + "]: ");
+ logger.debug("LSRegistrationComponent send to [" + i +
"/" + urls.size()
+ + "] url: [" + url + "]: ");
registerToLS(registrator, url);
i++;
}
@@ -191,7 +188,7 @@
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)) {
break; //break after first success
}
}
@@ -225,7 +222,8 @@
return true;
} catch (Exception ex) {
- String errorMsg = "LSRegistrationComponent error sending to [" +
url + "]: " + ex.getClass().getName() + "->" + ex.getMessage();
+ String errorMsg = "LSRegistrationComponent error sending to [" +
url + "]: "
+ + ex.getClass().getName() + "->" + ex.getMessage();
StackTraceElement[] stack = ex.getStackTrace();
if (stack != null && stack.length > 0) {
@@ -302,7 +300,7 @@
/**
- * Inits compontnt
+ * Inits component.
* Takes interval in seconds from config file
*/
@Override
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSSummaryServiceContent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -20,13 +20,12 @@
import
org.perfsonar.service.base.storage.xmldb.exist.xmlrpc.ExistDbXmlrpcXmlDataRepository;
/**
- * This class get data and summarize
+ * This class get data and summarize.
*
* @author Maciej Glowiak
*/
public class LSSummaryServiceContent implements ServiceContent
{
-
private static int counter = 0;
private static final int IP = 100;
@@ -35,10 +34,10 @@
private static final int KEYWORD = 400;
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/\"
";
+ " 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;
@@ -53,7 +52,7 @@
//private ExistDbHttpXmlStorageManager storage = null;
//private ExistDbXmlrpcXmlStorageManager storage = null;
private ExistDbGenericStorageManager storage = null;
- private static final int connectionType = HTTP; //XMLRPC or HTTP
+ private static final int CONNECTION_TYPE = HTTP; //XMLRPC or HTTP
// ----------------------------------------------------------------------
@@ -76,7 +75,7 @@
}
/**
- * Translate to HTTP uri if necessary
+ * Translate to HTTP uri if necessary.
*/
private String getHTTPUri(String uri)
{
@@ -89,7 +88,7 @@
}
/**
- * Translate to HTTP uri if necessary
+ * Translate to HTTP uri if necessary.
*/
private String getXMLRPCUri(String uri)
{
@@ -102,23 +101,19 @@
}
/**
- * Initializes Database access (from configuration)
+ * Initializes Database access (from configuration).
*
* @throws PerfSONARException
*/
private void init()
{
-
//wait 60 sec; to avoid first failed registration (when service is
//starting)
long time = 60000;
- if (LSSummaryServiceContent.counter == 0)
-
- {
- logger.debug("LSSummaryServiceContent: Wait [" +
- (time / 1000) +
- "] seconds until other components are initialized...");
+ if (LSSummaryServiceContent.counter == 0) {
+ logger.debug("LSSummaryServiceContent: Wait [" + (time / 1000)
+ + "] seconds until other components are
initialized...");
}
synchronized (this) {
@@ -135,7 +130,7 @@
try {
//get data from configuration
- switch (connectionType) {
+ switch (CONNECTION_TYPE) {
case HTTP:
logger.debug("Connection type for LSSUmmaryServiceContent is
HTTP");
dbCollection =
getHTTPUri(config.getProperty("service.ls.db_uri"));
@@ -153,10 +148,10 @@
throw new PerfSONARException();
}
logger.debug(
- "LSSummaryServiceContent: database access details: " +
- "(url=" + dbCollection + ", username=" + dbUsername + ",
" + dbPassword + ")");
+ "LSSummaryServiceContent: database access details: "
+ + "(url=" + dbCollection + ", username=" + dbUsername +
", " + dbPassword + ")");
- switch (connectionType) {
+ switch (CONNECTION_TYPE) {
case HTTP:
ExistDbHttpXmlDataRepository httpDataRepository =
new ExistDbHttpXmlDataRepository(dbCollection,
dbUsername, dbPassword);
@@ -183,16 +178,16 @@
logger.debug("LSSummaryServiceContent: storage initiated");
} catch (PerfSONARException e) {
- logger.error("LSSummaryServiceContent: Wrong XML DB settings
(url=" +
- dbCollection + ", username=" + dbUsername + ", " +
dbPassword +
- ") or cannot instantiate StorageManager");
+ 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
+ * Method that is executed by Registration component, MAIN method of the
class.
*/
@Override
public String[] getServiceContent() throws PerfSONARException
@@ -316,7 +311,7 @@
/**
* Get topology data and eventTypes from all services
- * store it in Map<String, ServiceSummary>
+ * store it in Map<String, ServiceSummary>.
*
* @return
*/
@@ -356,7 +351,7 @@
/**
* 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"
@@ -405,8 +400,8 @@
try {
result = SummarizeIpAddrs.getSummary(ipAddresses);
} catch (Exception ex) {
- logger.error("LSSummaryServiceContent: IP summarization failed.
" +
- "Exception: " + ex + " : " + ex.getMessage());
+ logger.error("LSSummaryServiceContent: IP summarization failed. "
+ + "Exception: " + ex + " : " + ex.getMessage());
result = ipAddresses;
}
return result;
@@ -434,7 +429,7 @@
/**
* Extracts data from lines (DB results) and put them into the right
place
- * in summaries
+ * in summaries.
*
* @param summaries
* @param lines results from DB
@@ -487,7 +482,7 @@
/**
- * Perform XQuery with storage manager
+ * Perform XQuery with storage manager.
*
* @param xq
* @return
@@ -499,11 +494,13 @@
String[] s = (String[]) storage.fetch(xq);
return s;
} catch (Exception e) {
- logger.error("LSSummaryServiceContent: Cannot perform xquery ["
+ xq + "]: " + e.getMessage() + "\n" + e.toString());
+ logger.error("LSSummaryServiceContent: Cannot perform xquery ["
+ xq + "]: "
+ + e.getMessage() + "\n" + e.toString());
if (e instanceof PerfSONARException) {
throw (PerfSONARException) e;
} else {
- throw new
PerfSONARException("error.lsregistration.db_error", "Cannot perform xquery ["
+ xq + "] : " + e.getLocalizedMessage());
+ throw new
PerfSONARException("error.lsregistration.db_error", "Cannot perform xquery ["
+ + xq + "] : " + e.getLocalizedMessage());
}
}
@@ -511,7 +508,7 @@
}
/**
- * Return set of IP addresses used by services
+ * Return set of IP addresses used by services.
*
* @return
*/
@@ -519,17 +516,17 @@
{
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";
+ " 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);
}
/**
- * Return set of domains used by services
+ * Return set of domains used by services.
*
* @return
*/
@@ -537,55 +534,53 @@
{
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";
+ " 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
+ * Return set of eventTypes used by services.
*
* @return
*/
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" +
- " 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";
+ " 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 xquery(xq);
}
/**
- * Return set of keywords
+ * Return set of keywords.
* 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)) " +
- " else concat($metaIdRef,',', $val1)";
+ " 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);
}
@@ -602,18 +597,17 @@
// ----------------------------------------------------------------------
/**
- * Contains summary from a single service
+ * Contains summary from a single service.
*
* @author Maciej Glowiak
*/
class ServiceSummary
{
+ private final HashSet<String> eventTypes = new HashSet<String>();
+ private HashSet<String> domains = new HashSet<String>();
+ private HashSet<String> ipAddresses = new HashSet<String>();
+ private final HashSet<String> keywords = new HashSet<String>();
- public final HashSet<String> eventTypes = new HashSet<String>();
- public HashSet<String> domains = new HashSet<String>();
- public HashSet<String> ipAddresses = new HashSet<String>();
- public final HashSet<String> keywords = new HashSet<String>();
-
public String toString()
{
@@ -652,5 +646,4 @@
// 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/PropertiesServiceDescription.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -11,7 +11,7 @@
/**
- * Class gets all registration properties from properties config file
+ * Class gets all registration properties from properties config file.
*
* @author Maciej Glowiak
*/
@@ -22,7 +22,7 @@
// ----------------------------------------------------- Constnats
/**
- * Prefix of all parameters that are used in the registration
+ * Prefix of all parameters that are used in the registration.
*/
private static final String DEFAULT_REGISTRATION_PREFIX =
"service.r.";
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/ServiceLSRegistrator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -5,30 +5,26 @@
/**
- * Service LS Registrator
+ * Service LS Registrator.
*
* @author Maciej Glowiak
*/
public interface ServiceLSRegistrator
{
+ void initRegistrator() throws PerfSONARException;
- public abstract void initRegistrator() throws PerfSONARException;
-
-
- public abstract Message register(String lsUrl)
+ Message register(String lsUrl)
throws PerfSONARException;
- public abstract Message deregister(String lsUrl, String key)
+ Message deregister(String lsUrl, String key)
throws PerfSONARException;
- public abstract Message update(String lsUrl, String key)
+ Message update(String lsUrl, String key)
throws PerfSONARException;
- public abstract Message keepalive(String lsUrl, String key)
+ Message keepalive(String lsUrl, String key)
throws PerfSONARException;
-
-
-} //ServiceLSRegistrator
\ No newline at end of file
+} //ServiceLSRegistrator
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/DataRepository.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/DataRepository.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/DataRepository.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -13,30 +13,23 @@
*/
public interface DataRepository
{
-
-
/**
* Sets type of a data repository.
*/
- public void setType(String type);
+ void setType(String type);
-
/**
* Returns the type of a data repository.
*/
- public String getType();
+ String getType();
-
/**
* Opens the acces to a data repository.
*/
- public void open() throws PerfSONARException;
+ void open() throws PerfSONARException;
-
/**
* Closes the acces to a data repository.
*/
- public void close() throws PerfSONARException;
-
-
-} //DataRepository
\ No newline at end of file
+ void close() throws PerfSONARException;
+} //DataRepository
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/GenericXmlStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -16,22 +16,17 @@
*/
public interface GenericXmlStorageManager extends StorageManager
{
-
-
/**
* Fetches data from a data repository.
*/
@Override
- public Object fetch(Object dataQuery)
+ Object fetch(Object dataQuery)
throws PerfSONARException;
-
/**
* Stores data in a data repository.
*/
@Override
- public Object store(Object dataSet)
+ Object store(Object dataSet)
throws PerfSONARException;
-
-
-} //StorageManager
\ No newline at end of file
+} //StorageManager
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/NMWGStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -18,48 +18,39 @@
*/
public interface NMWGStorageManager
{
-
-
/**
* Inits an object of this class with data repository object.
*/
- public void initStorage(Key dataRepository)
+ void initStorage(Key dataRepository)
throws PerfSONARException;
-
/**
* Fetches data from a data repository.
*/
- public Message fetch(Message dataQuery)
+ Message fetch(Message dataQuery)
throws PerfSONARException;
-
/**
* Stores data in a data repository.
*/
- public Message store(Message dataSet)
+ Message store(Message dataSet)
throws PerfSONARException;
-
/**
* Removes certain data in a data repository.
*/
- public Message remove(Message dataSet)
+ Message remove(Message dataSet)
throws PerfSONARException;
-
/**
* Removes all data in a data repository.
*/
- public void removeAll()
+ void removeAll()
throws PerfSONARException;
-
/**
* Updates data in a data repository.
*/
- public Message update(Message dataSet)
+ Message update(Message dataSet)
throws PerfSONARException;
-
-
-} //NMWGStorageManager
\ No newline at end of file
+} //NMWGStorageManager
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/StorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -4,10 +4,8 @@
*/
package org.perfsonar.service.base.storage;
-
import org.perfsonar.base.exceptions.PerfSONARException;
-
/**
* This interface declares methods to have
* an access to a data storage.
@@ -16,27 +14,21 @@
*/
public interface StorageManager
{
-
-
/**
* Inits an object of this class with data repository object.
*/
- public void initStorage(DataRepository dataRepository)
+ void initStorage(DataRepository dataRepository)
throws PerfSONARException;
-
/**
* Fetches data from a data repository.
*/
- public Object fetch(Object dataQuery)
+ Object fetch(Object dataQuery)
throws PerfSONARException;
-
/**
* Stores data in a data repository.
*/
- public Object store(Object dataSet)
+ Object store(Object dataSet)
throws PerfSONARException;
-
-
-} //StorageManager
\ No newline at end of file
+} //StorageManager
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbConstants.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -2,21 +2,18 @@
public interface XmlDbConstants
{
-
/**
- * Return results as XmlDbResult
+ * Return results as XmlDbResult.
*/
- public static final int RETURN_XML_DB_RESULT = 0x0100;
+ int RETURN_XML_DB_RESULT = 0x0100;
/**
- * Return results as XmlDbResult
+ * Return results as XmlDbResult.
*/
- public static final int RETURN_STRING_ARRAY = 0x0200;
+ int RETURN_STRING_ARRAY = 0x0200;
/**
- * Return results as String
+ * Return results as String.
*/
- public static final int RETURN_STRING = 0x0400;
-
-
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbDataRepository.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -9,7 +9,7 @@
/**
* Generic DataRepository for XML databases. Contains common parameters such
as
- * URI of the XML Collection DB username and DB password
+ * URI of the XML Collection DB username and DB password.
*
* @author Maciej Glowiak
*/
@@ -17,25 +17,25 @@
{
/**
- * Database username
+ * Database username.
*/
protected String dbUsername;
/**
- * Database password
+ * Database password.
*/
protected String dbPassword;
/**
- * Database URI
+ * Database URI.
*/
protected String dbUri;
/**
- * The object to log control/debugging messages
+ * The object to log control/debugging messages.
*/
protected LoggerComponent logger = null;
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbResult.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -77,12 +77,8 @@
public String toString()
{
String s = getResultAsString();
- return "XmlDbResult (total[" +
- total + "] first[" +
- start + "] count[" +
- count + "] result=[" +
- ((s.length() < 200) ? s : s.substring(0, 200) + "...") +
- "])";
+ return "XmlDbResult (total[" + total + "] first[" + start + "]
count[" + count + "] result=["
+ + ((s.length() < 200) ? s : s.substring(0, 200) + "...") + "])";
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/XmlDbStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -3,22 +3,20 @@
import org.perfsonar.service.base.storage.StorageManager;
/**
- * Storage Manager for XML Databases
+ * Storage Manager for XML Databases.
*
* @author Maciej Glowiak
*/
public interface XmlDbStorageManager extends StorageManager
{
+ String STRING_ARRAY_TYPE = "String[]";
- public final static String STRING_ARRAY_TYPE = "String[]";
+ String XML_DB_RESULT_TYPE = "XmlDbResult";
- public final static String XML_DB_RESULT_TYPE = "XmlDbResult";
-
/**
- * set result type of query
+ * set result type of query.
*
* @param type
*/
- public void setResultType(String type);
-
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -10,8 +10,11 @@
import
org.perfsonar.service.base.storage.xmldb.exist.rest.ExistDbHttpXmlDataRepository;
import
org.perfsonar.service.base.storage.xmldb.exist.xmlrpc.ExistDbXmlrpcXmlDataRepository;
-public class ExistDbFactory
+public final class ExistDbFactory
{
+ private ExistDbFactory()
+ {
+ }
// ----------------------------------------------------- Constants
@@ -67,40 +70,31 @@
}
-
public static XmlDbStorageManager getXMLStorageManager(
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");
+ 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;
-
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/ExistDbGenericStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,23 +17,22 @@
public abstract class ExistDbGenericStorageManager
implements XmlDbStorageManager, AuxiliaryComponent
{
-
// -------------------------------------------- Instance variables
/**
- * Component Name
+ * Component Name.
*/
private String componentName = null;
/**
- * The object to log control/debugging messages
+ * The object to log control/debugging messages.
*/
private LoggerComponent logger = null;
/**
- * Result type
+ * Result type.
*/
private int resultFlag = XmlDbConstants.RETURN_STRING_ARRAY;
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbErrorException.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -1,7 +1,7 @@
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
* <p/>
@@ -9,8 +9,6 @@
*/
public class ExistDbErrorException extends Exception
{
-
-
// ----------------------------------------------------- Constants
@@ -21,12 +19,12 @@
/**
- * HTTP code of error returned by exist DB
+ * HTTP code of error returned by exist DB.
*/
private int httpCode = -1;
/**
- * HTTP message of error returned by exist DB
+ * HTTP message of error returned by exist DB.
*/
private String httpMessage = null;
@@ -37,8 +35,8 @@
public ExistDbErrorException(int code, String description)
{
- super("eXist DB responsed with HTTP error code code [" +
- code + "] additional message was [" + description + "]");
+ super("eXist DB responsed with HTTP error code code ["
+ + code + "] additional message was [" + description + "]");
httpCode = code;
httpMessage = description;
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -12,7 +12,7 @@
/**
* HTTP Access to eXist DB XML (exist-db.org)
- * Supports HTTP authorization, results parsing
+ * Supports HTTP authorization, results parsing.
*
* @author Maciej Glowiak
* <p/>
@@ -20,8 +20,6 @@
*/
public class ExistDbHTTPAccess extends HTTPAccess implements XmlDbConstants
{
-
-
// ---------------------------------------------Instance variables
private boolean debug = false;
@@ -30,13 +28,13 @@
// -------------------------------------------------- other
/**
- * Start from first element
+ * Start from first element.
*/
public static final int FIRST = 1;
/**
- * Return all results
+ * Return all results.
*/
public static final int ALL_RESULTS = 0;
@@ -50,10 +48,8 @@
String username,
String password) throws IOException, ExistDbErrorException
{
-
HTTPResult result = sendPOSTRequest(url, updateString, username,
password);
return result.getResultCode();
-
}
/**
@@ -74,28 +70,25 @@
int start,
int limit) throws IOException
{
-
//prepare XQuery
- content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<query xmlns=\"http://exist.sourceforge.net/NS/exist\" " +
- "start=\"" + String.valueOf(start) + "\" max=\"" +
- String.valueOf(limit) + "\" cache=\"no\"> " +
- " <text>" +
- "<![CDATA[" +
- content +
- "]]>" +
- " </text> " +
- " <properties>" +
- " <property name=\"indent\" value=\"yes\"/>" + //temp
- " <property name=\"encoding\" value=\"UTF-8\"/>" +
//temp
- " </properties>" +
- "</query>";
+ content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<query xmlns=\"http://exist.sourceforge.net/NS/exist\" "
+ + "start=\"" + String.valueOf(start) + "\" max=\""
+ + String.valueOf(limit) + "\" cache=\"no\"> "
+ + " <text>"
+ + "<![CDATA["
+ + content
+ + "]]>"
+ + " </text> "
+ + " <properties>"
+ + " <property name=\"indent\" value=\"yes\"/>"
+ + " <property name=\"encoding\" value=\"UTF-8\"/>"
+ + " </properties>"
+ + "</query>";
return sendPOSTRequest(url, content, username, password);
-
}
-
public XmlDbResult sendExistXQueryRequest(
String url,
String query,
@@ -104,7 +97,6 @@
int start,
int limit) throws IOException, ExistDbErrorException
{
-
/* ******************************************************** */
//send HTTP request and encapsulate query
@@ -129,11 +121,9 @@
}
-
private XmlDbResult parseExistXMLReponse(
InputStream inputStream) throws IOException
{
-
int hits = -1, first = -1, count = -1;
String result;
String[] resultArray = null;
@@ -313,55 +303,10 @@
// --------------------------------------------------- test method
/**
- * Test method
+ * Test method.
*/
public static void main(String[] args) throws Exception
{
-
-// String query =
-// "declare namespace " +
-// "nmwg='http://ggf.org/ns/nmwg/base/2.0/'; " +
-// "/nmwg:store/nmwg:metadata";
-
-// 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()\">" +
-// "<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/\">" +
-// " <nmwg:metadata id=\"meta1\">" +
-// " <perfsonar:subject id=\"subj1\"
xmlns:perfsonar=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/\">" +
-// " <nmwgt:interface
xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\">" +
-// "
<nmwgt:hostName>atlang-hstnng.abilene.ucaid.edu</nmwgt:hostName>" +
-// "
<nmwgt:ifName>unknown</nmwgt:ifName>" +
-// "
<nmwgt:ifDescription>hstn:oc192(p2p)::show:intracloud</nmwgt:ifDescription>" +
-// " <nmwgt:ifAddress
type=\"ipv4\">198.32.8.34</nmwgt:ifAddress>" +
-// "
<nmwgt:direction>in</nmwgt:direction>" +
-// "
<nmwgt:capacity>10000000000</nmwgt:capacity>" +
-// " </nmwgt:interface>" +
-// " </perfsonar:subject>" +
-// "
<nmwg:eventType>utilization</nmwg:eventType>" +
-// " </nmwg:metadata>" +
-// "</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)";
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/ExistDbHttpXmlStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -36,7 +36,7 @@
// -------------------------------------- InstanceVariables
/**
- * Data repository object
+ * Data repository object.
*/
protected XmlDbDataRepository dataRepository = null;
@@ -156,8 +156,8 @@
"error.common.storage.xmldb.open",
"XQuery by HTTP failed. "
+ "Could not connect to eXist via pure http, "
- + " nested exception was: " +
- ex.getClass() + " : " + ex.getMessage());
+ + " nested exception was: "
+ + ex.getClass() + " : " + ex.getMessage());
}
if (getResultType() == XmlDbConstants.RETURN_STRING_ARRAY) {
@@ -188,8 +188,8 @@
"error.common.storage.xmldb.open",
"XUpdate by HTTP failed. "
+ "Could not connect to eXist via pure http, "
- + " nested exception was: " +
- ex.getClass() + " : " + ex.getMessage());
+ + " nested exception was: "
+ + ex.getClass() + " : " + ex.getMessage());
}
return results; // String, String[] or XmlDbResult
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPAccess.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -28,7 +28,7 @@
/**
- * POST - Sends text content to the server
+ * POST - Sends text content to the server.
*
* @param url
* @param content
@@ -56,7 +56,7 @@
/**
- * DELETE - removes remote resource from the server
+ * DELETE - removes remote resource from the server.
*
* @param url
* @param username
@@ -81,7 +81,7 @@
/**
- * PUT - sends resource to the server
+ * PUT - sends resource to the server.
*
* @param url
* @param content
@@ -108,7 +108,7 @@
/**
- * GET - downloads remote document from the server
+ * GET - downloads remote document from the server.
*
* @param url
* @param username
@@ -133,7 +133,7 @@
/**
- * Generic operation on the HTTP server
+ * Generic operation on the HTTP server.
*
* @param url
* @param method
@@ -161,10 +161,9 @@
boolean debug = false;
//connect by HTTP with /exist/rest/db/COLLECTION
- URL _url = new URL(url);
//create HTTP URL Connection
- httpUrlConnection = (HttpURLConnection) _url.openConnection();
+ httpUrlConnection = (HttpURLConnection) new
URL(url).openConnection();
//set HTTP method
httpUrlConnection.setRequestMethod(method);
@@ -193,13 +192,12 @@
if (!(username != null && username.isEmpty())) {
if (debug) {
- System.out.println("[D] authorization Basic " +
- username + ":" + password);
+ System.out.println("[D] authorization Basic "
+ + username + ":" + password);
}
- String basicAuth = "Basic " +
- (new sun.misc.BASE64Encoder().
- encode((username + ":" + password).getBytes()));
+ String basicAuth = "Basic "
+ + (new sun.misc.BASE64Encoder().encode((username + ":" +
password).getBytes()));
httpUrlConnection.setRequestProperty(
"Authorization", basicAuth);
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/rest/HTTPResult.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -3,7 +3,7 @@
import java.io.InputStream;
/**
- * Represents HTTP results
+ * Represents HTTP results.
*
* @author Maciej Glowiak
*/
@@ -40,4 +40,4 @@
return resultMessage;
}
-} //HTTPResult
\ No newline at end of file
+} //HTTPResult
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlDataRepository.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -8,7 +8,7 @@
import org.xmldb.api.base.XMLDBException;
/**
- * Data Repository implementation for Exist DB XML (http://exist-db.org/)
+ * 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.
*
@@ -16,7 +16,6 @@
*/
public class ExistDbXmlrpcXmlDataRepository extends XmlDbDataRepository
{
-
/**
* Default driver class for Exist XML DB.
*/
@@ -29,19 +28,19 @@
/**
* Database driver classname, default for Exist DB XML
- * is "org.exist.xmldb.DatabaseImpl"
+ * is "org.exist.xmldb.DatabaseImpl".
*/
private String dbDriverClassname = EXIST_DB_DRIVER;
/**
- * XML Database (exist DB XML object)
+ * XML Database (exist DB XML object).
*/
private Database existDatabase;
/**
- * Collection (exist DB XML object)
+ * Collection (exist DB XML object).
*/
private Collection existCollection;
@@ -83,7 +82,7 @@
/**
* Get database driver classname, default for Exist DB XML
- * is "org.exist.xmldb.DatabaseImpl"
+ * is "org.exist.xmldb.DatabaseImpl".
*/
public String getDbDriverClassname()
{
@@ -94,7 +93,7 @@
/**
* Set database driver classname, default for Exist DB XML
- * is "org.exist.xmldb.DatabaseImpl"
+ * is "org.exist.xmldb.DatabaseImpl".
*/
public void setDbDriverClassname(String dbDriverClassname)
{
@@ -105,7 +104,7 @@
/**
- * Get XML Collection (exist DB XML object). Null if not connected
+ * Get XML Collection (exist DB XML object). Null if not connected.
*/
public Collection getExistCollection()
{
@@ -116,7 +115,7 @@
/**
- * Get XML Database (exist DB XML object). Null if not connected
+ * Get XML Database (exist DB XML object). Null if not connected.
*/
public Database getExistDatabase()
{
@@ -169,28 +168,27 @@
+ dbDriverClassname + ", " + e.getMessage());
} catch (InstantiationException e) {
throw new
PerfSONARException("error.common.storage.xmldb.open",
- "ExistDbXmlrpcXmlDataRepository: " +
- "Can't create eXist DB XML driver instance "
+ "ExistDbXmlrpcXmlDataRepository: "
+ + "Can't create eXist DB XML driver instance "
+ dbDriverClassname + ", " + e.getMessage());
} catch (IllegalAccessException e) {
throw new
PerfSONARException("error.common.storage.xmldb.open",
- "ExistDbXmlrpcXmlDataRepository: " +
- "IllegalAccessException, " + e.getMessage());
+ "ExistDbXmlrpcXmlDataRepository: IllegalAccessException,
" + e.getMessage());
} catch (XMLDBException e) {
throw new
PerfSONARException("error.common.storage.xmldb.open",
"ExistDbXmlrpcXmlDataRepository: XML DB Exception " +
e.getMessage());
} catch (NullPointerException e) {
throw new
PerfSONARException("error.common.storage.xmldb.open",
- "ExistDbXmlrpcXmlDataRepository: NullPointerException ["
+
- "database=" + existDatabase + ", collection=" +
existCollection +
- ", driver=" + dbDriverClassname + ", params: " +
dbUri + " : " +
- dbUsername + " : " + dbPassword + "] " +
e.getMessage());
+ "ExistDbXmlrpcXmlDataRepository: NullPointerException ["
+ + "database=" + existDatabase + ", collection=" +
existCollection
+ + ", driver=" + dbDriverClassname + ", params: " +
dbUri + " : "
+ + dbUsername + " : " + dbPassword + "] " +
e.getMessage());
}
} else {
- logger.error("ExistDbXmlrpcXmlDataRepository: error connecting
database - " +
- "database connection has been already opened; close it
first!");
+ logger.error("ExistDbXmlrpcXmlDataRepository: error connecting
database - "
+ + "database connection has been already opened;
close it first!");
}
@@ -201,29 +199,20 @@
@Override
public void close() throws PerfSONARException
{
-
if (existDatabase != null) {
-
try {
-
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");
+ logger.error("ExistDbXmlrpcXmlDataRepository: can't close
connection; "
+ + "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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmldb/exist/xmlrpc/ExistDbXmlrpcXmlStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -35,7 +35,7 @@
/**
- * Data repository object
+ * Data repository object.
*/
private ExistDbXmlrpcXmlDataRepository dataRepository = null;
@@ -48,7 +48,7 @@
/**
- * Indicates if connection to DB is established
+ * Indicates if connection to DB is established.
*/
private boolean isConnected = false;
@@ -83,9 +83,9 @@
} catch (ClassCastException ex) {
- getLogger().error("ExistDbXmlrpcXmlStorageManager: wrong data
repository class (" +
- dataRepository.getClass().getName() +
- ")! Data repository must implement
ExistDbXmlrpcXmlDataRepository class");
+ getLogger().error("ExistDbXmlrpcXmlStorageManager: wrong data
repository class ("
+ + dataRepository.getClass().getName()
+ + ")! Data repository must implement
ExistDbXmlrpcXmlDataRepository class");
}
@@ -101,7 +101,7 @@
//read properties
getLogger().debug("ExistDbXmlrpcXmlStorageManager: read properties
from configuration component");
- DataRepository dataRepository =
+ DataRepository newDataRepository =
ExistDbFactory.getDataRepositoryByProperties(
ExistDbFactory.EXIST_XMLRPC,
"component." + getComponentName() + ".db_uri",
@@ -111,7 +111,7 @@
//Init Storage Manager with DataRepository
- initStorage(dataRepository);
+ initStorage(newDataRepository);
}
@@ -133,14 +133,12 @@
xqueryExpression = (String) dataQuery;
} catch (ClassCastException ex) {
throw new
PerfSONARException("error.common.storage.xmldb.wrong_query",
- "ExistDbXmlrpcXmlStorageManager: This method accepts " +
- "StringData data format only");
+ "ExistDbXmlrpcXmlStorageManager: This method accepts
StringData data format only");
}
if (xqueryExpression == null) {
throw new
PerfSONARException("error.common.storage.xmldb.empty_query",
- "ExistDbXmlrpcXmlStorageManager: Input DataQuery " +
- "contains no data");
+ "ExistDbXmlrpcXmlStorageManager: Input DataQuery contains no
data");
}
try {
@@ -225,14 +223,12 @@
} catch (ClassCastException ex) {
throw new
PerfSONARException("error.common.storage.xmldb.wrong_query",
- "ExistDbXmlrpcXmlStorageManager: This method accepts " +
- "StringData data format only");
+ "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");
+ "ExistDbXmlrpcXmlStorageManager: Input DataQuery contains no
data");
}
try {
@@ -288,7 +284,7 @@
// -------------------------------------------------------------------
Private methods
/**
- * Connect if required
+ * Connect if required.
*/
private void connect() throws PerfSONARException
{
@@ -303,7 +299,7 @@
}
/**
- * Disconnect if required
+ * Disconnect if required.
*
* @throws PerfSONARException
*/
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/storage/xmlfile/XmlFileStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -25,11 +25,8 @@
import org.w3c.dom.xpath.XPathResult;
import org.xml.sax.InputSource;
-
public class XmlFileStorageManager implements StorageManager
{
-
-
// ----------------------------------------------------- Instance
variables
@@ -40,7 +37,7 @@
/**
- * Accepts XmlFileDataRepository
+ * Accepts XmlFileDataRepository.
*/
@Override
public void initStorage(DataRepository dataRepository)
@@ -58,8 +55,6 @@
/**
- * Returns
- *
* @param XPath expression as String
* @return String[] XML results
*/
@@ -153,12 +148,11 @@
/**
- * UNIMPLEMENTED
+ * UNIMPLEMENTED.
*/
@Override
public Object store(Object dataSet) throws PerfSONARException
{
-
throw new PerfSONARException("not implemented");
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransport.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -12,11 +12,8 @@
*/
public interface FileTransport
{
-
-
// ---------------------------------- public methods
-
/**
* Copy file from source location to destination location.
*
@@ -25,7 +22,7 @@
* @param dst destination location
* @throws Exception in case of error
*/
- public void copy(String file, Location src, Location dst)
+ void copy(String file, Location src, Location dst)
throws Exception;
/**
@@ -35,7 +32,7 @@
* @param loc location
* @throws Exception in case of error
*/
- public void delete(String file, Location loc)
+ void delete(String file, Location loc)
throws Exception;
/**
@@ -46,8 +43,6 @@
* @return true if file exists, false otherwise
* @throws Exception in case of error
*/
- public boolean exists(String file, Location loc)
+ boolean exists(String file, Location loc)
throws Exception;
-
-
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/FileTransportFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -11,10 +11,8 @@
*
* @author urosj
*/
-public class FileTransportFactory
+public final class FileTransportFactory
{
-
-
// ---------------------------------- constants
@@ -32,6 +30,9 @@
*/
public static final String SSH_FILE_TRANSPORT_IMPL = "ssh";
+ private FileTransportFactory()
+ {
+ }
// ---------------------------------- public methods
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/Location.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -32,19 +32,19 @@
/**
- * Path (to file)
+ * Path (to file).
*/
private String path = null;
/**
- * Port (optional port number, null if not used)
+ * Port (optional port number, null if not used).
*/
private Integer port = null;
/**
* Username (optional username used for accessing remote address,
- * null if not used)
+ * null if not used).
*/
private String username = null;
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/transport/SSHFileTransport.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -80,16 +80,13 @@
if (dst == null) {
throw new Exception("dst is null");
}
- if (src.getAddress() == null &&
- dst.getAddress() == null) {
+ if (src.getAddress() == null && dst.getAddress() == null) {
throw new Exception("both src and dst addresses are null");
}
- if (src.getAddress() != null &&
- dst.getAddress() != null) {
+ if (src.getAddress() != null && dst.getAddress() != null) {
throw new Exception("both src and dst addresses are not null");
}
- if (src.getPath() == null ||
- dst.getPath() == null) {
+ if (src.getPath() == null || dst.getPath() == null) {
throw new Exception("src or dst path is null");
}
@@ -107,9 +104,7 @@
+ System.getProperty("file.separator")
+ file;
String remoteAddress =
- (dst.getUsername() == null ? "" :
- (dst.getUsername() + "@"))
- + dst.getAddress();
+ (dst.getUsername() == null ? "" : (dst.getUsername() + "@"))
+ dst.getAddress();
// Open local file for reading
FileInputStream fin = new FileInputStream(localFilePath);
@@ -155,17 +150,11 @@
} else if (dst.getAddress() == null) {
String remoteFilePath =
- src.getPath()
- + System.getProperty("file.separator")
- + file;
+ src.getPath() + System.getProperty("file.separator") + file;
String remoteAddress =
- (src.getUsername() == null ? "" :
- (src.getUsername() + "@"))
- + src.getAddress();
+ (src.getUsername() == null ? "" : (src.getUsername() + "@"))
+ src.getAddress();
String localFilePath =
- dst.getPath()
- + System.getProperty("file.separator")
- + file;
+ dst.getPath() + System.getProperty("file.separator") + file;
// Open local file for writing
FileOutputStream fout = new FileOutputStream(localFilePath);
@@ -253,9 +242,7 @@
+ System.getProperty("file.separator")
+ file;
String remoteAddress =
- (loc.getUsername() == null ? "" :
- (loc.getUsername() + "@"))
- + loc.getAddress();
+ (loc.getUsername() == null ? "" : (loc.getUsername() + "@")) +
loc.getAddress();
ArrayList<String> cmdArgs = new ArrayList<String>();
cmdArgs.add(SSH_EXEC);
@@ -326,9 +313,7 @@
+ System.getProperty("file.separator")
+ file;
String remoteAddress =
- (loc.getUsername() == null ? "" :
- (loc.getUsername() + "@"))
- + loc.getAddress();
+ (loc.getUsername() == null ? "" : (loc.getUsername() + "@")) +
loc.getAddress();
ArrayList<String> cmdArgs = new ArrayList<String>();
cmdArgs.add(SSH_EXEC);
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/util/ResultCodesUtil.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -10,17 +10,19 @@
/**
- * Class for creating result code structures (data, metadata, message)
+ * Class for creating result code structures (data, metadata, message).
*
* @author Maciej Glowiak
*/
-public class ResultCodesUtil
+public final class ResultCodesUtil
{
+ private ResultCodesUtil()
+ {
+ }
-
/**
* Create Metadata element containing result code and (optional)
- * reference to other metadata
+ * 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.
@@ -135,7 +137,7 @@
/**
* Converts PerfSONARException into metadata+data result code block
- * and puts it into given Message object
+ * and puts it into given Message object.
*
* @param message object where to put result code
* @param pex perfsonar exception containing result code
and description
@@ -146,10 +148,6 @@
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -32,7 +32,6 @@
*/
public class RequestHandler
{
-
private static final String INIT_SERVICE_MESSAGE_TYPE = "InitService";
private static final String SAX_PARSER_CONFIG =
"service.sax_parser.config";
@@ -46,7 +45,7 @@
private final Object initialisationMutex = new Object();
/**
- * Accepts web service based calls and gives back responses
+ * Accepts web service based calls and gives back responses.
*
* @param request org.w3c.dom.Document which contains the XML request
* @return org.w3c.dom.Document response provided by the service
@@ -65,7 +64,7 @@
}
/**
- * initializes this RequestHandler by creating and retrieving Aux
components
+ * initializes this RequestHandler by creating and retrieving Aux
components.
*
* @throws PerfSONARException
*/
@@ -103,7 +102,8 @@
messageType = requestMessage.getType();
messageId = requestMessage.getId();
- logger.debug("RequestHandler: Message object constructed from
request. Request is of type: " + requestMessage.getType());
+ 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);
@@ -117,7 +117,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.
@@ -138,8 +138,8 @@
//Critical error, cannot convert message to DOM;
// - parsing error of Error Response, shouldn't happen
logger.fatal(
- "RequestHandler: Return null response - can neither create "
+
- "response message nor error code message!"
+ "RequestHandler: Return null response - can neither create "
+ + "response message nor error code message!"
);
}
logger.info("RequestHandler: Service sent a response with error
information");
@@ -168,7 +168,8 @@
// 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
@@ -202,7 +203,7 @@
}
/**
- * Checks if something went wrong with parsing
+ * Checks if something went wrong with parsing.
*
* @param requestMessage
* @throws PerfSONARException if the requestMessage is invalid
@@ -213,8 +214,8 @@
logger.error("RequestHandler: Message object constructed as null
from request");
throw new PerfSONARException(
"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"
+ "RequestHandler: Server could not construct a message object
from "
+ + "the request due to unknown error. Please check
request and try again"
);
}
}
@@ -255,7 +256,7 @@
}
/**
- * Converts a Document to a Message
+ * Converts a Document to a Message.
*
* @param request
* @return a converted requestMessage or null on failure
@@ -304,7 +305,7 @@
/**
- * Print out time of execution (to log)
+ * Print out time of execution (to log).
*
* @param startTime
* @param messageType
@@ -313,8 +314,7 @@
private void logExecutionTime(long startTime, String messageId, String
messageType)
{
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)));
+ 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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/eventTypeConfig/EventTypeConfigurationComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -31,15 +31,12 @@
public class EventTypeConfigurationComponent
implements AuxiliaryComponent
{
-
-
//-------------------------------------------- class fields
+ private static final String DIGESTER_RULES =
"perfsonar/conf/eventType-rules.xml";
- private static final String digesterRules =
"perfsonar/conf/eventType-rules.xml";
+ private static final String DIGESTER_INPUT =
"perfsonar/conf/eventType-map.xml";
- private static final String digesterInput =
"perfsonar/conf/eventType-map.xml";
-
private String componentName = null;
private LoggerComponent logger = null;
@@ -84,36 +81,36 @@
URL digesterRulesURL = null;
try {
- digesterRulesURL = Resources.getResourceURL(digesterRules);
+ digesterRulesURL = Resources.getResourceURL(DIGESTER_RULES);
} catch (IOException ioex) {
logger.debug("EventTypeConfigurationComponent.initComponent: "
+ ioex.toString());
}
if (digesterRulesURL == null) {
logger.debug("EventTypeConfigurationComponent.initComponent: "
- + "Could not find xml config file " + digesterRules);
+ + "Could not find xml config file " + DIGESTER_RULES);
throw new PerfSONARException(
"error.common",
"EventTypeConfigurationComponent.initComponent: "
- + "Could not find xml config file " + digesterRules);
+ + "Could not find xml config file " + DIGESTER_RULES);
}
InputStream digesterInputStream = null;
try {
- digesterInputStream =
Resources.getResourceAsStream(digesterInput);
+ digesterInputStream =
Resources.getResourceAsStream(DIGESTER_INPUT);
} catch (IOException ioex) {
logger.debug("EventTypeConfigurationComponent.initComponent: "
+ ioex.toString());
}
if (digesterInputStream == null) {
logger.debug("EventTypeConfigurationComponent.initComponent: "
- + "Could not find xml file " + digesterInput);
+ + "Could not find xml file " + DIGESTER_INPUT);
throw new PerfSONARException(
"error.common",
"EventTypeConfigurationComponent.initComponent: "
+ "Could not create an input stream of xml config file "
- + digesterInput);
+ + DIGESTER_INPUT);
}
@@ -131,12 +128,12 @@
} catch (Exception ex) {
logger.debug("EventTypeConfigurationComponent.initComponent: "
- + "Could not parse " + digesterInput
+ + "Could not parse " + DIGESTER_INPUT
+ ": " + ex.toString());
throw new PerfSONARException(
"error.common",
"EventTypeConfigurationComponent.initComponent: "
- + "Could not parse " + digesterInput);
+ + "Could not parse " + DIGESTER_INPUT);
}
@@ -177,4 +174,4 @@
}
-} //EventTypeConfigurationComponent
\ No newline at end of file
+} //EventTypeConfigurationComponent
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/MetadataConfigurationStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -293,11 +293,7 @@
logger.debug(query);
String[] results = executeQuery(query);
- if (results != null && results.length > 0) {
- return true;
- } else {
- return false;
- }
+ return results != null && results.length > 0;
}
@@ -462,9 +458,8 @@
protected ConfigurationComponent getConfiguration() throws
PerfSONARException
{
-
try {
- return configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
+ configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.CONFIG);
} catch (PerfSONARException e) {
throw new PerfSONARException(
@@ -472,7 +467,8 @@
"MetadataConfigurationStorageManager.getConfiguration: "
+ "Cannot get config component");
}
+ return configuration;
}
-} //MetadataConfigurationStorageManager
\ No newline at end of file
+} //MetadataConfigurationStorageManager
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/SimpleMetadataConfigurationStorageManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/SimpleMetadataConfigurationStorageManager.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/SimpleMetadataConfigurationStorageManager.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -300,9 +300,8 @@
protected ConfigurationComponent getConfiguration() throws
PerfSONARException
{
-
try {
- return configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
+ configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.CONFIG);
} catch (PerfSONARException e) {
throw new PerfSONARException(
@@ -310,6 +309,7 @@
"SimpleMetadataConfigurationStorageManager.getConfiguration:
"
+ "Cannot get config component");
}
+ return configuration;
}
@@ -335,4 +335,4 @@
}
-} //SimpleMetadataConfigurationStorageManager
\ No newline at end of file
+} //SimpleMetadataConfigurationStorageManager
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/Transformations.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -177,9 +177,8 @@
}
-
/**
- * Returns nmwg objects with specific tag names parsed from xml string
+ * Returns nmwg objects with specific tag names parsed from xml string.
*/
public Map<String, Element> transformResults(String xmlPart, String[]
tagNames)
throws PerfSONARException
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/L2PathStatusKeyGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/L2PathStatusKeyGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/L2PathStatusKeyGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -27,8 +27,7 @@
public Key getKey(Metadata metadata, Data data) throws PerfSONARException
{
- if (metadata.getSubject() != null &&
- metadata.getSubject().getChildrenByType("link").isEmpty()) {
+ if (metadata.getSubject() != null &&
metadata.getSubject().getChildrenByType("link").isEmpty()) {
return null;
}
@@ -123,4 +122,4 @@
}
-} //L2PathStatusKeyGenerator
\ No newline at end of file
+} //L2PathStatusKeyGenerator
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -10,12 +10,7 @@
import org.ggf.ns.nmwg.base.v2_0.Key;
import org.perfsonar.base.exceptions.PerfSONARException;
-
public interface MetadataKeyGenerator
{
-
-
- public Key getKey(Metadata metadata, Data data) throws
PerfSONARException;
-
-
-} //MetadataKeyGenerator
\ No newline at end of file
+ Key getKey(Metadata metadata, Data data) throws PerfSONARException;
+} //MetadataKeyGenerator
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/keyGenerator/MetadataKeyGeneratorFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -14,10 +14,12 @@
import
org.perfsonar.service.measurementArchive.eventTypeConfig.EventTypeConfigurationComponent;
-public class MetadataKeyGeneratorFactory
+public final class MetadataKeyGeneratorFactory
{
+ private MetadataKeyGeneratorFactory()
+ {
+ }
-
public static MetadataKeyGenerator getMetadataKeyGenerator(String
eventTypeName)
throws PerfSONARException
{
@@ -98,4 +100,4 @@
}
-} //MetadataKeyGeneratorFactory
\ No newline at end of file
+} //MetadataKeyGeneratorFactory
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/BwctlQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/BwctlQueryGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/BwctlQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,7 +17,7 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with bwctl data)
+ * (query to fetch metadata with bwctl data).
*
* @author fernandes
*/
@@ -110,8 +110,8 @@
for (String parameter : parameters) {
if (params.getParameterByName(parameter) != null) {
parametersMap.put(parameter,
-
(params.getParameterByName(parameter).getParameterValue() != null ?
-
params.getParameterByName(parameter).getParameterValue().trim() : ""));
+
(params.getParameterByName(parameter).getParameterValue() != null
+ ?
params.getParameterByName(parameter).getParameterValue().trim() : ""));
}
}
@@ -128,9 +128,9 @@
+ "declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; \n\n";
xQuery +=
- " let $res :=
\n"
- + " for $i in //nmwg:metadata \n"
- + " where 1
\n";
+ " let $res := \n"
+ + " for $i in //nmwg:metadata \n"
+ + " where 1 \n";
if (!eventType.isEmpty()) {
xQuery += "and $i/nmwg:eventType[(text()='" + eventType + "')]";
@@ -154,32 +154,23 @@
}
xQuery += "\n"
- + " return $i
\n"
- + "
\n"
- + " let $metaids :=
\n"
- + " for $j in $res
\n"
- + " return fn:data($j/@id)
\n"
- + "
\n"
- + " let $datas :=
\n"
- + " for $k in $metaids
\n"
- + " let $d :=
\n"
- + " for $l in //nmwg:data \n"
- + " where $l/@metadataIdRef = $k \n"
- + " return $l
\n"
- + " return $d
\n"
- + "
\n"
- + " return ($res, $datas)
\n";
+ + " return $i \n"
+ + " \n"
+ + " let $metaids := \n"
+ + " for $j in $res \n"
+ + " return fn:data($j/@id) \n"
+ + " \n"
+ + " let $datas := \n"
+ + " for $k in $metaids \n"
+ + " let $d := \n"
+ + " for $l in //nmwg:data \n"
+ + " where $l/@metadataIdRef = $k \n"
+ + " return $l \n"
+ + " return $d \n"
+ + " \n"
+ + " return ($res, $datas) \n";
-
- //logger.debug(
- // "BwctlQueryGenerator.getMetadataQuery: "
- // + "meta query: "
- // + xQuery);
-
-
return xQuery;
-
-
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -18,7 +18,7 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with discards metric)
+ * (query to fetch metadata with discards metric).
*
* @author romradz
*/
@@ -111,7 +111,9 @@
keyword = keywordParameter.getParameterValue();
if (!keyword.trim().isEmpty()) {
- keywordQueryPart = " and
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword + "' and
functx:trim(@name)='keyword') or (functx:trim(@value)='" + keyword + "' and
functx:trim(@name)='keyword')] ";
+ keywordQueryPart = " and
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword
+ + "' and functx:trim(@name)='keyword') or
(functx:trim(@value)='" + keyword
+ + "' and functx:trim(@name)='keyword')] ";
}
}
@@ -161,17 +163,17 @@
+ "}; \n\n";
- if (ipAddress == null &&
- hostName == null &&
- ifName == null &&
- ifDescription == null &&
- ifAddress == null &&
- ifIndex == null &&
- type == null &&
- direction == null &&
- classOfService == null &&
- capacity == null &&
- keywordParameter == null) {
+ if (ipAddress == null
+ && hostName == null
+ && ifName == null
+ && ifDescription == null
+ && ifAddress == null
+ && ifIndex == null
+ && type == null
+ && direction == null
+ && classOfService == null
+ && capacity == null
+ && keywordParameter == null) {
// getting all metadata
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -18,7 +18,7 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with errors metric)
+ * (query to fetch metadata with errors metric).
*
* @author romradz
*/
@@ -111,7 +111,9 @@
keyword = keywordParameter.getParameterValue();
if (!keyword.trim().isEmpty()) {
- keywordQueryPart = " and
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword + "' and
functx:trim(@name)='keyword') or (functx:trim(@value)='" + keyword + "' and
functx:trim(@name)='keyword')] ";
+ keywordQueryPart = " and
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword
+ + "' and functx:trim(@name)='keyword') or
(functx:trim(@value)='" + keyword
+ + "' and functx:trim(@name)='keyword')] ";
}
}
@@ -160,17 +162,17 @@
+ " replace(replace($arg,'\\s+$',''),'^\\s+','') \n"
+ "}; \n\n";
- if (ipAddress == null &&
- hostName == null &&
- ifName == null &&
- ifDescription == null &&
- ifAddress == null &&
- ifIndex == null &&
- type == null &&
- direction == null &&
- classOfService == null &&
- capacity == null &&
- keywordParameter == null) {
+ if (ipAddress == null
+ && hostName == null
+ && ifName == null
+ && ifDescription == null
+ && ifAddress == null
+ && ifIndex == null
+ && type == null
+ && direction == null
+ && classOfService == null
+ && capacity == null
+ && keywordParameter == null) {
// getting all metadata
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/IperfQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -26,7 +26,7 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with utilization metric)
+ * (query to fetch metadata with utilization metric).
*
* @author romradz
*/
@@ -39,7 +39,8 @@
protected LoggerComponent logger = null;
- private final String[] parameters = {"format", "protocol", "windowSize",
"timeDuration", "valueUnits", "numBytesUnits"};
+ private final String[] parameters =
+ {"format", "protocol", "windowSize", "timeDuration", "valueUnits",
"numBytesUnits"};
// -------------------------------------- constructors
@@ -112,7 +113,9 @@
keyword = keywordParameter.getParameterValue();
if (!keyword.trim().isEmpty()) {
- keywordQueryPart = " and
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword + "' and
functx:trim(@name)='keyword') or (functx:trim(@value)='" + keyword + "' and
functx:trim(@name)='keyword')] ";
+ keywordQueryPart = " and
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword
+ + "' and functx:trim(@name)='keyword') or
(functx:trim(@value)='" + keyword
+ + "' and functx:trim(@name)='keyword')] ";
}
}
@@ -130,8 +133,8 @@
for (String parameter : parameters) {
if (params.getParameterByName(parameter) != null) {
iperfParametersMap.put(parameter,
-
(params.getParameterByName(parameter).getParameterValue() != null ?
-
params.getParameterByName(parameter).getParameterValue().trim() : ""));
+
(params.getParameterByName(parameter).getParameterValue() != null
+ ?
params.getParameterByName(parameter).getParameterValue().trim() : ""));
}
}
}
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -19,7 +19,7 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with L2 path status metric)
+ * (query to fetch metadata with L2 path status metric).
*
* @author romradz
*/
@@ -108,7 +108,9 @@
String keyword = keywordParameter.getParameterValue();
if (!keyword.trim().isEmpty()) {
- keywordQueryPart = " and
$k/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword + "' and
functx:trim(@name)='keyword') or (functx:trim(@value)='" + keyword + "' and
functx:trim(@name)='keyword')] \n";
+ keywordQueryPart = " and
$k/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + keyword
+ + "' and functx:trim(@name)='keyword') or
(functx:trim(@value)='" + keyword
+ + "' and functx:trim(@name)='keyword')] \n";
}
}
@@ -336,7 +338,7 @@
+ " where
fn:data($k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef) = $node1_id
\n"
+ " and
fn:data($k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef) = $node2_id
\n"
+ " and (
\n"
- + "
$k/nmwg:eventType[functx:trim(text())='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status']
\n"
+ + "
$k/nmwg:eventType[functx:trim(text())='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status']
\n"
+ " or
\n"
+ "
$k/nmwg:parameters/nmwg:parameter[(functx:trim(text())='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status'
and functx:trim(@name)='supportedEventType') \n"
+ " or
(functx:trim(@value)='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status' and
functx:trim(@name)='supportedEventType')] \n"
@@ -409,7 +411,7 @@
+ "
\n"
+ " let $node_id :=
\n"
+ " if ($node_metadata) then
\n"
- + "
fn:data($node_metadata/nmwg:subject/nmwgtopo3:node/@id) \n"
+ + "
fn:data($node_metadata/nmwg:subject/nmwgtopo3:node/@id) \n"
+ " else
\n"
+ " ''
\n";
}
@@ -422,7 +424,7 @@
+ " for $k in //nmwg:metadata
\n"
+ " where
fn:data($k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef) = $node_id
\n"
+ " and (
\n"
- + "
$k/nmwg:eventType[functx:trim(text())='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status']
\n"
+ + "
$k/nmwg:eventType[functx:trim(text())='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status']
\n"
+ " or
\n"
+ "
$k/nmwg:parameters/nmwg:parameter[(functx:trim(text())='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status'
and functx:trim(@name)='supportedEventType') \n"
+ " or
(functx:trim(@value)='http://ggf.org/ns/nmwg/topology/l2/3.0/link/status' and
functx:trim(@name)='supportedEventType')] \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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/L2PathStatusQueryGeneratorTMP.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -28,36 +28,26 @@
*/
public class L2PathStatusQueryGeneratorTMP implements MetadataQueryGenerator
{
-
-
// -------------------------------------- class fields
-
protected LoggerComponent logger = null;
// -------------------------------------- constructors
-
public L2PathStatusQueryGeneratorTMP() throws PerfSONARException
{
-
try {
-
this.logger = (LoggerComponent)
AuxiliaryComponentManager.
getInstance().
getComponent(ComponentNames.LOGGER);
-
} catch (PerfSONARException e) {
-
throw new PerfSONARException(
"error.common.no_logger",
"L2PathStatusQueryGeneratorTMP.constructor: "
+ "Cannot get logger component");
-
}
-
}
@@ -340,7 +330,7 @@
+ " where
fn:data($k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef) = $node1_id
\n"
+ " and
fn:data($k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef) = $node2_id
\n"
+ " and (
\n"
- + "
$k/nmwg:eventType[functx:trim(text())='Path.Status']
\n"
+ + "
$k/nmwg:eventType[functx:trim(text())='Path.Status']
\n"
+ " or
\n"
+ "
$k/nmwg:parameters/nmwg:parameter[(functx:trim(text())='Path.Status' and
functx:trim(@name)='supportedEventType') \n"
+ " or
(functx:trim(@value)='Path.Status' and
functx:trim(@name)='supportedEventType')] \n"
@@ -426,7 +416,7 @@
+ " for $k in //nmwg:metadata
\n"
+ " where
fn:data($k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef) = $node_id
\n"
+ " and (
\n"
- + "
$k/nmwg:eventType[functx:trim(text())='Path.Status']
\n"
+ + "
$k/nmwg:eventType[functx:trim(text())='Path.Status']
\n"
+ " or
\n"
+ "
$k/nmwg:parameters/nmwg:parameter[(functx:trim(text())='Path.Status' and
functx:trim(@name)='supportedEventType') \n"
+ " or
(functx:trim(@value)='Path.Status' and
functx:trim(@name)='supportedEventType')] \n"
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -16,14 +16,10 @@
*/
public interface MetadataQueryGenerator
{
-
-
/**
* Returns xpath query created using the information
* stored in Message object.
*/
- public String getMetadataQuery(Message query)
+ String getMetadataQuery(Message query)
throws PerfSONARException;
-
-
} //MetadataQueryGenerator
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/MetadataQueryGeneratorFactory.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -20,10 +20,12 @@
*
* @author romradz
*/
-public class MetadataQueryGeneratorFactory
+public final class MetadataQueryGeneratorFactory
{
+ private MetadataQueryGeneratorFactory()
+ {
+ }
-
/**
* Returns an object which can create a metadata query
* in order to fetch relevant metadata configuration.
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/OwampQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,16 +17,13 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with owamp data)
+ * (query to fetch metadata with owamp data).
*
* @author fernandes
* @autor <a
;>Piotr
Pikusa</a>
*/
-
public class OwampQueryGenerator implements MetadataQueryGenerator
{
-
-
// -------------------------------------- class fields
@@ -112,8 +109,8 @@
for (String parameter : parameters) {
if (params.getParameterByName(parameter) != null) {
parametersMap.put(parameter,
-
(params.getParameterByName(parameter).getParameterValue() != null ?
-
params.getParameterByName(parameter).getParameterValue().trim() : ""));
+
(params.getParameterByName(parameter).getParameterValue() != null
+ ?
params.getParameterByName(parameter).getParameterValue().trim() : ""));
}
}
}
@@ -132,9 +129,9 @@
+ "declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; \n\n";
xQuery +=
- " let $res :=
\n"
- + " for $i in //nmwg:metadata \n"
- + " where 1
\n";
+ " let $res := \n"
+ + " for $i in //nmwg:metadata \n"
+ + " where 1 \n";
if (!eventType.isEmpty()) {
@@ -159,27 +156,22 @@
}
xQuery += "\n"
- + " return $i
\n"
- + "
\n"
- + " let $metaids :=
\n"
- + " for $j in $res
\n"
- + " return fn:data($j/@id)
\n"
- + "
\n"
- + " let $datas :=
\n"
- + " for $k in $metaids
\n"
- + " let $d :=
\n"
- + " for $l in //nmwg:data \n"
- + " where $l/@metadataIdRef = $k \n"
- + " return $l
\n"
- + " return $d
\n"
- + "
\n"
- + " return ($res, $datas)
\n";
+ + " return $i \n"
+ + " \n"
+ + " let $metaids := \n"
+ + " for $j in $res \n"
+ + " return fn:data($j/@id) \n"
+ + " \n"
+ + " let $datas := \n"
+ + " for $k in $metaids \n"
+ + " let $d := \n"
+ + " for $l in //nmwg:data \n"
+ + " where $l/@metadataIdRef = $k \n"
+ + " return $l \n"
+ + " return $d \n"
+ + " \n"
+ + " return ($res, $datas) \n";
-
return xQuery;
-
-
}
-
-
} //OwampQueryGenerator
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/PingQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/PingQueryGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/PingQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -17,7 +17,7 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with owamp data)
+ * (query to fetch metadata with owamp data).
*
* @author fernandes
*/
@@ -109,10 +109,11 @@
if (params != null) {
for (String parameter : parameters) {
- if (params.getParameterByName(parameter) != null)
+ if (params.getParameterByName(parameter) != null) {
parametersMap.put(parameter,
-
(params.getParameterByName(parameter).getParameterValue() != null ?
-
params.getParameterByName(parameter).getParameterValue().trim() : ""));
+
(params.getParameterByName(parameter).getParameterValue() != null
+ ?
params.getParameterByName(parameter).getParameterValue().trim() : ""));
+ }
}
}
@@ -129,9 +130,9 @@
+ "declare namespace
nmwgt='http://ggf.org/ns/nmwg/topology/2.0/'; \n\n";
xQuery +=
- " let $res :=
\n"
- + " for $i in //nmwg:metadata \n"
- + " where 1
\n";
+ " let $res := \n"
+ + " for $i in //nmwg:metadata \n"
+ + " where 1 \n";
if (!eventType.isEmpty()) {
@@ -156,27 +157,22 @@
}
xQuery += "\n"
- + " return $i
\n"
- + "
\n"
- + " let $metaids :=
\n"
- + " for $j in $res
\n"
- + " return fn:data($j/@id)
\n"
- + "
\n"
- + " let $datas :=
\n"
- + " for $k in $metaids
\n"
- + " let $d :=
\n"
- + " for $l in //nmwg:data \n"
- + " where $l/@metadataIdRef = $k \n"
- + " return $l
\n"
- + " return $d
\n"
- + "
\n"
- + " return ($res, $datas)
\n";
+ + " return $i \n"
+ + " \n"
+ + " let $metaids := \n"
+ + " for $j in $res \n"
+ + " return fn:data($j/@id) \n"
+ + " \n"
+ + " let $datas := \n"
+ + " for $k in $metaids \n"
+ + " let $d := \n"
+ + " for $l in //nmwg:data \n"
+ + " where $l/@metadataIdRef = $k \n"
+ + " return $l \n"
+ + " return $d \n"
+ + " \n"
+ + " return ($res, $datas) \n";
-
return xQuery;
-
-
}
-
-
} //PingQueryGenerator
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/RandomFetchTestQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/RandomFetchTestQueryGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/RandomFetchTestQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -14,7 +14,7 @@
/**
- * Transforms nmwg message into xquery/xpath
+ * Transforms nmwg message into xquery/xpath.
*
* @author romradz
*/
@@ -68,4 +68,4 @@
}
-} //RandomFetchTestQueryGenerator
\ No newline at end of file
+} //RandomFetchTestQueryGenerator
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -18,7 +18,7 @@
/**
* Transforms nmwg message into xquery/xpath
- * (query to fetch metadata with utilization metric)
+ * (query to fetch metadata with utilization metric).
*
* @author romradz
*/
@@ -161,17 +161,17 @@
+ "}; \n\n";
- if (ipAddress == null &&
- hostName == null &&
- ifName == null &&
- ifDescription == null &&
- ifAddress == null &&
- ifIndex == null &&
- type == null &&
- direction == null &&
- classOfService == null &&
- capacity == null &&
- keywordParameter == null) {
+ if (ipAddress == null
+ && hostName == null
+ && ifName == null
+ && ifDescription == null
+ && ifAddress == null
+ && ifIndex == null
+ && type == null
+ && direction == null
+ && classOfService == null
+ && capacity == null
+ && keywordParameter == null) {
// getting all metadata
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/XmlDbAccessTestQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/XmlDbAccessTestQueryGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/XmlDbAccessTestQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -14,7 +14,7 @@
/**
- * Transforms nmwg message into xquery/xpath
+ * Transforms nmwg message into xquery/xpath.
*
* @author romradz
*/
@@ -75,4 +75,4 @@
}
-} //XmlDbAccessTestQueryGenerator
\ No newline at end of file
+} //XmlDbAccessTestQueryGenerator
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/XmlDbContentTestQueryGenerator.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/XmlDbContentTestQueryGenerator.java
2012-10-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/XmlDbContentTestQueryGenerator.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -14,7 +14,7 @@
/**
- * Transforms nmwg message into xquery/xpath
+ * Transforms nmwg message into xquery/xpath.
*
* @author romradz
*/
@@ -77,4 +77,4 @@
}
-} //XmlDbContentTestQueryGenerator
\ No newline at end of file
+} //XmlDbContentTestQueryGenerator
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-08 12:49:17 UTC (rev 6024)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
2012-10-08 12:49:20 UTC (rev 6025)
@@ -22,7 +22,7 @@
import java.util.regex.PatternSyntaxException;
/**
- * Action for simple Scheduler that registers with the LS
+ * Action for simple Scheduler that registers with the LS.
*
* @author Maciej Glowiak (main author)
* @author romradz (contributor)
@@ -46,8 +46,8 @@
private ConfigurationComponent configuration = null;
private Scheduler scheduler = null;
- String lsURL = null;
- String[] lsURLArray = null;
+ private String lsURL = null;
+ private String[] lsURLArray = null;
// ---------------------------------- constructors
@@ -80,7 +80,7 @@
// ---------------------------------- public methods
/**
- * Scheduler action
+ * Scheduler action.
*/
@Override
public void runAction()
@@ -167,8 +167,9 @@
try {
lsURL = configuration.getProperty("service.r.ls_url");
if (lsURL != null) {
- if (!lsURL.trim().isEmpty())
+ if (!lsURL.trim().isEmpty()) {
lsURLArray = lsURL.split(",");
+ }
}
} catch (PatternSyntaxException ex) {
throw new PerfSONARException(
@@ -200,7 +201,8 @@
try {
String schedulerVal = configuration.getProperty("component." +
componentName + ".scheduler_component");
- logger.debug("LSRegistrationComponent.initComponent:
LSCleanupLoader: parameter SCHEDULER = " + schedulerVal);
+ logger.debug("LSRegistrationComponent.initComponent:
LSCleanupLoader: parameter SCHEDULER = "
+ + schedulerVal);
scheduler = (Scheduler)
AuxiliaryComponentManager.getInstance().getComponent(schedulerVal);
@@ -244,4 +246,4 @@
}
-} // LSRegistrationComponent
\ No newline at end of file
+} // LSRegistrationComponent
- [pS-dev] [GEANT/SA2/ps-java-services] r6025 - in trunk: perfsonar-java-sql-ma/src/checkstyle perfsonar _base perfsonar_base/src perfsonar_base/src/checksty le perfsonar_base/src/main/java/org/perfsonar/base/auxil iary perfsonar_base/src/main/java/org/perfsonar/base/aux iliary/components/authn perfsonar_base/src/main/java/org /perfsonar/base/auxiliary/components/authn/wssec perfsonar _base/src/main/java/org/perfsonar/base/auxiliary/compone nts/configuration perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/configuration/properties pe rfsonar_base/src/main/java/org/perfsonar/base/auxiliary/ components/logger perfsonar_base/src/main/java/org/perfs onar/base/auxiliary/components/logger/log4j perfsonar_ba se/src/main/java/org/perfsonar/base/auxiliary/components/m apping perfsonar_base/src/main/java/org/perfsonar/base/a uxiliary/components/scheduler perfsonar_base/src/main/ja va/org/perfsonar/base/auxiliary/components/scheduler/actio ns perfsonar_base/src/main/java/org/perfsona r/base/auxi liary/components/simplescheduler perfsonar_base/src/main /java/org/perfsonar/base/exceptions perfsonar_base/src/m ain/java/org/perfsonar/base/nmwg/owamp perfsonar_base/sr c/main/java/org/perfsonar/base/util perfsonar_base/src/m ain/java/org/perfsonar/base/util/iptrie perfsonar_base/s rc/main/java/org/perfsonar/client/axis perfsonar_base/sr c/main/java/org/perfsonar/client/base/authn perfsonar_ba se/src/main/java/org/perfsonar/client/base/authn/edugain p erfsonar_base/src/main/java/org/perfsonar/client/base/au thn/saslca perfsonar_base/src/main/java/org/perfsonar/cl ient/base/requests perfsonar_base/src/main/java/org/perf sonar/client/base/requests/authService perfsonar_base/sr c/main/java/org/perfsonar/client/base/requests/lookupServi ce perfsonar_base/src/main/java/org/perfsonar/client/bas e/xquery perfsonar_base/src/main/java/org/perfsonar/clie nt/base/xquery/lookupService perfsonar_base/src/main/jav a/org/perfsonar/client/testHarness perfsonar_base/src/ma in/java/org/perfsonar/ service/base/authn perfsonar_base /src/main/java/org/perfsonar/service/base/authn/tokens per fsonar_base/src/main/java/org/perfsonar/service/base/con tainer/listeners perfsonar_base/src/main/java/org/perfso nar/service/base/engine perfsonar_base/src/main/java/org /perfsonar/service/base/measurementExecutor perfsonar_ba se/src/main/java/org/perfsonar/service/base/messages perfs onar_base/src/main/java/org/perfsonar/service/base/regis tration perfsonar_base/src/main/java/org/perfsonar/servi ce/base/storage perfsonar_base/src/main/java/org/perfson ar/service/base/storage/xmldb perfsonar_base/src/main/ja va/org/perfsonar/service/base/storage/xmldb/exist perfsona r_base/src/main/java/org/perfsonar/service/base/storage/ xmldb/exist/rest perfsonar_base/src/main/java/org/perfso nar/service/base/storage/xmldb/exist/xmlrpc perfsonar_ba se/src/main/java/org/perfsonar/service/base/storage/xmlfil e perfsonar_base/src/main/java/org/perfsonar/service/bas e/transport perfsonar_base/src/main/java/org/perfson ar/ service/base/util perfsonar_base/src/main/java/org/perfs onar/service/base/web perfsonar_base/src/main/java/org/p erfsonar/service/measurementArchive/eventTypeConfig perfso nar_base/src/main/java/org/perfsonar/service/measurement Archive/metadataConfig perfsonar_base/src/main/java/org/ perfsonar/service/measurementArchive/metadataConfig/keyGen erator perfsonar_base/src/main/java/org/perfsonar/servic e/measurementArchive/metadataConfig/queryGenerator perfson ar_base/src/main/java/org/perfsonar/service/measurementA rchive/register, svn-noreply, 10/08/2012
Archive powered by MHonArc 2.6.16.