You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:31:31 UTC
[89/90] [abbrv] git commit: AIRAVATA-1124
AIRAVATA-1124
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9c47eec8
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9c47eec8
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9c47eec8
Branch: refs/heads/master
Commit: 9c47eec85f9bf56d311f14677cbeaa20b8474c70
Parents: 0e2c10f
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Sun Apr 13 22:33:09 2014 -0700
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Sun Apr 13 22:33:09 2014 -0700
----------------------------------------------------------------------
modules/security/pom.xml | 55 +
.../security/AbstractAuthenticator.java | 150 ++
.../security/AbstractDatabaseAuthenticator.java | 129 ++
.../security/AuthenticationException.java | 41 +
.../apache/airavata/security/Authenticator.java | 108 ++
.../apache/airavata/security/Authoriser.java | 43 +
.../org/apache/airavata/security/UserStore.java | 71 +
.../airavata/security/UserStoreException.java | 46 +
.../AbstractConfigurationReader.java | 55 +
.../AuthenticatorConfigurationReader.java | 244 +++
.../userstore/AbstractJDBCUserStore.java | 134 ++
.../security/userstore/JDBCUserStore.java | 166 ++
.../security/userstore/LDAPUserStore.java | 147 ++
.../security/userstore/SessionDBUserStore.java | 132 ++
.../security/util/PasswordDigester.java | 111 ++
.../AuthenticatorConfigurationReaderTest.java | 119 ++
.../configurations/TestDBAuthenticator1.java | 57 +
.../configurations/TestDBAuthenticator2.java | 58 +
.../configurations/TestDBAuthenticator3.java | 57 +
.../security/configurations/TestUserStore.java | 47 +
.../security/userstore/JDBCUserStoreTest.java | 106 ++
.../security/userstore/LDAPUserStoreTest.java | 69 +
.../userstore/SessionDBUserStoreTest.java | 101 ++
.../src/test/resources/authenticators.xml | 88 +
.../test/resources/disabled-authenticator.xml | 84 +
.../src/test/resources/jdbc-authenticator.xml | 39 +
.../src/test/resources/ldap-authenticator.xml | 41 +
.../test/resources/session-authenticator.xml | 45 +
.../ws-messenger/messagebox/maven-eclipse.xml | 16 +
modules/ws-messenger/messagebox/pom.xml | 100 ++
.../wsmg/msgbox/MsgBoxServiceLifeCycle.java | 192 +++
.../MsgBoxServiceMessageReceiverInOut.java | 138 ++
.../wsmg/msgbox/MsgBoxServiceSkeleton.java | 186 +++
.../wsmg/msgbox/Storage/MsgBoxStorage.java | 59 +
.../Storage/dbpool/DatabaseStorageImpl.java | 125 ++
.../msgbox/Storage/dbpool/MessageBoxDB.java | 265 +++
.../msgbox/Storage/memory/InMemoryImpl.java | 133 ++
.../wsmg/msgbox/StoreMessageHandler.java | 123 ++
.../airavata/wsmg/msgbox/util/ConfigKeys.java | 36 +
.../wsmg/msgbox/util/MsgBoxCommonConstants.java | 26 +
.../wsmg/msgbox/util/MsgBoxOperations.java | 53 +
.../airavata/wsmg/msgbox/util/MsgBoxUtils.java | 71 +
.../resources/database_scripts/msgBox-derby.sql | 41 +
.../resources/database_scripts/msgBox-mysql.sql | 42 +
.../messagebox/src/main/resources/services.xml | 57 +
.../wsmg/msgbox/InMemoryMessageBoxServer.java | 157 ++
.../wsmg/msgbox/MessageBoxStressTest.java | 129 ++
.../apache/airavata/wsmg/msgbox/MsgBoxTest.java | 103 ++
modules/ws-messenger/messagebroker/pom.xml | 117 ++
.../wsmg/broker/AbstractBrokerMsgReceiver.java | 105 ++
.../wsmg/broker/AdditionalMessageContent.java | 131 ++
.../wsmg/broker/BrokerServiceLifeCycle.java | 328 ++++
.../airavata/wsmg/broker/ConsumerInfo.java | 123 ++
.../airavata/wsmg/broker/ConsumerList.java | 73 +
.../wsmg/broker/ConsumerListManager.java | 79 +
.../wsmg/broker/NotificationProcessor.java | 313 ++++
.../broker/amqp/AMQPNotificationProcessor.java | 132 ++
.../broker/context/ContextParameterInfo.java | 58 +
.../wsmg/broker/context/ContextParameters.java | 72 +
.../wsmg/broker/context/ProcessingContext.java | 114 ++
.../context/ProcessingContextBuilder.java | 30 +
.../broker/handler/PublishedMessageHandler.java | 120 ++
.../wsmg/broker/subscription/CleanupThread.java | 148 ++
.../broker/subscription/SubscriptionEntry.java | 49 +
.../subscription/SubscriptionManager.java | 440 +++++
.../broker/subscription/SubscriptionState.java | 301 ++++
.../wseventing/WSEProcessingContextBuilder.java | 186 +++
.../broker/wseventing/WSEProtocolSupport.java | 204 +++
.../wseventing/WSEventingMsgReceiver.java | 77 +
.../WSEventingPublishMsgReceiver.java | 74 +
.../wsnotification/WSNTProtocolSupport.java | 237 +++
.../WSNotificationMsgReceiver.java | 110 ++
.../WSNotificationProcessingContextBuilder.java | 179 +++
.../airavata/wsmg/commons/OutGoingMessage.java | 125 ++
.../commons/storage/WsmgInMemoryStorage.java | 106 ++
.../commons/storage/WsmgPersistantStorage.java | 773 +++++++++
.../wsmg/commons/storage/WsmgQueue.java | 34 +
.../wsmg/commons/storage/WsmgStorage.java | 39 +
.../wsmg/commons/util/OMElementComparator.java | 177 ++
.../airavata/wsmg/config/WSMGParameter.java | 48 +
.../wsmg/config/WsmgConfigurationContext.java | 118 ++
.../wsmg/matching/AbstractMessageMatcher.java | 89 ++
.../wsmg/matching/XPath/YFilterInfo.java | 156 ++
.../matching/XPath/YFilterMessageMatcher.java | 183 +++
.../simpleTopic/DirectWsntMessageMatcher.java | 125 ++
.../wsmg/messenger/ConsumerUrlManager.java | 195 +++
.../airavata/wsmg/messenger/Deliverable.java | 32 +
.../wsmg/messenger/DeliveryProcessor.java | 90 ++
.../airavata/wsmg/messenger/OutGoingQueue.java | 65 +
.../airavata/wsmg/messenger/SenderUtils.java | 161 ++
.../messenger/protocol/DeliveryProtocol.java | 34 +
.../messenger/protocol/SendingException.java | 37 +
.../messenger/protocol/impl/Axis2Protocol.java | 156 ++
.../messenger/strategy/SendingStrategy.java | 33 +
.../strategy/impl/ConsumerHandler.java | 71 +
.../strategy/impl/FixedParallelSender.java | 185 +++
.../messenger/strategy/impl/LightweightMsg.java | 54 +
.../messenger/strategy/impl/ParallelSender.java | 155 ++
.../messenger/strategy/impl/SerialSender.java | 75 +
.../apache/airavata/wsmg/util/BrokerUtil.java | 121 ++
.../org/apache/airavata/wsmg/util/Counter.java | 77 +
.../airavata/wsmg/util/RunTimeStatistics.java | 157 ++
.../apache/airavata/wsmg/util/TimerThread.java | 87 +
.../wsmg/util/WsEventingOperations.java | 55 +
.../wsmg/util/WsNotificationOperations.java | 56 +
.../database_scripts/cleanDBScript.sql | 27 +
.../database_scripts/msgBroker-derby.sql | 60 +
.../database_scripts/msgBroker-mysql.sql | 61 +
.../src/main/resources/services.xml | 125 ++
.../airavata/wsmg/broker/BrokerWSETest.java | 107 ++
.../airavata/wsmg/broker/BrokerWSNTTest.java | 108 ++
.../wsmg/commons/TestCommonRoutines.java | 57 +
.../TestAddtionalWseXpathAndTopicScenarios.java | 151 ++
.../XPath/TestWseXpathAndTopicSubscription.java | 137 ++
.../XPath/TestWseXpathSubscription.java | 139 ++
.../matching/XPath/performance/XppXPath.java | 269 ++++
.../rtt/NotificationManager.java | 151 ++
.../rtt/PerformanceTest.java | 399 +++++
.../rtt/PublisherThread.java | 99 ++
.../rtt/StatCalculatorThread.java | 103 ++
.../rtt/StatContainer.java | 49 +
.../performance_evaluator/rtt/Subscription.java | 107 ++
.../rtt/util/ConfigKeys.java | 43 +
.../rtt/util/LoadMsgPayload.java | 66 +
.../rtt/util/LoadXpath.java | 66 +
.../airavata/wsmg/util/BrokerUtilTest.java | 167 ++
.../apache/airavata/wsmg/util/ConfigKeys.java | 34 +
.../airavata/wsmg/util/TestUtilServer.java | 225 +++
.../src/test/resources/unit_tests.properties | 24 +
modules/xbaya-gui/pom.xml | 322 ++++
.../java/org/apache/airavata/xbaya/XBaya.java | 315 ++++
.../airavata/xbaya/XBayaConfiguration.java | 974 +++++++++++
.../apache/airavata/xbaya/XBayaConstants.java | 205 +++
.../org/apache/airavata/xbaya/XBayaEngine.java | 302 ++++
.../org/apache/airavata/xbaya/XBayaVersion.java | 42 +
.../component/registry/ComponentController.java | 50 +
.../registry/ComponentRegistryLoader.java | 195 +++
.../xbaya/concurrent/PredicatedExecutable.java | 33 +
.../xbaya/concurrent/PredicatedTaskRunner.java | 153 ++
.../xbaya/core/amazon/AmazonCredential.java | 79 +
.../xbaya/core/amazon/EC2InstanceResult.java | 94 ++
.../xbaya/core/generators/BPELFiler.java | 145 ++
.../xbaya/core/generators/ImageFiler.java | 106 ++
.../xbaya/core/generators/JythonFiler.java | 128 ++
.../xbaya/core/generators/ODEScriptFiler.java | 165 ++
.../xbaya/core/generators/ScuflFiler.java | 127 ++
.../xbaya/core/generators/WorkflowFiler.java | 267 ++++
.../xbaya/core/generators/XmlBeansFiler.java | 71 +
.../core/ide/XBayaExecutionModeListener.java | 34 +
.../xbaya/core/workflow/ParameterListModel.java | 88 +
.../xbaya/datadriven/WorkflowHarvester.java | 191 +++
.../airavata/xbaya/file/XBayaPathConstants.java | 64 +
.../airavata/xbaya/gfac/GFacRegistryClient.java | 169 ++
.../airavata/xbaya/gfac/SimpleWSClient.java | 134 ++
.../xbaya/globus/FileTransferConstants.java | 38 +
.../xbaya/globus/GridFTPFileTransferClient.java | 238 +++
.../xbaya/graph/controller/NodeController.java | 199 +++
.../xbaya/interpretor/DoWhileHandler.java | 251 +++
.../xbaya/interpretor/ExperimentTemplate.java | 37 +
.../GUIWorkflowInterpreterInteractorImpl.java | 211 +++
.../xbaya/interpretor/HeaderConstants.java | 33 +
.../SSWorkflowInterpreterInteractorImpl.java | 118 ++
.../StandaloneNotificationSender.java | 135 ++
.../interpretor/SystemComponentInvoker.java | 114 ++
.../WorkFlowInterpreterException.java | 37 +
.../interpretor/WorkflowExecutionMessage.java | 40 +
.../interpretor/WorkflowExecutionTemplate.java | 51 +
.../xbaya/interpretor/WorkflowInterpreter.java | 1508 ++++++++++++++++++
.../WorkflowInterpreterConfiguration.java | 233 +++
.../WorkflowInterpreterInteractor.java | 94 ++
.../interpretor/WorkflowInterpreterInvoker.java | 66 +
.../WorkflowInterpretorEventListener.java | 387 +++++
...WorkflowInterpretorMessageReceiverInOut.java | 262 +++
.../WorkflowInterpretorSkeleton.java | 572 +++++++
.../xbaya/invoker/AsynchronousInvoker.java | 118 ++
.../airavata/xbaya/invoker/DynamicInvoker.java | 167 ++
.../xbaya/invoker/DynamicServiceCreator.java | 86 +
.../xbaya/invoker/EmbeddedGFacInvoker.java | 686 ++++++++
.../airavata/xbaya/invoker/GFacInvoker.java | 199 +++
.../airavata/xbaya/invoker/GenericInvoker.java | 529 ++++++
.../apache/airavata/xbaya/invoker/Invoker.java | 105 ++
.../invoker/MsgBoxWsaResponsesCorrelator.java | 140 ++
.../airavata/xbaya/invoker/SimpleInvoker.java | 260 +++
.../xbaya/invoker/WorkflowInputUtil.java | 84 +
.../WorkflowInvokerWrapperForGFacInvoker.java | 233 +++
.../xbaya/invoker/factory/InvokerFactory.java | 90 ++
.../xbaya/jython/lib/GFacServiceCreator.java | 168 ++
.../xbaya/jython/lib/NotificationSender.java | 289 ++++
.../xbaya/jython/lib/ServiceNotifiable.java | 82 +
.../jython/lib/ServiceNotificationSender.java | 293 ++++
.../StandaloneServiceNotificationSender.java | 95 ++
.../xbaya/jython/lib/WorkflowNotifiable.java | 92 ++
.../xbaya/jython/runner/JythonClassLoader.java | 423 +++++
.../jython/runner/JythonOneTimeRunner.java | 35 +
.../jython/runner/JythonOneTimeRunnerImpl.java | 85 +
.../xbaya/jython/runner/JythonRunner.java | 73 +
.../xbaya/jython/script/JythonScript.java | 671 ++++++++
.../apache/airavata/xbaya/lead/LEADTypes.java | 225 +++
.../xbaya/lead/LeadContextHeaderHelper.java | 155 ++
.../xbaya/lead/NotificationHandler.java | 190 +++
.../xbaya/menues/tools/ToolsMenuItem.java | 100 ++
.../registrybrowser/AiravataConfigurations.java | 54 +
.../ApplicationDeploymentDescriptionWrap.java | 98 ++
.../ApplicationDeploymentDescriptions.java | 107 ++
.../registrybrowser/EventingServiceURL.java | 54 +
.../registrybrowser/EventingServiceURLs.java | 54 +
.../xbaya/model/registrybrowser/GFacURL.java | 54 +
.../xbaya/model/registrybrowser/GFacURLs.java | 56 +
.../model/registrybrowser/HostDescriptions.java | 50 +
.../model/registrybrowser/InputParameters.java | 36 +
.../registrybrowser/InterpreterServiceURL.java | 54 +
.../registrybrowser/InterpreterServiceURLs.java | 56 +
.../model/registrybrowser/MessageBoxURL.java | 54 +
.../model/registrybrowser/MessageBoxURLs.java | 54 +
.../model/registrybrowser/NodeParameter.java | 60 +
.../model/registrybrowser/OutputParameters.java | 36 +
.../registrybrowser/ServiceDescriptions.java | 50 +
.../registrybrowser/ServiceParameters.java | 57 +
.../model/registrybrowser/XBayaWorkflow.java | 94 ++
.../XBayaWorkflowExperiment.java | 81 +
.../XBayaWorkflowExperiments.java | 65 +
.../XBayaWorkflowNodeElement.java | 107 ++
.../registrybrowser/XBayaWorkflowTemplate.java | 50 +
.../registrybrowser/XBayaWorkflowTemplates.java | 63 +
.../xbaya/modifier/WorkflowModifier.java | 260 +++
.../xbaya/provenance/ProvenanceReader.java | 64 +
.../xbaya/provenance/ProvenanceWrite.java | 217 +++
.../provenance/WorkflowNodeStatusUpdater.java | 135 ++
.../xbaya/provenance/WorkflowStatusUpdater.java | 103 ++
.../xbaya/registry/PasswordCallbackImpl.java | 39 +
.../xbaya/registry/RegistryAccesser.java | 212 +++
.../nodes/AbstractAiravataTreeNode.java | 255 +++
.../nodes/AiravataConfigurationsNode.java | 94 ++
.../nodes/AiravataTreeNodeFactory.java | 112 ++
.../ApplicationDeploymentDescriptionNode.java | 131 ++
.../ApplicationDeploymentDescriptionsNode.java | 139 ++
.../nodes/EventingServiceURLNode.java | 98 ++
.../nodes/EventingServiceURLsNode.java | 91 ++
.../registrybrowser/nodes/GFacURLNode.java | 98 ++
.../registrybrowser/nodes/GFacURLsNode.java | 91 ++
.../nodes/HostDescriptionNode.java | 127 ++
.../nodes/HostDescriptionsNode.java | 131 ++
.../nodes/InputParametersNode.java | 46 +
.../nodes/InterpreterServiceURLNode.java | 98 ++
.../nodes/InterpreterServiceURLsNode.java | 90 ++
.../registrybrowser/nodes/JCRBrowserIcons.java | 50 +
.../nodes/MessageBoxURLNode.java | 98 ++
.../nodes/MessageBoxURLsNode.java | 90 ++
.../nodes/OutputParametersNode.java | 46 +
.../registrybrowser/nodes/ParameterNode.java | 136 ++
.../nodes/ParameterValueNode.java | 90 ++
.../registrybrowser/nodes/ParametersNode.java | 90 ++
.../registrybrowser/nodes/RegistryNode.java | 130 ++
.../nodes/RegistryTreeCellRenderer.java | 43 +
.../nodes/ServiceDescriptionNode.java | 142 ++
.../nodes/ServiceDescriptionsNode.java | 137 ++
.../nodes/XBayaWorkflowExperimentNode.java | 141 ++
.../nodes/XBayaWorkflowExperimentsNode.java | 89 ++
.../nodes/XBayaWorkflowNode.java | 107 ++
.../nodes/XBayaWorkflowNodeElementNode.java | 101 ++
.../nodes/XBayaWorkflowTemplateNode.java | 130 ++
.../nodes/XBayaWorkflowTemplatesNode.java | 99 ++
.../xbaya/scufl/script/ScuflScript.java | 539 +++++++
.../airavata/xbaya/test/BPELScriptTestCase.java | 209 +++
.../airavata/xbaya/test/BrowserTestCase.java | 38 +
.../apache/airavata/xbaya/test/DSCTestCase.java | 131 ++
.../airavata/xbaya/test/DSCUtilTestCase.java | 79 +
.../xbaya/test/GFacServiceCreaterTestCase.java | 120 ++
.../airavata/xbaya/test/GraphTestCase.java | 54 +
.../airavata/xbaya/test/MetadataTestCase.java | 221 +++
.../airavata/xbaya/test/MonitorTestCase.java | 67 +
.../xbaya/test/ResourceNotifierTestCase.java | 59 +
.../airavata/xbaya/test/StringUtilTestCase.java | 55 +
.../airavata/xbaya/test/WSDLTestCase.java | 92 ++
.../airavata/xbaya/test/WSDLUtilTestCase.java | 51 +
.../airavata/xbaya/test/WSIFTestCase.java | 53 +
.../airavata/xbaya/test/WaitDialogTestCase.java | 282 ++++
.../WebComponentRegistryClientTestCase.java | 173 ++
.../test/WorkflowModificationTestCase.java | 373 +++++
.../airavata/xbaya/test/WorkflowTestCase.java | 120 ++
.../xbaya/test/XBayaSecurityTestCase.java | 68 +
.../airavata/xbaya/test/XBayaTestCase.java | 77 +
.../apache/airavata/xbaya/test/XppTestCase.java | 71 +
.../test/jython/JythonClassLoaderTestCase.java | 44 +
.../xbaya/test/jython/JythonLibraryTest.java | 115 ++
.../jython/JythonOneTimeRunnerTestCase.java | 70 +
.../xbaya/test/jython/JythonRunnerTestCase.java | 74 +
.../xbaya/test/jython/JythonScriptTestCase.java | 131 ++
.../xbaya/test/service/AllServices.java | 115 ++
.../airavata/xbaya/test/service/Service.java | 44 +
.../test/service/ServiceNotificationSender.java | 161 ++
.../xbaya/test/service/adder/Adder.java | 54 +
.../xbaya/test/service/adder/AdderClient.java | 114 ++
.../xbaya/test/service/adder/AdderImpl.java | 79 +
.../xbaya/test/service/adder/AdderService.java | 131 ++
.../xbaya/test/service/approver/Approver.java | 54 +
.../test/service/approver/ApproverClient.java | 113 ++
.../test/service/approver/ApproverImpl.java | 74 +
.../test/service/approver/ApproverService.java | 131 ++
.../test/service/arrayadder/ArrayAdder.java | 54 +
.../service/arrayadder/ArrayAdderClient.java | 121 ++
.../test/service/arrayadder/ArrayAdderImpl.java | 83 +
.../service/arrayadder/ArrayAdderService.java | 131 ++
.../test/service/arraygen/ArrayGenerator.java | 54 +
.../service/arraygen/ArrayGeneratorClient.java | 113 ++
.../service/arraygen/ArrayGeneratorImpl.java | 77 +
.../service/arraygen/ArrayGeneratorService.java | 131 ++
.../airavata/xbaya/test/service/echo/Echo.java | 54 +
.../xbaya/test/service/echo/EchoClient.java | 116 ++
.../xbaya/test/service/echo/EchoImpl.java | 73 +
.../xbaya/test/service/echo/EchoService.java | 113 ++
.../test/service/multiplier/Multiplier.java | 54 +
.../test/service/multiplier/MultiplierImpl.java | 80 +
.../service/multiplier/MultiplierService.java | 132 ++
.../xbaya/test/util/WorkflowCreator.java | 741 +++++++++
.../org/apache/airavata/xbaya/ui/XBayaGUI.java | 850 ++++++++++
.../ui/actions/AbstractBrowserActionItem.java | 90 ++
.../ui/actions/registry/browser/AddAction.java | 43 +
.../actions/registry/browser/BrowserAction.java | 39 +
.../ui/actions/registry/browser/CopyAction.java | 39 +
.../actions/registry/browser/DeleteAction.java | 42 +
.../ui/actions/registry/browser/EditAction.java | 39 +
.../actions/registry/browser/ImportAction.java | 39 +
.../actions/registry/browser/RefreshAction.java | 43 +
.../ui/actions/registry/browser/ViewAction.java | 39 +
.../airavata/xbaya/ui/dialogs/AboutWindow.java | 126 ++
.../airavata/xbaya/ui/dialogs/ErrorWindow.java | 279 ++++
.../ui/dialogs/GlobusFileTransferWindow.java | 258 +++
.../airavata/xbaya/ui/dialogs/TextWindow.java | 139 ++
.../airavata/xbaya/ui/dialogs/WaitDialog.java | 140 ++
.../airavata/xbaya/ui/dialogs/XBayaDialog.java | 267 ++++
.../dialogs/amazon/AmazonEC2InvokerWindow.java | 222 +++
.../ui/dialogs/amazon/AmazonS3UtilsWindow.java | 312 ++++
.../xbaya/ui/dialogs/amazon/BucketsLoader.java | 123 ++
.../dialogs/amazon/ChangeCredentialWindow.java | 204 +++
.../amazon/EC2InstancesManagementWindow.java | 183 +++
.../ui/dialogs/amazon/EC2LaunchWindow.java | 181 +++
.../ui/dialogs/amazon/InstancesLoader.java | 105 ++
.../xbaya/ui/dialogs/amazon/S3Downloader.java | 137 ++
.../xbaya/ui/dialogs/amazon/S3Uploader.java | 127 ++
.../ui/dialogs/component/URLRegistryWindow.java | 132 ++
.../ui/dialogs/component/WebResigtryWindow.java | 131 ++
...licationDescriptionAdvancedOptionDialog.java | 358 +++++
.../ApplicationDescriptionDialog.java | 822 ++++++++++
...tionDescriptionHostAdvancedOptionDialog.java | 459 ++++++
.../DeploymentDescriptionDialog.java | 816 ++++++++++
.../descriptors/DescriptorEditorDialog.java | 424 +++++
.../descriptors/DescriptorListDialog.java | 261 +++
.../descriptors/HostDeploymentDialog.java | 617 +++++++
.../descriptors/HostDescriptionDialog.java | 592 +++++++
.../descriptors/ServiceDescriptionDialog.java | 727 +++++++++
.../amazon/InstanceConfigurationDialog.java | 224 +++
.../graph/dynamic/DynamicNodeWindow.java | 472 ++++++
.../dynamic/DynamicWorkflowRunnerWindow.java | 394 +++++
.../system/ConstantConfigurationDialog.java | 213 +++
.../DifferedInputConfigurationDialog.java | 263 +++
.../graph/system/DoWhileConfigrationDialog.java | 189 +++
.../system/EndBlockConfigurationDialog.java | 163 ++
.../system/EndDoWhileConfigurationDialog.java | 172 ++
.../system/EndForEachConfigurationDialog.java | 161 ++
.../graph/system/EndifConfigurationDialog.java | 163 ++
.../system/ForEachConfigurationDialog.java | 161 ++
.../graph/system/IfConfigurationDialog.java | 190 +++
.../graph/system/InputConfigurationDialog.java | 261 +++
.../graph/system/MemoConfigurationDialog.java | 115 ++
.../graph/system/OutputConfigurationDialog.java | 172 ++
.../system/ReceiveConfigurationDialog.java | 161 ++
.../ui/dialogs/graph/system/S3FileChooser.java | 193 +++
.../system/StreamSourceConfigurationDialog.java | 129 ++
.../graph/ws/ServiceInteractionWindow.java | 132 ++
.../xbaya/ui/dialogs/graph/ws/WSNodeWindow.java | 140 ++
.../monitor/MonitorConfigurationWindow.java | 196 +++
.../xbaya/ui/dialogs/monitor/MonitorWindow.java | 178 +++
.../dialogs/registry/NewRegistryUserDialog.java | 305 ++++
.../ui/dialogs/registry/RegistryWindow.java | 313 ++++
.../registry/browser/JCRBrowserDialog.java | 117 ++
.../workflow/ParameterPropertyWindow.java | 170 ++
.../workflow/WorkflowPropertyWindow.java | 216 +++
.../xbaya/ui/experiment/ExperimentMenu.java | 110 ++
.../ui/experiment/RegistryLoaderWindow.java | 239 +++
.../ui/experiment/RegistrySearchResult.java | 131 ++
.../RegistryWorkflowPublisherWindow.java | 144 ++
.../WorkflowInterpreterLaunchWindow.java | 350 ++++
.../apache/airavata/xbaya/ui/graph/EdgeGUI.java | 142 ++
.../airavata/xbaya/ui/graph/GraphCanvas.java | 1375 ++++++++++++++++
.../xbaya/ui/graph/GraphCanvasEvent.java | 99 ++
.../xbaya/ui/graph/GraphCanvasListener.java | 32 +
.../airavata/xbaya/ui/graph/GraphGUI.java | 198 +++
.../airavata/xbaya/ui/graph/GraphPieceGUI.java | 36 +
.../apache/airavata/xbaya/ui/graph/NodeGUI.java | 535 +++++++
.../airavata/xbaya/ui/graph/Paintable.java | 35 +
.../apache/airavata/xbaya/ui/graph/PortGUI.java | 274 ++++
.../xbaya/ui/graph/amazon/InstanceNodeGUI.java | 166 ++
.../graph/amazon/TerminateInstanceNodeGUI.java | 160 ++
.../xbaya/ui/graph/dynamic/DynamicNodeGUI.java | 73 +
.../graph/subworkflow/SubWorkflowNodeGUI.java | 89 ++
.../xbaya/ui/graph/system/BlockNodeGUI.java | 87 +
.../ui/graph/system/ConfigurableNodeGUI.java | 140 ++
.../xbaya/ui/graph/system/ConstantNodeGUI.java | 63 +
.../ui/graph/system/DifferedInputHandler.java | 87 +
.../ui/graph/system/DifferedInputNodeGUI.java | 101 ++
.../xbaya/ui/graph/system/DoWhileNodeGUI.java | 191 +++
.../xbaya/ui/graph/system/EndBlockNodeGUI.java | 176 ++
.../ui/graph/system/EndDoWhileNodeGUI.java | 178 +++
.../ui/graph/system/EndForEachNodeGUI.java | 148 ++
.../xbaya/ui/graph/system/EndifNodeGUI.java | 176 ++
.../xbaya/ui/graph/system/ExitNodeGUI.java | 98 ++
.../xbaya/ui/graph/system/ForEachNodeGUI.java | 155 ++
.../xbaya/ui/graph/system/IfNodeGUI.java | 183 +++
.../xbaya/ui/graph/system/InputNodeGUI.java | 81 +
.../xbaya/ui/graph/system/MemoNodeGUI.java | 107 ++
.../xbaya/ui/graph/system/OutputNodeGUI.java | 91 ++
.../xbaya/ui/graph/system/ReceiveNodeGUI.java | 150 ++
.../xbaya/ui/graph/system/S3InputNodeGUI.java | 81 +
.../ui/graph/system/StreamSourceNodeGUI.java | 73 +
.../airavata/xbaya/ui/graph/ws/WSNodeGUI.java | 156 ++
.../xbaya/ui/graph/ws/WorkflowNodeGUI.java | 74 +
.../xbaya/ui/menues/AmazonEC2MenuItem.java | 160 ++
.../airavata/xbaya/ui/menues/EditMenuItem.java | 169 ++
.../airavata/xbaya/ui/menues/MenuIcons.java | 39 +
.../xbaya/ui/menues/RegistryMenuItem.java | 118 ++
.../airavata/xbaya/ui/menues/RunMenuItem.java | 412 +++++
.../airavata/xbaya/ui/menues/ViewMenuItem.java | 140 ++
.../airavata/xbaya/ui/menues/XBayaMenu.java | 158 ++
.../airavata/xbaya/ui/menues/XBayaMenuItem.java | 610 +++++++
.../xbaya/ui/monitor/MonitorEventHandler.java | 547 +++++++
.../xbaya/ui/monitor/MonitorStarter.java | 125 ++
.../xbaya/ui/monitor/ResourcePaintable.java | 65 +
.../airavata/xbaya/ui/utils/Cancelable.java | 30 +
.../airavata/xbaya/ui/utils/DrawUtils.java | 108 ++
.../airavata/xbaya/ui/utils/ErrorMessages.java | 240 +++
.../xbaya/ui/views/ComponentViewer.java | 139 ++
.../xbaya/ui/views/JCRBrowserPanel.java | 287 ++++
.../airavata/xbaya/ui/views/MonitorPanel.java | 307 ++++
.../xbaya/ui/views/ParameterPropertyPanel.java | 194 +++
.../airavata/xbaya/ui/views/PortViewer.java | 167 ++
.../airavata/xbaya/ui/widgets/GridPanel.java | 165 ++
.../airavata/xbaya/ui/widgets/ScrollPanel.java | 124 ++
.../xbaya/ui/widgets/TabLabelButton.java | 142 ++
.../xbaya/ui/widgets/TableRenderable.java | 31 +
.../xbaya/ui/widgets/ToolbarButton.java | 109 ++
.../xbaya/ui/widgets/XBayaComboBox.java | 100 ++
.../xbaya/ui/widgets/XBayaComponent.java | 35 +
.../airavata/xbaya/ui/widgets/XBayaLabel.java | 95 ++
.../xbaya/ui/widgets/XBayaLinkButton.java | 306 ++++
.../airavata/xbaya/ui/widgets/XBayaList.java | 169 ++
.../xbaya/ui/widgets/XBayaTextArea.java | 120 ++
.../xbaya/ui/widgets/XBayaTextComponent.java | 37 +
.../xbaya/ui/widgets/XBayaTextField.java | 124 ++
.../airavata/xbaya/ui/widgets/XBayaToolBar.java | 362 +++++
.../xbaya/ui/widgets/XbayaEnhancedList.java | 308 ++++
.../xbaya/ui/widgets/amazon/S3Tree.java | 133 ++
.../xbaya/ui/widgets/amazon/S3TreeModel.java | 65 +
.../ui/widgets/component/ComponentSelector.java | 530 ++++++
.../component/ComponentSelectorEvent.java | 85 +
.../component/ComponentSelectorListener.java | 32 +
.../component/ComponentSourceTransferable.java | 73 +
.../widgets/component/ComponentTreeModel.java | 71 +
.../ui/widgets/component/ComponentTreeNode.java | 107 ++
.../apache/airavata/xbaya/util/AmazonUtil.java | 150 ++
.../org/apache/airavata/xbaya/util/Data.java | 70 +
.../apache/airavata/xbaya/util/GOConstants.java | 30 +
.../airavata/xbaya/util/GlobusOnlineUtils.java | 245 +++
.../airavata/xbaya/util/InterpreterUtil.java | 391 +++++
.../airavata/xbaya/util/RegistryConstants.java | 30 +
.../airavata/xbaya/util/TransferFile.java | 170 ++
.../apache/airavata/xbaya/util/XBayaUtil.java | 353 ++++
.../airavata/xbaya/workflow/WorkflowClient.java | 246 +++
.../xbaya/workflow/WorkflowEngineException.java | 42 +
.../xbaya/workflow/proxy/ProxyWSDL.java | 87 +
.../xbaya/workflow/proxy/WorkflowClient.java | 35 +
.../xbaya/workflow/proxy/WorkflowContext.java | 42 +
.../workflow/proxy/WorkflowProxyException.java | 64 +
.../src/main/resources/WorkflowInterpretor.wsdl | 72 +
.../src/main/resources/images/airavata-2.png | Bin 0 -> 5582 bytes
.../main/resources/images/airavata-config.png | Bin 0 -> 1297 bytes
.../src/main/resources/images/airavata-icon.png | Bin 0 -> 584 bytes
.../main/resources/images/airavata-icon2.png | Bin 0 -> 981 bytes
.../src/main/resources/images/airavata-name.png | Bin 0 -> 8261 bytes
.../resources/images/airavata-title-text.png | Bin 0 -> 16438 bytes
.../src/main/resources/images/airavata.png | Bin 0 -> 17280 bytes
.../src/main/resources/images/application.png | Bin 0 -> 894 bytes
.../src/main/resources/images/applications.png | Bin 0 -> 657 bytes
.../src/main/resources/images/closed.gif | Bin 0 -> 923 bytes
.../src/main/resources/images/cloud.png | Bin 0 -> 573 bytes
.../src/main/resources/images/experiment.png | Bin 0 -> 543 bytes
.../src/main/resources/images/experiments.png | Bin 0 -> 1142 bytes
.../src/main/resources/images/gfac_url.png | Bin 0 -> 739 bytes
.../src/main/resources/images/gfac_urls.png | Bin 0 -> 816 bytes
.../src/main/resources/images/host.png | Bin 0 -> 652 bytes
.../src/main/resources/images/hosts.png | Bin 0 -> 671 bytes
.../src/main/resources/images/input_para.png | Bin 0 -> 428 bytes
.../src/main/resources/images/jcr-repo.png | Bin 0 -> 1010 bytes
.../src/main/resources/images/leaf.gif | Bin 0 -> 906 bytes
.../src/main/resources/images/menu/jcr.png | Bin 0 -> 1158 bytes
.../src/main/resources/images/menu/new2.png | Bin 0 -> 1175 bytes
.../src/main/resources/images/menu/open1.png | Bin 0 -> 925 bytes
.../src/main/resources/images/menu/open2.png | Bin 0 -> 964 bytes
.../src/main/resources/images/menu/open_dir.png | Bin 0 -> 749 bytes
.../src/main/resources/images/menu/pause1.png | Bin 0 -> 1101 bytes
.../resources/images/menu/pause_monitor1.png | Bin 0 -> 873 bytes
.../src/main/resources/images/menu/play3.png | Bin 0 -> 1192 bytes
.../src/main/resources/images/menu/play4.png | Bin 0 -> 765 bytes
.../images/menu/resume_monitoring1.png | Bin 0 -> 957 bytes
.../src/main/resources/images/menu/save1.png | Bin 0 -> 1200 bytes
.../src/main/resources/images/menu/stop.png | Bin 0 -> 316 bytes
.../src/main/resources/images/opened.gif | Bin 0 -> 917 bytes
.../src/main/resources/images/output_para.png | Bin 0 -> 490 bytes
.../src/main/resources/images/parameter.png | Bin 0 -> 544 bytes
.../src/main/resources/images/pause.jpeg | Bin 0 -> 458 bytes
.../src/main/resources/images/play.jpeg | Bin 0 -> 471 bytes
.../src/main/resources/images/registry.png | Bin 0 -> 3419 bytes
.../src/main/resources/images/service.png | Bin 0 -> 871 bytes
.../src/main/resources/images/services.png | Bin 0 -> 899 bytes
.../src/main/resources/images/step.gif | Bin 0 -> 211 bytes
.../src/main/resources/images/stop.jpeg | Bin 0 -> 497 bytes
.../src/main/resources/images/workflow.png | Bin 0 -> 601 bytes
.../resources/images/workflow_templates.png | Bin 0 -> 710 bytes
.../src/main/resources/images/workflows.png | Bin 0 -> 778 bytes
.../xbaya-gui/src/main/resources/services.xml | 30 +
.../resources/wsdls/TestCMD_Example1_AWSDL.xml | 56 +
.../src/main/resources/wsdls/adder-awsdl.xml | 63 +
.../src/main/resources/wsdls/eventing.wsdl | 332 ++++
.../interpreter/ComplexForEachWorkflowTest.java | 73 +
.../xbaya/interpreter/ComplexMathService.java | 40 +
.../interpreter/ComplexMathWorkflowTest.java | 71 +
.../interpreter/CrossProductWorkflowTest.java | 71 +
.../airavata/xbaya/interpreter/EchoService.java | 28 +
.../xbaya/interpreter/ForEachWorkflowTest.java | 73 +
.../interpreter/LevenshteinDistanceService.java | 48 +
.../airavata/xbaya/interpreter/Listener.java | 31 +
.../xbaya/interpreter/NotificationSender.java | 204 +++
.../xbaya/interpreter/RegistryServiceTest.java | 105 ++
.../interpreter/SimpleForEachWorkflowTest.java | 72 +
.../interpreter/SimpleMathWorkflowTest.java | 73 +
.../xbaya/interpreter/WorkflowTest.java | 74 +
.../xbaya/interpreter/WorkflowTrackingTest.java | 105 ++
.../xbaya/interpreter/XBayaClientTest.java | 80 +
.../interpreter/XBayaConsolidatedTestSuite.java | 67 +
.../xbaya/interpreter/utils/ConfigKeys.java | 34 +
.../xbaya/interpreter/utils/TestUtilServer.java | 243 +++
.../interpreter/utils/WorkflowTestUtils.java | 97 ++
modules/xbaya-gui/src/test/java/test.xwf | 251 +++
.../src/test/resources/axis2_default.xml | 278 ++++
544 files changed, 75861 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/pom.xml
----------------------------------------------------------------------
diff --git a/modules/security/pom.xml b/modules/security/pom.xml
new file mode 100644
index 0000000..bfe2a01
--- /dev/null
+++ b/modules/security/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
+ the Apache License, Version 2.0 (theĆ "License"); you may not use this file except in compliance with the License. You may
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
+ in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
+ the License. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata</artifactId>
+ <version>0.12-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-security</artifactId>
+ <name>Airavata Security Implementation</name>
+ <description>Module for managing security features in Airavata</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-core</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.7</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/AbstractAuthenticator.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/AbstractAuthenticator.java b/modules/security/src/main/java/org/apache/airavata/security/AbstractAuthenticator.java
new file mode 100644
index 0000000..536b80b
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/AbstractAuthenticator.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security;
+
+import org.apache.airavata.common.context.RequestContext;
+import org.apache.airavata.common.context.WorkflowContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+/**
+ * An abstract implementation of the authenticator.
+ */
+@SuppressWarnings("UnusedDeclaration")
+public abstract class AbstractAuthenticator implements Authenticator {
+
+ protected static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+ protected static Logger log = LoggerFactory.getLogger(AbstractAuthenticator.class);
+
+ public static int DEFAULT_AUTHENTICATOR_PRIORITY = 5;
+
+ protected String authenticatorName;
+
+ private int priority = DEFAULT_AUTHENTICATOR_PRIORITY;
+
+ protected boolean enabled = true;
+
+ protected UserStore userStore;
+
+ public AbstractAuthenticator() {
+
+ }
+
+ public AbstractAuthenticator(String name) {
+ this.authenticatorName = name;
+ }
+
+ public void setUserStore(UserStore store) {
+ this.userStore = store;
+ }
+
+ public UserStore getUserStore() {
+ return this.userStore;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public boolean canProcess(Object credentials) {
+ return false;
+ }
+
+ public String getAuthenticatorName() {
+ return authenticatorName;
+ }
+
+ public void setAuthenticatorName(String authenticatorName) {
+ this.authenticatorName = authenticatorName;
+ }
+
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public boolean authenticate(Object credentials) throws AuthenticationException {
+
+ boolean authenticated = doAuthentication(credentials);
+
+ if (authenticated) {
+ onSuccessfulAuthentication(credentials);
+ } else {
+ onFailedAuthentication(credentials);
+ }
+
+ return authenticated;
+ }
+
+ /**
+ * Gets the current time converted to format in DATE_TIME_FORMAT.
+ *
+ * @return Current time as a string.
+ */
+ protected String getCurrentTime() {
+ Calendar cal = Calendar.getInstance();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_TIME_FORMAT);
+ return simpleDateFormat.format(cal.getTime());
+ }
+
+ /**
+ * The actual authenticating logic goes here. If user is successfully authenticated this should return
+ * <code>true</code> else this should return <code>false</code>. If an error occurred while authenticating this will
+ * throw an exception.
+ *
+ * @param credentials
+ * The object which contains request credentials. This could be request most of the time.
+ * @return <code>true</code> if successfully authenticated else <code>false</code>.
+ * @throws AuthenticationException
+ * If system error occurs while authenticating.
+ */
+ protected abstract boolean doAuthentication(Object credentials) throws AuthenticationException;
+
+ /**
+ * If authentication is successful we can do post authentication actions in following method. E.g :- adding user to
+ * session, audit logging etc ...
+ *
+ * @param authenticationInfo
+ * A generic object with authentication information.
+ */
+ public abstract void onSuccessfulAuthentication(Object authenticationInfo);
+
+ /**
+ * If authentication is failed we can do post authentication actions in following method. E.g :- adding user to
+ * session, audit logging etc ...
+ *
+ * @param authenticationInfo
+ * A generic object with authentication information.
+ */
+ public abstract void onFailedAuthentication(Object authenticationInfo);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/AbstractDatabaseAuthenticator.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/AbstractDatabaseAuthenticator.java b/modules/security/src/main/java/org/apache/airavata/security/AbstractDatabaseAuthenticator.java
new file mode 100644
index 0000000..a980876
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/AbstractDatabaseAuthenticator.java
@@ -0,0 +1,129 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * An abstract authenticator class which reads database configurations.
+ */
+@SuppressWarnings("UnusedDeclaration")
+public abstract class AbstractDatabaseAuthenticator extends AbstractAuthenticator {
+
+ private String databaseURL;
+
+ private String databaseDriver;
+
+ private String databaseUserName;
+
+ private String databasePassword;
+
+ public AbstractDatabaseAuthenticator() {
+ super();
+ }
+
+ public AbstractDatabaseAuthenticator(String name) {
+ super(name);
+ }
+
+ /**
+ * We are reading database parameters in this case.
+ *
+ * @param node
+ * An XML configuration node.
+ */
+ public void configure(Node node) {
+
+ /**
+ * <specificConfigurations> <database> <jdbcUrl></jdbcUrl> <databaseDriver></databaseDriver>
+ * <userName></userName> <password></password> </database> </specificConfigurations>
+ */
+
+ NodeList databaseNodeList = node.getChildNodes();
+
+ Node databaseNode = null;
+
+ for (int k = 0; k < databaseNodeList.getLength(); ++k) {
+
+ Node n = databaseNodeList.item(k);
+
+ if (n != null && n.getNodeType() == Node.ELEMENT_NODE) {
+ databaseNode = n;
+ }
+ }
+
+ if (databaseNode != null) {
+ NodeList nodeList = databaseNode.getChildNodes();
+
+ for (int i = 0; i < nodeList.getLength(); ++i) {
+ Node n = nodeList.item(i);
+
+ if (n.getNodeType() == Node.ELEMENT_NODE) {
+
+ Element element = (Element) n;
+
+ if (element.getNodeName().equals("jdbcUrl")) {
+ databaseURL = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("databaseDriver")) {
+ databaseDriver = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("userName")) {
+ databaseUserName = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("password")) {
+ databasePassword = element.getFirstChild().getNodeValue();
+ }
+ }
+ }
+ }
+
+ StringBuilder stringBuilder = new StringBuilder("Configuring DB parameters for authenticator with JDBC URL - ");
+ stringBuilder.append(databaseURL).append(" DB driver - ").append(" DB user - ").append(databaseUserName)
+ .append(" DB password - xxxxxx");
+
+ log.debug(stringBuilder.toString());
+
+ try {
+ getUserStore().configure(node);
+ } catch (UserStoreException e) {
+ String msg = "Error configuring user store associated with authenticator.";
+ log.error(msg, e);
+ throw new RuntimeException(msg, e);
+ }
+ }
+
+ public String getDatabaseURL() {
+ return databaseURL;
+ }
+
+ public String getDatabaseDriver() {
+ return databaseDriver;
+ }
+
+ public String getDatabaseUserName() {
+ return databaseUserName;
+ }
+
+ public String getDatabasePassword() {
+ return databasePassword;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/AuthenticationException.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/AuthenticationException.java b/modules/security/src/main/java/org/apache/airavata/security/AuthenticationException.java
new file mode 100644
index 0000000..f4aca49
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/AuthenticationException.java
@@ -0,0 +1,41 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security;
+
+/**
+ * Wraps errors during authentication. This exception will be thrown if there is a system error during authentication.
+ */
+public class AuthenticationException extends Exception {
+
+ public AuthenticationException() {
+ super();
+ }
+
+ public AuthenticationException(String message) {
+ super(message);
+ }
+
+ public AuthenticationException(String message, Exception e) {
+ super(message, e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/Authenticator.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/Authenticator.java b/modules/security/src/main/java/org/apache/airavata/security/Authenticator.java
new file mode 100644
index 0000000..814bdb6
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/Authenticator.java
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security;
+
+import org.w3c.dom.Node;
+
+/**
+ * A generic interface to do request authentication. Specific authenticator will implement authenticate method.
+ */
+@SuppressWarnings("UnusedDeclaration")
+public interface Authenticator {
+
+ /**
+ * Authenticates the request with given credentials.
+ *
+ * @param credentials
+ * Credentials can be a session ticket, password or session id.
+ * @return <code>true</code> if request is successfully authenticated else <code>false</code>.
+ * @throws AuthenticationException
+ * If a system error occurred during authentication process.
+ */
+ boolean authenticate(Object credentials) throws AuthenticationException;
+
+ /**
+ * Checks whether given user is already authenticated.
+ *
+ * @param credentials
+ * The token to be authenticated.
+ * @return <code>true</code> if token is already authenticated else <code>false</code>.
+ */
+ boolean isAuthenticated(Object credentials);
+
+ /**
+ * Says whether current authenticator can handle given credentials.
+ *
+ * @param credentials
+ * Credentials used during authentication.
+ * @return <code>true</code> is can authenticate else <code>false</code>.
+ */
+ boolean canProcess(Object credentials);
+
+ /**
+ * Gets the priority of this authenticator.
+ *
+ * @return Higher the priority higher the precedence of selecting the authenticator.
+ */
+ int getPriority();
+
+ /**
+ * Returns the authenticator name. Each authenticator is associated with an identifiable name.
+ *
+ * @return The authenticator name.
+ */
+ String getAuthenticatorName();
+
+ /**
+ * Authenticator specific configurations goes into this method.
+ *
+ * @param node
+ * An XML configuration node.
+ * @throws RuntimeException
+ * If an error occurred while configuring the authenticator.
+ */
+ void configure(Node node) throws RuntimeException;
+
+ /**
+ * Return <code>true</code> if current authenticator is enabled. Else <code>false</code>.
+ *
+ * @return <code>true</code> if enabled.
+ */
+ boolean isEnabled();
+
+ /**
+ * User store that should be used by this authenticator. When authenticating a request authenticator should use the
+ * user store set by this method.
+ *
+ * @param userStore
+ * The user store to be used.
+ */
+ void setUserStore(UserStore userStore);
+
+ /**
+ * Gets the user store used by this authenticator.
+ *
+ * @return The user store used by this authenticator.
+ */
+ UserStore getUserStore();
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/Authoriser.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/Authoriser.java b/modules/security/src/main/java/org/apache/airavata/security/Authoriser.java
new file mode 100644
index 0000000..f0fdea9
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/Authoriser.java
@@ -0,0 +1,43 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security;
+
+/**
+ * An interface which can be used to authorise accessing resources.
+ */
+@SuppressWarnings("UnusedDeclaration")
+public interface Authoriser {
+
+ /**
+ * Checks whether user has sufficient privileges to perform action on the given resource.
+ *
+ * @param userName
+ * The user who is performing the action.
+ * @param resource
+ * The resource which user is trying to access.
+ * @param action
+ * The action (GET, PUT etc ...)
+ * @return Returns <code>true</code> if user is authorised to perform the action, else false.
+ */
+ boolean isAuthorised(String userName, String resource, String action);
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/UserStore.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/UserStore.java b/modules/security/src/main/java/org/apache/airavata/security/UserStore.java
new file mode 100644
index 0000000..cfee957
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/UserStore.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+
+package org.apache.airavata.security;
+
+import org.w3c.dom.Node;
+
+/**
+ * An interface to wrap the functionality of a user store. A user store is place where we keep user attribute
+ * information. Usually this contains, user id, user name, password etc ...
+ * We also authenticate users against the credentials stored in a user store. In addition to user attributes
+ * we also store role information and group information.
+ * This interface provide methods to manipulated data in a user store.
+ * Such operations are as follows,
+ * <ol>
+ * <li>authenticate user</li>
+ * <li>add user</li>
+ * <li>delete user</li>
+ * <li>add a role</li>
+ * <li>delete a role</li>
+ * <li>... etc ...</li>
+ * </ol>
+ */
+public interface UserStore {
+
+ /**
+ * Checks whether given user exists in the user store and its credentials match with the credentials stored
+ * in the user store.
+ * @param userName Name of the user to authenticate.
+ * @param credentials User credentials as an object. User credentials may not be a string always.
+ * @return True if user exists in the user store and its credentials match with the credentials in user store.
+ * <code>false</code> else.
+ * @throws UserStoreException if a system wide error occurred while authenticating the user.
+ */
+ boolean authenticate(String userName, Object credentials) throws UserStoreException;
+
+ /**
+ * Authenticates a user using a token.
+ * @param credentials The token information.
+ * @return <code>true</code> if authentication successful else <code>false</code>.
+ * @throws UserStoreException if a system wide error occurred while authenticating the user.
+ */
+ boolean authenticate(Object credentials) throws UserStoreException;
+
+ /**
+ * This method will do necessary configurations of the user store.
+ * @param node An XML configuration node.
+ * @throws RuntimeException If an error occurred while configuring the authenticator.
+ */
+ void configure(Node node) throws UserStoreException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/UserStoreException.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/UserStoreException.java b/modules/security/src/main/java/org/apache/airavata/security/UserStoreException.java
new file mode 100644
index 0000000..927bf8a
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/UserStoreException.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+
+package org.apache.airavata.security;
+
+/**
+ * Exception class to wrap user store errors.
+ */
+public class UserStoreException extends Exception {
+
+ public UserStoreException() {
+ super();
+ }
+
+ public UserStoreException(String message) {
+ super(message);
+ }
+
+ public UserStoreException(String message, Exception e) {
+ super(message, e);
+ }
+
+ public UserStoreException(Exception e) {
+ super(e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/configurations/AbstractConfigurationReader.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/configurations/AbstractConfigurationReader.java b/modules/security/src/main/java/org/apache/airavata/security/configurations/AbstractConfigurationReader.java
new file mode 100644
index 0000000..5ba0915
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/configurations/AbstractConfigurationReader.java
@@ -0,0 +1,55 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security.configurations;
+
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Abstract implementation to read configurations.
+ */
+public abstract class AbstractConfigurationReader {
+
+ public void init(String fileName) throws IOException, SAXException, ParserConfigurationException {
+
+ File configurationFile = new File(fileName);
+
+ if (!configurationFile.canRead()) {
+ throw new IOException("Error reading configuration file " + configurationFile.getAbsolutePath());
+ }
+
+ FileInputStream streamIn = new FileInputStream(configurationFile);
+
+ try {
+ init(streamIn);
+ } finally {
+ streamIn.close();
+ }
+ }
+
+ public abstract void init(InputStream inputStream) throws IOException, ParserConfigurationException, SAXException;
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/configurations/AuthenticatorConfigurationReader.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/configurations/AuthenticatorConfigurationReader.java b/modules/security/src/main/java/org/apache/airavata/security/configurations/AuthenticatorConfigurationReader.java
new file mode 100644
index 0000000..278c8a9
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/configurations/AuthenticatorConfigurationReader.java
@@ -0,0 +1,244 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security.configurations;
+
+import org.apache.airavata.security.AbstractAuthenticator;
+import org.apache.airavata.security.Authenticator;
+import org.apache.airavata.security.UserStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * This class will read authenticators.xml and load all configurations related to authenticators.
+ */
+public class AuthenticatorConfigurationReader extends AbstractConfigurationReader {
+
+ private List<Authenticator> authenticatorList = new ArrayList<Authenticator>();
+
+ protected static Logger log = LoggerFactory.getLogger(AuthenticatorConfigurationReader.class);
+
+ protected static boolean authenticationEnabled = true;
+
+ public AuthenticatorConfigurationReader() {
+
+ }
+
+ public void init(InputStream inputStream) throws IOException, ParserConfigurationException, SAXException {
+
+ authenticationEnabled = true;
+
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ Document doc = dBuilder.parse(inputStream);
+ doc.getDocumentElement().normalize();
+
+ NodeList rootNodeList = doc.getElementsByTagName("authenticators");
+
+ if (rootNodeList == null || rootNodeList.getLength() == 0) {
+ throw new ParserConfigurationException("authenticators.xml should have authenticators root element.");
+ }
+
+ Node authenticatorsNode = rootNodeList.item(0);
+ NamedNodeMap rootAttributes = authenticatorsNode.getAttributes();
+
+ if (rootAttributes != null && rootAttributes.getNamedItem("enabled") != null) {
+
+ String enabledAttribute = rootAttributes.getNamedItem("enabled").getNodeValue();
+ if (enabledAttribute != null) {
+
+ if (enabledAttribute.equals("false")) {
+ authenticationEnabled = false;
+ }
+ }
+ }
+
+ NodeList authenticators = doc.getElementsByTagName("authenticator");
+
+ for (int i = 0; i < authenticators.getLength(); ++i) {
+ Node node = authenticators.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+
+ NamedNodeMap namedNodeMap = node.getAttributes();
+
+ String name = namedNodeMap.getNamedItem("name").getNodeValue();
+ String className = namedNodeMap.getNamedItem("class").getNodeValue();
+ String enabled = namedNodeMap.getNamedItem("enabled").getNodeValue();
+ String priority = namedNodeMap.getNamedItem("priority").getNodeValue();
+ String userStoreClass = namedNodeMap.getNamedItem("userstore").getNodeValue();
+
+ if (className == null) {
+ reportError("class");
+ }
+
+ if (userStoreClass == null) {
+ reportError("userstore");
+ }
+
+ Authenticator authenticator = createAuthenticator(name, className, enabled, priority, userStoreClass);
+
+ NodeList configurationNodes = node.getChildNodes();
+
+ for (int j = 0; j < configurationNodes.getLength(); ++j) {
+
+ Node configurationNode = configurationNodes.item(j);
+
+ if (configurationNode.getNodeType() == Node.ELEMENT_NODE) {
+
+ if (configurationNode.getNodeName().equals("specificConfigurations")) {
+ authenticator.configure(configurationNode);
+ }
+ }
+ }
+
+ if (authenticator.isEnabled()) {
+ authenticatorList.add(authenticator);
+ }
+
+ Collections.sort(authenticatorList, new AuthenticatorComparator());
+
+ StringBuilder stringBuilder = new StringBuilder("Successfully initialized authenticator ");
+ stringBuilder.append(name).append(" with class ").append(className).append(" enabled? ")
+ .append(enabled).append(" priority = ").append(priority);
+
+ log.debug(stringBuilder.toString());
+ }
+ }
+ }
+
+ private void reportError(String element) throws ParserConfigurationException {
+ throw new ParserConfigurationException("Error in configuration. Missing mandatory element " + element);
+ }
+
+ protected Authenticator createAuthenticator(String name, String className, String enabled, String priority,
+ String userStoreClassName) {
+
+ log.debug("Loading authenticator class " + className + " and name " + name);
+
+ // Load a class and instantiate an object
+ Class authenticatorClass;
+ try {
+ authenticatorClass = Class.forName(className, true, Thread.currentThread().getContextClassLoader());
+ // authenticatorClass = Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ log.error("Error loading authenticator class " + className);
+ throw new RuntimeException("Error loading authenticator class " + className, e);
+
+ }
+
+ try {
+ AbstractAuthenticator authenticatorInstance = (AbstractAuthenticator) authenticatorClass.newInstance();
+ authenticatorInstance.setAuthenticatorName(name);
+
+ if (enabled != null) {
+ authenticatorInstance.setEnabled(Boolean.parseBoolean(enabled));
+ }
+
+ if (priority != null) {
+ authenticatorInstance.setPriority(Integer.parseInt(priority));
+ }
+
+ UserStore userStore = createUserStore(userStoreClassName);
+ authenticatorInstance.setUserStore(userStore);
+
+ return authenticatorInstance;
+
+ } catch (InstantiationException e) {
+ String error = "Error instantiating authenticator class " + className + " object.";
+ log.error(error);
+ throw new RuntimeException(error, e);
+
+ } catch (IllegalAccessException e) {
+ String error = "Not allowed to instantiate authenticator class " + className;
+ log.error(error);
+ throw new RuntimeException(error, e);
+ }
+
+ }
+
+ protected UserStore createUserStore(String userStoreClassName) {
+
+ try {
+ Class userStoreClass = Class.forName(userStoreClassName, true, Thread.currentThread()
+ .getContextClassLoader());
+
+ return (UserStore) userStoreClass.newInstance();
+ } catch (ClassNotFoundException e) {
+ log.error("Error loading authenticator class " + userStoreClassName);
+ throw new RuntimeException("Error loading authenticator class " + userStoreClassName, e);
+
+ } catch (InstantiationException e) {
+ String error = "Error instantiating authenticator class " + userStoreClassName + " object.";
+ log.error(error);
+ throw new RuntimeException(error, e);
+
+ } catch (IllegalAccessException e) {
+ String error = "Not allowed to instantiate authenticator class " + userStoreClassName;
+ log.error(error);
+ throw new RuntimeException(error, e);
+ }
+
+ }
+
+ public List<Authenticator> getAuthenticatorList() {
+ return Collections.unmodifiableList(authenticatorList);
+ }
+
+ /**
+ * We can specify whether authentication is enabled in the system for all request or not. This we can state in the
+ * configuration. AuthenticatorConfigurationReader will read that information and will populate that to static
+ * boolean authenticationEnabled. This method will say whether authentication is enabled in the system or disabled
+ * in the system.
+ *
+ * @return <code>true</code> if authentication is enabled. Else <code>false</code>.
+ */
+ public static boolean isAuthenticationEnabled() {
+ return authenticationEnabled;
+ }
+
+ /**
+ * Comparator to sort authenticators based on authenticator priority.
+ */
+ public class AuthenticatorComparator implements Comparator<Authenticator> {
+
+ @Override
+ public int compare(Authenticator o1, Authenticator o2) {
+ return (o1.getPriority() > o2.getPriority() ? -1 : (o1.getPriority() == o2.getPriority() ? 0 : 1));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java b/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java
new file mode 100644
index 0000000..96d2485
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/userstore/AbstractJDBCUserStore.java
@@ -0,0 +1,134 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security.userstore;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ApplicationSettings;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.security.UserStore;
+import org.apache.airavata.security.UserStoreException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * An abstract implementation of the UserStore. This will encapsulate JDBC configurations reading code.
+ */
+public abstract class AbstractJDBCUserStore implements UserStore {
+
+ protected static Logger log = LoggerFactory.getLogger(JDBCUserStore.class);
+
+ private String databaseURL = null;
+ private String databaseDriver = null;
+ private String databaseUserName = null;
+ private String databasePassword = null;
+
+ public String getDatabaseURL() {
+ return databaseURL;
+ }
+
+ public String getDatabaseDriver() {
+ return databaseDriver;
+ }
+
+ public String getDatabaseUserName() {
+ return databaseUserName;
+ }
+
+ public String getDatabasePassword() {
+ return databasePassword;
+ }
+
+ /**
+ * Configures primary JDBC parameters. i.e
+ *
+ * @param node An XML configuration node.
+ * @throws UserStoreException
+ */
+ public void configure(Node node) throws UserStoreException {
+
+ /**
+ * <specificConfigurations> <database> <jdbcUrl></jdbcUrl> <databaseDriver></databaseDriver>
+ * <userName></userName> <password></password> </database> </specificConfigurations>
+ */
+
+ NodeList databaseNodeList = node.getChildNodes();
+
+ Node databaseNode = null;
+
+ for (int k = 0; k < databaseNodeList.getLength(); ++k) {
+
+ Node n = databaseNodeList.item(k);
+
+ if (n != null && n.getNodeType() == Node.ELEMENT_NODE) {
+ databaseNode = n;
+ }
+ }
+
+ if (databaseNode != null) {
+ NodeList nodeList = databaseNode.getChildNodes();
+
+ for (int i = 0; i < nodeList.getLength(); ++i) {
+ Node n = nodeList.item(i);
+
+ if (n.getNodeType() == Node.ELEMENT_NODE) {
+
+ Element element = (Element) n;
+
+ if (element.getNodeName().equals("jdbcUrl")) {
+ databaseURL = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("databaseDriver")) {
+ databaseDriver = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("userName")) {
+ databaseUserName = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("password")) {
+ databasePassword = element.getFirstChild().getNodeValue();
+ }
+ }
+ }
+ }
+
+ if (databaseURL == null || databaseUserName == null || databasePassword == null) {
+ // If database configurations are not specified in authenticators.xml we will read them from
+ // server.properties file.
+ try {
+ databaseDriver = ServerSettings.getCredentialStoreDBDriver();
+ databaseURL = ServerSettings.getCredentialStoreDBURL();
+ databaseUserName = ServerSettings.getCredentialStoreDBUser();
+ databasePassword = ServerSettings.getCredentialStoreDBPassword();
+
+ } catch (ApplicationSettingsException e) {
+ log.error("Error reading default user store DB configurations.");
+ throw new UserStoreException(e);
+ }
+
+ StringBuilder stringBuilder = new StringBuilder("User store configurations - dbDriver - ");
+ stringBuilder.append(databaseDriver);
+ stringBuilder.append(" URL - ").append(databaseURL).append(" DB user - ").append(databaseUserName);
+ log.info(stringBuilder.toString());
+
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/security/src/main/java/org/apache/airavata/security/userstore/JDBCUserStore.java
----------------------------------------------------------------------
diff --git a/modules/security/src/main/java/org/apache/airavata/security/userstore/JDBCUserStore.java b/modules/security/src/main/java/org/apache/airavata/security/userstore/JDBCUserStore.java
new file mode 100644
index 0000000..f1a486d
--- /dev/null
+++ b/modules/security/src/main/java/org/apache/airavata/security/userstore/JDBCUserStore.java
@@ -0,0 +1,166 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.security.userstore;
+
+import org.apache.airavata.security.UserStoreException;
+import org.apache.airavata.common.utils.DBUtil;
+import org.apache.airavata.security.util.PasswordDigester;
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.authc.AuthenticationInfo;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.realm.jdbc.JdbcRealm;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+
+import javax.sql.DataSource;
+
+/**
+ * The JDBC user store implementation.
+ */
+public class JDBCUserStore extends AbstractJDBCUserStore {
+
+ protected static Logger log = LoggerFactory.getLogger(JDBCUserStore.class);
+
+ private JdbcRealm jdbcRealm;
+
+ private PasswordDigester passwordDigester;
+
+ public JDBCUserStore() {
+ jdbcRealm = new JdbcRealm();
+ }
+
+ @Override
+ public boolean authenticate(String userName, Object credentials) throws UserStoreException {
+ AuthenticationToken authenticationToken = new UsernamePasswordToken(userName,
+ passwordDigester.getPasswordHashValue((String) credentials));
+
+ AuthenticationInfo authenticationInfo;
+ try {
+
+ authenticationInfo = jdbcRealm.getAuthenticationInfo(authenticationToken);
+ return authenticationInfo != null;
+
+ } catch (AuthenticationException e) {
+ log.debug(e.getLocalizedMessage(), e);
+ return false;
+ }
+ }
+
+ @Override
+ public boolean authenticate(Object credentials) throws UserStoreException {
+ log.error("JDBC user store only supports user name, password based authentication.");
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void configure(Node node) throws UserStoreException {
+
+ super.configure(node);
+
+ /**
+ * <specificConfigurations> <database> <jdbcUrl></jdbcUrl> <databaseDriver></databaseDriver>
+ * <userName></userName> <password></password> <passwordHashMethod>MD5</passwordHashMethod>
+ * <userTableName></userTableName> <userNameColumnName></userNameColumnName>
+ * <passwordColumnName></passwordColumnName> </database> </specificConfigurations>
+ */
+
+ NodeList databaseNodeList = node.getChildNodes();
+
+ Node databaseNode = null;
+
+ for (int k = 0; k < databaseNodeList.getLength(); ++k) {
+
+ Node n = databaseNodeList.item(k);
+
+ if (n != null && n.getNodeType() == Node.ELEMENT_NODE) {
+ databaseNode = n;
+ }
+ }
+
+ String userTable = null;
+ String userNameColumn = null;
+ String passwordColumn = null;
+ String passwordHashMethod = null;
+
+ if (databaseNode != null) {
+ NodeList nodeList = databaseNode.getChildNodes();
+
+ for (int i = 0; i < nodeList.getLength(); ++i) {
+ Node n = nodeList.item(i);
+
+ if (n.getNodeType() == Node.ELEMENT_NODE) {
+
+ Element element = (Element) n;
+
+ if (element.getNodeName().equals("userTableName")) {
+ userTable = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("userNameColumnName")) {
+ userNameColumn = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("passwordColumnName")) {
+ passwordColumn = element.getFirstChild().getNodeValue();
+ } else if (element.getNodeName().equals("passwordHashMethod")) {
+ passwordHashMethod = element.getFirstChild().getNodeValue();
+ }
+ }
+ }
+ }
+
+ passwordDigester = new PasswordDigester(passwordHashMethod);
+
+ try {
+ initializeDatabaseLookup(passwordColumn, userTable, userNameColumn);
+ } catch (Exception e) {
+ log.error("Error while initializing database configurations.", e);
+ throw new UserStoreException("Error while initializing database configurations.", e);
+ }
+
+ StringBuilder stringBuilder = new StringBuilder(
+ "Configuring DB parameters for authenticator with User name Table - ");
+ stringBuilder.append(userTable).append(" User name column - ").append(userNameColumn)
+ .append(" Password column - ").append(passwordColumn);
+
+ log.debug(stringBuilder.toString());
+ }
+
+ protected void initializeDatabaseLookup(String passwordColumn, String userTable, String userNameColumn) throws IllegalAccessException, ClassNotFoundException, InstantiationException {
+
+ DBUtil dbUtil = new DBUtil(getDatabaseURL(), getDatabaseUserName(), getDatabasePassword(), getDatabaseDriver());
+ DataSource dataSource = dbUtil.getDataSource();
+ jdbcRealm.setDataSource(dataSource);
+
+ StringBuilder stringBuilder = new StringBuilder();
+
+ stringBuilder.append("SELECT ").append(passwordColumn).append(" FROM ").append(userTable).append(" WHERE ")
+ .append(userNameColumn).append(" = ?");
+
+ jdbcRealm.setAuthenticationQuery(stringBuilder.toString());
+ }
+
+ public PasswordDigester getPasswordDigester() {
+ return passwordDigester;
+ }
+}