You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:17:09 UTC
[28/28] incubator-taverna-common-activities git commit: Revert
"temporarily empty repository"
Revert "temporarily empty repository"
This reverts commit 98a02d583b6d848841d90d48d93506ade777a75d.
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/commit/390c286b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/tree/390c286b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/diff/390c286b
Branch: refs/heads/master
Commit: 390c286b2ddeaa161aaf5466c8aa21af66692d86
Parents: 2e8f451
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Wed Feb 18 12:55:24 2015 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Mon Feb 23 10:15:35 2015 +0000
----------------------------------------------------------------------
.gitignore | 5 +
.travis.yml | 1 +
pom.xml | 40 +
taverna-beanshell-activity/pom.xml | 90 +
.../activities/beanshell/BeanshellActivity.java | 251 +
.../BeanshellActivityConfigurationBean.java | 86 +
.../beanshell/BeanshellActivityFactory.java | 79 +
.../BeanshellActivityHealthChecker.java | 111 +
.../t2/activities/beanshell/package.html | 3 +
...averna.t2.workflowmodel.health.HealthChecker | 1 +
.../spring/beanshell-activity-context-osgi.xml | 15 +
.../spring/beanshell-activity-context.xml | 12 +
.../src/main/resources/schema.json | 21 +
.../beanshell/BeanshellActivityFactoryTest.java | 64 +
.../BeanshellActivityHealthCheckerTest.java | 173 +
.../beanshell/BeanshellActivityTest.java | 86 +
taverna-external-tool-activity/pom.xml | 91 +
.../inb/knowarc/gui/AskUserForPwPopup.java | 77 +
.../inb/knowarc/gui/PleaseWaitDialog.java | 75 +
.../knowarc/usecases/RuntimeEnvironment.java | 253 +
.../usecases/RuntimeEnvironmentConstraint.java | 162 +
.../inb/knowarc/usecases/ScriptInput.java | 136 +
.../inb/knowarc/usecases/ScriptInputStatic.java | 75 +
.../inb/knowarc/usecases/ScriptInputUser.java | 101 +
.../inb/knowarc/usecases/ScriptOutput.java | 90 +
.../knowarc/usecases/UseCaseDescription.java | 899 +
.../knowarc/usecases/UseCaseEnumeration.java | 114 +
.../usecases/invocation/AskUserForPw.java | 34 +
.../invocation/InvocationException.java | 25 +
.../usecases/invocation/UseCaseInvocation.java | 324 +
.../local/LocalUseCaseInvocation.java | 563 +
.../ssh/SshAutoLoginTrustEveryone.java | 72 +
.../usecases/invocation/ssh/SshNode.java | 159 +
.../usecases/invocation/ssh/SshNodeFactory.java | 56 +
.../usecases/invocation/ssh/SshPool.java | 148 +
.../usecases/invocation/ssh/SshReference.java | 208 +
.../knowarc/usecases/invocation/ssh/SshUrl.java | 153 +
.../invocation/ssh/SshUrlToSshReference.java | 43 +
.../invocation/ssh/SshUseCaseInvocation.java | 563 +
.../externaltool/ExternalToolActivity.java | 301 +
.../ExternalToolActivityConfigurationBean.java | 194 +
.../ExternalToolActivityFactory.java | 100 +
.../ExternalToolActivityHealthChecker.java | 195 +
.../ExternalToolActivityMimeTypeChecker.java | 174 +
.../ExternalToolRunDeletionListener.java | 38 +
.../externaltool/InvocationCreator.java | 25 +
.../externaltool/RetrieveLoginFromTaverna.java | 57 +
.../ExternalToolLocalInvocationMechanism.java | 131 +
.../local/LocalInvocationCreator.java | 49 +
.../local/LocalInvocationPersister.java | 45 +
.../local/LocalMechanismCreator.java | 48 +
.../externaltool/manager/InvocationGroup.java | 141 +
.../manager/InvocationGroupAddedEvent.java | 18 +
.../manager/InvocationGroupChangedEvent.java | 18 +
.../manager/InvocationGroupManager.java | 102 +
.../manager/InvocationGroupRemovedEvent.java | 24 +
.../manager/InvocationManagerEvent.java | 5 +
.../manager/InvocationMechanism.java | 60 +
.../manager/InvocationMechanismAddedEvent.java | 18 +
.../InvocationMechanismChangedEvent.java | 18 +
.../InvocationMechanismRemovedEvent.java | 24 +
.../manager/InvocationPersister.java | 20 +
.../externaltool/manager/MechanismCreator.java | 49 +
.../impl/InvocationGroupManagerImpl.java | 446 +
.../t2/activities/externaltool/package.html | 3 +
.../repository/ExternalToolRepositoryUtil.java | 12 +
.../ssh/ExternalToolSshInvocationMechanism.java | 96 +
.../externaltool/ssh/SshInvocationCreator.java | 119 +
.../ssh/SshInvocationPersister.java | 56 +
.../externaltool/ssh/SshMechanismCreator.java | 84 +
...t2.activities.externaltool.InvocationCreator | 2 +
...ies.externaltool.manager.InvocationPersister | 2 +
...vities.externaltool.manager.MechanismCreator | 2 +
...sf.taverna.t2.reference.ExternalReferenceSPI | 2 +
...na.t2.reference.ValueToReferenceConverterSPI | 3 +
...taverna.t2.workflowmodel.RunDeletionListener | 1 +
...averna.t2.workflowmodel.health.HealthChecker | 2 +
.../external-tool-activity-context-osgi.xml | 42 +
.../spring/external-tool-activity-context.xml | 50 +
.../invocation/ssh/SshReference.hbm.xml | 23 +
taverna-interaction-activity/pom.xml | 158 +
.../t2/activities/interaction/FeedReader.java | 87 +
.../interaction/InteractionActivity.java | 156 +
.../interaction/InteractionActivityFactory.java | 135 +
.../InteractionActivityHealthChecker.java | 39 +
.../InteractionActivityRunnable.java | 329 +
.../interaction/InteractionActivityType.java | 15 +
.../InteractionCallbackRequestor.java | 193 +
.../interaction/InteractionRecorder.java | 163 +
.../interaction/InteractionRequestor.java | 38 +
.../InteractionRunDeletionListener.java | 31 +
.../activities/interaction/InteractionType.java | 14 +
.../interaction/InteractionUtils.java | 127 +
.../interaction/ResponseFeedListener.java | 159 +
.../activities/interaction/atom/AtomUtils.java | 83 +
.../feed/ShowRequestFeedListener.java | 65 +
.../jetty/HackedFilesystemAdapter.java | 263 +
.../interaction/jetty/InteractionJetty.java | 203 +
.../preference/InteractionPreference.java | 268 +
.../velocity/InteractionVelocity.java | 130 +
.../interaction/velocity/NotifyChecker.java | 26 +
.../interaction/velocity/NotifyDirective.java | 58 +
.../interaction/velocity/ProduceChecker.java | 35 +
.../interaction/velocity/ProduceDirective.java | 58 +
.../interaction/velocity/RequireChecker.java | 35 +
.../interaction/velocity/RequireDirective.java | 58 +
.../src/main/resources/Authorize.vm | 73 +
...taverna.t2.activities.interaction.FeedReader | 2 +
...taverna.t2.workflowmodel.RunDeletionListener | 1 +
...averna.t2.workflowmodel.health.HealthChecker | 1 +
.../interaction-activity-context-osgi.xml | 21 +
.../spring/interaction-activity-context.xml | 61 +
.../src/main/resources/MasterPassword.vm | 47 +
.../src/main/resources/TrustedCertificate.vm | 57 +
.../src/main/resources/TruststorePassword.vm | 48 +
.../src/main/resources/UsernamePassword.vm | 57 +
.../resources/abdera/adapter/feed.properties | 5 +
.../src/main/resources/ask.vm | 51 +
.../src/main/resources/choose.vm | 74 +
.../src/main/resources/index | 15 +
.../src/main/resources/interaction.css | 5 +
.../src/main/resources/interaction.vm | 168 +
.../src/main/resources/json2.js | 487 +
.../src/main/resources/notify.vm | 39 +
.../src/main/resources/pmrpc.js | 686 +
.../src/main/resources/schema.json | 31 +
.../src/main/resources/select.vm | 61 +
.../src/main/resources/tell.vm | 54 +
.../src/main/resources/warn.vm | 54 +
taverna-rest-activity/pom.xml | 96 +
.../taverna/t2/activities/rest/HTTPRequest.java | 105 +
.../t2/activities/rest/HTTPRequestHandler.java | 586 +
.../t2/activities/rest/HTTPRequestHeader.java | 66 +
.../t2/activities/rest/RESTActivity.java | 345 +
.../rest/RESTActivityConfigurationBean.java | 306 +
.../rest/RESTActivityCredentialsProvider.java | 178 +
.../t2/activities/rest/RESTActivityFactory.java | 165 +
.../rest/RESTActivityHealthCheck.java | 32 +
.../rest/RESTActivityHealthChecker.java | 58 +
.../t2/activities/rest/URISignatureHandler.java | 412 +
...t2.workbench.report.explainer.VisitExplainer | 1 +
...averna.t2.workflowmodel.health.HealthChecker | 1 +
.../spring/rest-activity-context-osgi.xml | 16 +
.../META-INF/spring/rest-activity-context.xml | 13 +
.../src/main/resources/schema.json | 75 +
.../rest/ApacheHttpClientUsageTest.java.bak | 215 +
.../rest/ExampleActivityTest.java.bak | 153 +
.../rest/URISignatureHandlerTest.java | 594 +
taverna-spreadsheet-import-activity/pom.xml | 121 +
.../spreadsheet/CSVSpreadsheetReader.java | 79 +
.../spreadsheet/ExcelSpreadsheetReader.java | 324 +
.../spreadsheet/ODFSpreadsheetReader.java | 193 +
.../t2/activities/spreadsheet/Range.java | 298 +
.../spreadsheet/SpreadsheetEmptyCellPolicy.java | 39 +
.../spreadsheet/SpreadsheetImportActivity.java | 358 +
.../SpreadsheetImportActivityFactory.java | 95 +
.../SpreadsheetImportConfiguration.java | 416 +
.../SpreadsheetImportHealthChecker.java | 61 +
.../spreadsheet/SpreadsheetOutputFormat.java | 37 +
.../spreadsheet/SpreadsheetReadException.java | 69 +
.../spreadsheet/SpreadsheetReader.java | 52 +
.../spreadsheet/SpreadsheetRowProcessor.java | 42 +
.../spreadsheet/SpreadsheetUtils.java | 128 +
.../t2/activities/spreadsheet/package.html | 3 +
...averna.t2.workflowmodel.health.HealthChecker | 1 +
.../spreadsheetimport-activity-context-osgi.xml | 15 +
.../spreadsheetimport-activity-context.xml | 12 +
.../src/main/resources/schema.json | 126 +
.../spreadsheet/CSVSpreadsheetReaderTest.java | 259 +
.../spreadsheet/ExcelSpreadsheetReaderTest.java | 299 +
.../spreadsheet/ODFSpreadsheetReaderTest.java | 293 +
.../t2/activities/spreadsheet/RangeTest.java | 195 +
.../SpreadsheetImportActivityFactoryTest.java | 75 +
.../SpreadsheetImportActivityTest.java | 186 +
.../SpreadsheetImportConfigurationTest.java | 265 +
.../SpreadsheetImportHealthCheckerTest.java | 91 +
.../SpreadsheetReadExceptionTest.java | 38 +
.../spreadsheet/SpreadsheetUtilsTest.java | 98 +
.../src/test/resources/test-spreadsheet.csv | 1 +
.../src/test/resources/test-spreadsheet.ods | Bin 0 -> 16319 bytes
.../src/test/resources/test-spreadsheet.xls | Bin 0 -> 8192 bytes
.../src/test/resources/test-spreadsheet.xlsx | Bin 0 -> 7300 bytes
taverna-wsdl-activity/pom.xml | 118 +
.../wsdl/InputPortTypeDescriptorActivity.java | 57 +
.../wsdl/OutputPortTypeDescriptorActivity.java | 57 +
.../t2/activities/wsdl/T2WSDLSOAPInvoker.java | 282 +
.../t2/activities/wsdl/WSDLActivity.java | 328 +
.../wsdl/WSDLActivityConfigurationBean.java | 82 +
.../wsdl/WSDLActivityDescriptorChecker.java | 147 +
.../t2/activities/wsdl/WSDLActivityFactory.java | 141 +
.../wsdl/WSDLActivityHealthChecker.java | 170 +
.../wsdl/WSDLOperationConfigurationBean.java | 57 +
.../sf/taverna/t2/activities/wsdl/package.html | 3 +
.../activities/wsdl/security/SSLUtilities.java | 151 +
.../wsdl/security/SecurityProfiles.java | 130 +
.../TavernaAxisCustomSSLSocketFactory.java | 40 +
.../security/ThreadLocalSSLSocketFactory.java | 186 +
.../activities/wsdl/wss4j/T2WSDoAllSender.java | 231 +
.../wsdl/xmlsplitter/AddXMLSplitterEdit.java | 290 +
.../xmlsplitter/XMLInputSplitterActivity.java | 186 +
.../XMLInputSplitterActivityFactory.java | 96 +
.../XMLInputSplitterHealthChecker.java | 65 +
.../xmlsplitter/XMLOutputSplitterActivity.java | 207 +
.../XMLOutputSplitterActivityFactory.java | 96 +
.../XMLOutputSplitterHealthChecker.java | 65 +
.../XMLSplitterConfigurationBean.java | 42 +
.../XMLSplitterConfigurationBeanBuilder.java | 205 +
...averna.t2.workflowmodel.health.HealthChecker | 4 +
.../spring/wsdl-activity-context-osgi.xml | 20 +
.../META-INF/spring/wsdl-activity-context.xml | 21 +
.../src/main/resources/schema.json | 39 +
.../src/main/resources/xml-splitter.schema.json | 80 +
.../wsdl/WSDLActivityFactoryTest.java | 64 +
.../t2/activities/wsdl/WSDLActivityTest.java | 148 +
.../t2/activities/wsdl/WSRFActivityTest.java | 226 +
.../wsdl/security/HTTPSConnectionsTest.java | 50 +
.../security/SecureServicesInvokerTest.java | 116 +
.../xmlsplitter/AddXMLSplitterEditTest.java | 136 +
.../XMLInputSplitterActivityTest.java | 88 +
.../XMLOutputSplitterActivityTest.java | 53 +
...XMLSplitterConfigurationBeanBuilderTest.java | 86 +
.../src/test/resources/log4j.properties | 8 +
.../wsrf/counterService/CounterService_.wsdl | 9 +
.../wsdl/wsrf/counterService/WS-Addressing.xsd | 121 +
.../wsdl/wsrf/counterService/WS-BaseFaults.xsd | 47 +
.../wsdl/wsrf/counterService/WS-BaseN.wsdl | 298 +
.../wsdl/wsrf/counterService/WS-BaseN.xsd | 50 +
.../counterService/WS-ResourceLifetime.wsdl | 117 +
.../wsrf/counterService/WS-ResourceLifetime.xsd | 26 +
.../counterService/WS-ResourceProperties.wsdl | 240 +
.../counterService/WS-ResourceProperties.xsd | 42 +
.../wsrf/counterService/counter_bindings.wsdl | 157 +
.../wsrf/counterService/counter_flattened.wsdl | 111 +
.../activities/wsdl/wsrf/counterService/xml.xsd | 105 +
taverna-wsdl-generic/pom.xml | 92 +
.../wsdl/parser/ArrayTypeDescriptor.java | 57 +
.../wsdl/parser/AttributeTypeDescriptor.java | 30 +
.../taverna/wsdl/parser/BaseTypeDescriptor.java | 32 +
.../wsdl/parser/ComplexTypeDescriptor.java | 72 +
.../sf/taverna/wsdl/parser/TypeDescriptor.java | 297 +
.../wsdl/parser/UnknownOperationException.java | 37 +
.../net/sf/taverna/wsdl/parser/WSDLParser.java | 936 +
.../net/sf/taverna/wsdl/parser/package.html | 5 +
.../taverna/wsdl/soap/AbstractBodyBuilder.java | 362 +
.../net/sf/taverna/wsdl/soap/BodyBuilder.java | 49 +
.../taverna/wsdl/soap/BodyBuilderFactory.java | 53 +
.../wsdl/soap/CyclicReferenceException.java | 49 +
.../taverna/wsdl/soap/EncodedBodyBuilder.java | 160 +
.../taverna/wsdl/soap/LiteralBodyBuilder.java | 237 +
.../sf/taverna/wsdl/soap/ObjectConverter.java | 159 +
.../soap/SOAPResponseEncodedMultiRefParser.java | 197 +
.../wsdl/soap/SOAPResponseEncodedParser.java | 191 +
.../wsdl/soap/SOAPResponseLiteralParser.java | 97 +
.../taverna/wsdl/soap/SOAPResponseParser.java | 61 +
.../wsdl/soap/SOAPResponseParserFactory.java | 108 +
.../SOAPResponsePrimitiveLiteralParser.java | 72 +
.../wsdl/soap/SOAPResponsePrimitiveParser.java | 100 +
.../sf/taverna/wsdl/soap/WSDLSOAPInvoker.java | 323 +
.../java/net/sf/taverna/wsdl/soap/package.html | 5 +
.../wsdl/xmlsplitter/XMLInputSplitter.java | 290 +
.../wsdl/xmlsplitter/XMLOutputSplitter.java | 212 +
.../XMLSplitterExecutionException.java | 34 +
.../XMLSplitterSerialisationHelper.java | 359 +
.../taverna/wsdl/parser/TypeDescriptorTest.java | 240 +
.../sf/taverna/wsdl/parser/WSDLParserTest.java | 295 +
.../sf/taverna/wsdl/parser/WSRFParserTest.java | 57 +
.../wsdl/soap/EncodedBodyBuilderTest.java | 108 +
.../wsdl/soap/LiteralBodyBuilderTest.java | 170 +
.../wsdl/soap/SOAPResponseEncodedTest.java | 97 +
.../wsdl/soap/SOAPResponseLiteralTest.java | 174 +
.../wsdl/soap/SOAPResponseMultiRefTest.java | 246 +
.../soap/SOAPResponseParserFactoryTest.java | 64 +
.../wsdl/testutils/LocationConstants.java | 32 +
.../taverna/wsdl/testutils/WSDLTestHelper.java | 51 +
.../wsdl/xmlsplitter/XMLInputSplitterTest.java | 95 +
.../wsdl/xmlsplitter/XMLOutputSplitterTest.java | 79 +
.../XMLSplitterSerialisationHelperTest.java | 137 +
.../getComplexWithInternalListResponse.xml | 1 +
.../src/test/resources/jws-splitter-input.xml | 76 +
.../src/test/resources/log4j.properties | 8 +
.../TAV-744/InstrumentServiceContextTypes.xsd | 12 +
.../parser/TAV-744/InstrumentServiceTypes.xsd | 12 +
.../wsdl/parser/TAV-744/InstrumentService_.wsdl | 129 +
.../parser/TAV-744/InstrumentService__.wsdl | 9 +
.../TAV-744/InstrumentService_bindings.wsdl | 97 +
.../wsdl/parser/TAV-744/ServiceSecurity.wsdl | 72 +
.../wsdl/parser/TAV-744/WS-Addressing.xsd | 121 +
.../wsdl/parser/TAV-744/WS-BaseFaults.wsdl | 22 +
.../wsdl/parser/TAV-744/WS-BaseFaults.xsd | 47 +
.../taverna/wsdl/parser/TAV-744/WS-BaseN.wsdl | 298 +
.../sf/taverna/wsdl/parser/TAV-744/WS-BaseN.xsd | 50 +
.../parser/TAV-744/WS-ResourceLifetime.wsdl | 117 +
.../wsdl/parser/TAV-744/WS-ResourceLifetime.xsd | 26 +
.../parser/TAV-744/WS-ResourceProperties.wsdl | 240 +
.../parser/TAV-744/WS-ResourceProperties.xsd | 42 +
.../sf/taverna/wsdl/parser/TAV-744/security.xsd | 78 +
.../net/sf/taverna/wsdl/parser/TAV-744/xml.xsd | 105 +
.../wsrf/counterService/CounterService_.wsdl | 9 +
.../wsrf/counterService/WS-Addressing.xsd | 121 +
.../wsrf/counterService/WS-BaseFaults.xsd | 47 +
.../parser/wsrf/counterService/WS-BaseN.wsdl | 298 +
.../parser/wsrf/counterService/WS-BaseN.xsd | 50 +
.../counterService/WS-ResourceLifetime.wsdl | 117 +
.../wsrf/counterService/WS-ResourceLifetime.xsd | 26 +
.../counterService/WS-ResourceProperties.wsdl | 240 +
.../counterService/WS-ResourceProperties.xsd | 42 +
.../wsrf/counterService/counter_bindings.wsdl | 157 +
.../wsrf/counterService/counter_flattened.wsdl | 111 +
.../wsdl/parser/wsrf/counterService/xml.xsd | 105 +
.../testwsdls/CurrencyExchangeService.wsdl | 37 +
.../src/test/resources/testwsdls/GoViz.wsdl | 202 +
.../testwsdls/MyService-rpc-literal.wsdl | 392 +
.../src/test/resources/testwsdls/SBWReader.wsdl | 602 +
.../testwsdls/TestServices-rpcencoded.wsdl | 396 +
.../testwsdls/TestServices-unwrapped.wsdl | 434 +
.../src/test/resources/testwsdls/VSOi.wsdl | 305 +
.../src/test/resources/testwsdls/bind.wsdl | 354 +
.../test/resources/testwsdls/eutils/efetch.xsd | 118 +
.../resources/testwsdls/eutils/efetch_bio.xsd | 18079 +++++++++++++++++
.../resources/testwsdls/eutils/efetch_nlmc.xsd | 1021 +
.../resources/testwsdls/eutils/efetch_pmc.xsd | 5910 ++++++
.../testwsdls/eutils/efetch_pubmed.xsd | 359 +
.../resources/testwsdls/eutils/efetch_taxon.xsd | 150 +
.../test/resources/testwsdls/eutils/egquery.xsd | 60 +
.../test/resources/testwsdls/eutils/einfo.xsd | 95 +
.../test/resources/testwsdls/eutils/elink.xsd | 188 +
.../test/resources/testwsdls/eutils/esearch.xsd | 165 +
.../test/resources/testwsdls/eutils/espell.xsd | 60 +
.../resources/testwsdls/eutils/esummary.xsd | 85 +
.../test/resources/testwsdls/eutils/eutils.wsdl | 333 +
.../resources/testwsdls/eutils/eutils_lite.wsdl | 289 +
.../test/resources/testwsdls/jws-online.wsdl | 1001 +
.../test/resources/testwsdls/jws_online.wsdl | 1001 +
.../src/test/resources/testwsdls/ma.wsdl | 1901 ++
.../testwsdls/menagerie-complex-rpc.wsdl | 208 +
.../src/test/resources/testwsdls/prodoric.wsdl | 360 +
.../src/test/resources/testwsdls/whatizit.wsdl | 233 +
taverna-xpath-activity/pom.xml | 49 +
.../t2/activities/xpath/XPathActivity.java | 211 +
.../xpath/XPathActivityConfigurationBean.java | 145 +
.../activities/xpath/XPathActivityFactory.java | 92 +
.../xpath/XPathActivityHealthCheck.java | 38 +
.../xpath/XPathActivityHealthChecker.java | 139 +
.../taverna/t2/activities/xpath/XPathUtils.java | 80 +
...t2.workbench.report.explainer.VisitExplainer | 1 +
...averna.t2.workflowmodel.health.HealthChecker | 1 +
.../spring/xpath-activity-context-osgi.xml | 15 +
.../META-INF/spring/xpath-activity-context.xml | 12 +
.../src/main/resources/schema.json | 45 +
349 files changed, 71434 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e8df2d5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings/
+target/
+.svn
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..dff5f3a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1 @@
+language: java
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..8ff33d3
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,40 @@
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.taverna</groupId>
+ <artifactId>taverna-parent</artifactId>
+ <version>1-incubating-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.taverna.commonactivities</groupId>
+ <artifactId>taverna-common-activities</artifactId>
+ <version>2.1.0-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache Taverna Common Activities</name>
+ <properties>
+ <taverna.language.version>0.15.0-incubating-SNAPSHOT</taverna.language.version>
+ <taverna.osgi.version>0.2.0-incubating-SNAPSHOT</taverna.osgi.version>
+ <taverna.engine.version>3.1.0-incubating-SNAPSHOT</taverna.engine.version>
+ </properties>
+ <modules>
+ <module>taverna-beanshell-activity</module>
+ <module>taverna-external-tool-activity</module>
+ <module>taverna-interaction-activity</module>
+ <module>taverna-rest-activity</module>
+ <module>taverna-spreadsheet-import-activity</module>
+ <module>taverna-wsdl-activity</module>
+ <module>taverna-wsdl-generic</module>
+ <module>taverna-xpath-activity</module>
+ </modules>
+ <repositories>
+ <repository>
+ <id>taverna-incubating</id>
+ <name>Apache Taverna incubating Repository</name>
+ <url>http://repository.mygrid.org.uk/artifactory/incubator-snapshot-local/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots />
+ </repository>
+ </repositories>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/pom.xml b/taverna-beanshell-activity/pom.xml
new file mode 100644
index 0000000..1654296
--- /dev/null
+++ b/taverna-beanshell-activity/pom.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.taverna.commonactivities</groupId>
+ <artifactId>taverna-common-activities</artifactId>
+ <version>2.1.0-incubating-SNAPSHOT</version>
+ </parent>
+ <artifactId>taverna-beanshell-activity</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Taverna Beanshell Activity</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Embed-Dependency>artifactId=bsh</Embed-Dependency>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-reference-api</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-workflowmodel-api</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.osgi</groupId>
+ <artifactId>taverna-app-configuration-api</artifactId>
+ <version>${taverna.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-activity-test-utils</artifactId>
+ <version>${taverna.engine.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-workflowmodel-impl</artifactId>
+ <version>${taverna.engine.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache-extras.beanshell</groupId>
+ <artifactId>bsh</artifactId>
+ <version>${bsh.version}</version>
+ </dependency>
+ </dependencies>
+
+<!-- See https://code.google.com/a/apache-extras.org/p/beanshell/issues/detail?id=6
+ TODO: Remove below <repository> once in Maven Central -->
+
+ <repositories>
+ <repository>
+ <id>bintray.beanshell</id>
+ <name>bintray</name>
+ <url>http://dl.bintray.com/beanshell/Beanshell</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivity.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivity.java b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivity.java
new file mode 100644
index 0000000..134d3fe
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivity.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.beanshell;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import net.sf.taverna.t2.activities.dependencyactivity.AbstractAsynchronousDependencyActivity;
+import net.sf.taverna.t2.reference.ErrorDocumentService;
+import net.sf.taverna.t2.reference.ReferenceService;
+import net.sf.taverna.t2.reference.ReferenceServiceException;
+import net.sf.taverna.t2.reference.T2Reference;
+import net.sf.taverna.t2.workflowmodel.OutputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import bsh.EvalError;
+import bsh.Interpreter;
+import bsh.TargetError;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * An Activity providing Beanshell functionality.
+ *
+ * @author David Withers
+ * @author Stuart Owen
+ * @author Alex Nenadic
+ */
+public class BeanshellActivity extends AbstractAsynchronousDependencyActivity {
+
+ public static final String URI = "http://ns.taverna.org.uk/2010/activity/beanshell";
+
+ protected BeanshellActivityConfigurationBean configurationBean;
+
+ private static Logger logger = Logger.getLogger(BeanshellActivity.class);
+
+ private Interpreter interpreter;
+
+ private static String CLEAR_COMMAND = "clear();";
+
+ private JsonNode json;
+
+ public BeanshellActivity(ApplicationConfiguration applicationConfiguration) {
+ super(applicationConfiguration);
+ createInterpreter();
+ }
+
+ @Override
+ public JsonNode getConfiguration() {
+ return json;
+ }
+
+ @Override
+ public void configure(JsonNode json) {
+ this.json = json;
+ checkGranularDepths();
+ }
+
+ /**
+ * Creates the interpreter required to run the beanshell script, and assigns
+ * the correct classloader setting according to the
+ */
+ private void createInterpreter() {
+ interpreter = new Interpreter();
+ }
+
+ /**
+ * As the Beanshell activity currently only can output values at the
+ * specified depth, the granular depths should always be equal to the actual
+ * depth.
+ * <p>
+ * Workflow definitions created with Taverna 2.0b1 would not honour this and
+ * always set the granular depth to 0.
+ * <p>
+ * This method modifies the granular depths to be equal to the depths.
+ */
+ protected void checkGranularDepths() {
+ for (OutputPort outputPort : getOutputPorts()) {
+ if (outputPort.getGranularDepth() != outputPort.getDepth()) {
+ logger.warn("Replacing granular depth of port "
+ + outputPort.getName());
+ // outputPort.setGranularDepth(outputPort.getDepth());
+ }
+ }
+ }
+
+ public ActivityInputPort getInputPort(String name) {
+ for (ActivityInputPort port : getInputPorts()) {
+ if (port.getName().equals(name)) {
+ return port;
+ }
+ }
+ return null;
+ }
+
+ private void clearInterpreter() {
+ try {
+ interpreter.eval(CLEAR_COMMAND);
+ } catch (EvalError e) {
+ logger.error("Could not clear the interpreter", e);
+ }
+ }
+
+ @Override
+ public void executeAsynch(final Map<String, T2Reference> data,
+ final AsynchronousActivityCallback callback) {
+ callback.requestRun(new Runnable() {
+
+ public void run() {
+
+ // Workflow run identifier (needed when classloader sharing is
+ // set to 'workflow').
+ String procID = callback.getParentProcessIdentifier();
+ String workflowRunID;
+ if (procID.contains(":")) {
+ workflowRunID = procID.substring(0, procID.indexOf(':'));
+ } else {
+ workflowRunID = procID; // for tests, will be an empty
+ // string
+ }
+
+ synchronized (interpreter) {
+
+ // Configure the classloader for executing the Beanshell
+ if (classLoader == null) {
+ try {
+ classLoader = findClassLoader(json, workflowRunID);
+ interpreter.setClassLoader(classLoader);
+ } catch (RuntimeException rex) {
+ String message = "Unable to obtain the classloader for Beanshell service";
+ callback.fail(message, rex);
+ return;
+ }
+ }
+
+ ReferenceService referenceService = callback.getContext()
+ .getReferenceService();
+
+ Map<String, T2Reference> outputData = new HashMap<String, T2Reference>();
+
+ clearInterpreter();
+ try {
+ // set inputs
+ for (String inputName : data.keySet()) {
+ ActivityInputPort inputPort = getInputPort(inputName);
+ Object input = referenceService.renderIdentifier(
+ data.get(inputName),
+ inputPort.getTranslatedElementClass(),
+ callback.getContext());
+ inputName = sanatisePortName(inputName);
+ interpreter.set(inputName, input);
+ }
+ // run
+ interpreter.eval(json.get("script").asText());
+ // get outputs
+ for (OutputPort outputPort : getOutputPorts()) {
+ String name = outputPort.getName();
+ Object value = interpreter.get(name);
+ if (value == null) {
+ ErrorDocumentService errorDocService = referenceService
+ .getErrorDocumentService();
+ value = errorDocService.registerError(
+ "No value produced for output variable "
+ + name, outputPort.getDepth(),
+ callback.getContext());
+ }
+ outputData.put(name, referenceService.register(
+ value, outputPort.getDepth(), true,
+ callback.getContext()));
+ }
+ callback.receiveResult(outputData, new int[0]);
+ } catch (EvalError e) {
+ logger.error(e);
+ try {
+ int lineNumber = e.getErrorLineNumber();
+
+ callback.fail("Line " + lineNumber + ": "
+ + determineMessage(e));
+ } catch (NullPointerException e2) {
+ callback.fail(determineMessage(e));
+ }
+ } catch (ReferenceServiceException e) {
+ callback.fail(
+ "Error accessing beanshell input/output data for "
+ + this, e);
+ }
+ clearInterpreter();
+ }
+ }
+
+ /**
+ * Removes any invalid characters from the port name. For example,
+ * xml-text would become xmltext.
+ *
+ * @param name
+ * @return
+ */
+ private String sanatisePortName(String name) {
+ String result = name;
+ if (Pattern.matches("\\w++", name) == false) {
+ result = "";
+ for (char c : name.toCharArray()) {
+ if (Character.isLetterOrDigit(c) || c == '_') {
+ result += c;
+ }
+ }
+ }
+ return result;
+ }
+ });
+
+ }
+
+ private static String determineMessage(Throwable e) {
+ if (e instanceof TargetError) {
+ Throwable t = ((TargetError) e).getTarget();
+ if (t != null) {
+ return t.getClass().getCanonicalName() + ": "
+ + determineMessage(t);
+ }
+ }
+ Throwable cause = e.getCause();
+ if (cause != null) {
+ return determineMessage(cause);
+ }
+ return e.getMessage();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityConfigurationBean.java b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityConfigurationBean.java
new file mode 100644
index 0000000..8a5f06f
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityConfigurationBean.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.beanshell;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.taverna.t2.activities.dependencyactivity.DependencyActivityConfigurationBean;
+import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationBean;
+import net.sf.taverna.t2.workflowmodel.processor.config.ConfigurationProperty;
+
+/**
+ * A configuration bean specific to a Beanshell activity; provides details
+ * about the Beanshell script and its local and artifact dependencies.
+ *
+ * @author Stuart Owen
+ * @author David Withers
+ * @author Alex Nenadic
+ */
+@ConfigurationBean(uri = BeanshellActivity.URI + "#Config")
+public class BeanshellActivityConfigurationBean extends DependencyActivityConfigurationBean {
+
+ private String script;
+
+ public BeanshellActivityConfigurationBean() {
+ super();
+ this.script = "";
+ }
+
+ /**
+ * @return the Beanshell script
+ */
+ public String getScript() {
+ return script;
+ }
+
+ /**
+ * @param script the Beanshell script
+ */
+ @ConfigurationProperty(name = "script", label = "Beanshell Script", description = "The beanshell script to be executed")
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+ ///////////// From old code //////////
+ @Deprecated
+ private List<String> dependencies = new ArrayList<String>();
+
+ /**
+ * Returns the dependencies.
+ *
+ * @return the dependencies
+ */
+ public List<String> getDependencies() {
+ return dependencies;
+ }
+
+ /**
+ * Sets the dependencies.
+ *
+ * @param dependencies the new dependencies
+ */
+ public void setDependencies(List<String> dependencies) {
+ this.dependencies = dependencies;
+ }
+ ///////////// From old code //////////
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactory.java b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactory.java
new file mode 100644
index 0000000..c1b0e5d
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactory.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.beanshell;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * An {@link ActivityFactory} for creating <code>BeanshellActivity</code>.
+ *
+ * @author David Withers
+ */
+public class BeanshellActivityFactory implements ActivityFactory {
+
+ private ApplicationConfiguration applicationConfiguration;
+
+ @Override
+ public BeanshellActivity createActivity() {
+ return new BeanshellActivity(applicationConfiguration);
+ }
+
+ @Override
+ public URI getActivityType() {
+ return URI.create(BeanshellActivity.URI);
+ }
+
+ @Override
+ public JsonNode getActivityConfigurationSchema() {
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ return objectMapper.readTree(getClass().getResource("/schema.json"));
+ } catch (IOException e) {
+ return objectMapper.createObjectNode();
+ }
+ }
+
+ public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
+ this.applicationConfiguration = applicationConfiguration;
+ }
+
+ @Override
+ public Set<ActivityInputPort> getInputPorts(JsonNode configuration) {
+ return new HashSet<>();
+ }
+
+ @Override
+ public Set<ActivityOutputPort> getOutputPorts(JsonNode configuration) {
+ return new HashSet<>();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthChecker.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthChecker.java b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthChecker.java
new file mode 100644
index 0000000..9913d77
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthChecker.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.beanshell;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import net.sf.taverna.t2.activities.dependencyactivity.AbstractAsynchronousDependencyActivity.FileExtFilter;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.visit.VisitReport.Status;
+import net.sf.taverna.t2.workflowmodel.Processor;
+import net.sf.taverna.t2.workflowmodel.health.HealthCheck;
+import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
+import bsh.ParseException;
+import bsh.Parser;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class BeanshellActivityHealthChecker implements HealthChecker<BeanshellActivity> {
+
+ public boolean canVisit(Object subject) {
+ return (subject!=null && subject instanceof BeanshellActivity);
+ }
+
+ public VisitReport visit(BeanshellActivity activity, List<Object> ancestors) {
+ Object subject = (Processor) VisitReport.findAncestor(ancestors, Processor.class);
+ if (subject == null) {
+ // Fall back to using the activity itself as the subject of the reports
+ subject = activity;
+ }
+ List<VisitReport> reports = new ArrayList<VisitReport>();
+
+ String script = activity.getConfiguration().get("script").textValue();
+ if (! script.trim().endsWith(";")) {
+ /** Missing ; on last line is not allowed by Parser,
+ * but is allowed by Interpreter.eval() used at runtime
+ */
+ script = script + ";";
+ }
+ Parser parser = new Parser(new StringReader(script));
+ try {
+ while (!parser.Line());
+ reports.add(new VisitReport(HealthCheck.getInstance(), subject, "Script OK", HealthCheck.NO_PROBLEM, Status.OK));
+ } catch (ParseException e) {
+ VisitReport report = new VisitReport(HealthCheck.getInstance(), subject ,e.getMessage(), HealthCheck.INVALID_SCRIPT, Status.SEVERE);
+ report.setProperty("exception", e);
+ reports.add(report);
+ }
+
+ // Check if we can find all the Beanshell's dependencies
+ if (activity.getConfiguration().has("localDependency")) {
+ LinkedHashSet<String> localDependencies = new LinkedHashSet<>();
+ for (JsonNode localDependency : activity.getConfiguration().get("localDependency")) {
+ localDependencies.add(localDependency.textValue());
+ }
+
+ String[] jarArray = activity.libDir.list(new FileExtFilter(".jar"));
+ if (jarArray != null) {
+ List<String> jarFiles = Arrays.asList(jarArray); // URLs of all jars found in the lib directory
+ for (String jar : localDependencies) {
+ if (jarFiles.contains(jar)){
+ localDependencies.remove(jar);
+ }
+ }
+ }
+ if (localDependencies.isEmpty()){ // all dependencies found
+ reports.add(new VisitReport(HealthCheck.getInstance(), subject, "Beanshell dependencies found", HealthCheck.NO_PROBLEM, Status.OK));
+ }
+ else{
+ VisitReport vr = new VisitReport(HealthCheck.getInstance(), subject, "Beanshell dependencies missing", HealthCheck.MISSING_DEPENDENCY, Status.SEVERE);
+ vr.setProperty("dependencies", localDependencies);
+ vr.setProperty("directory", activity.libDir);
+ reports.add(vr);
+ }
+
+ }
+ Status status = VisitReport.getWorstStatus(reports);
+ VisitReport report = new VisitReport(HealthCheck.getInstance(), subject, "Beanshell report", HealthCheck.NO_PROBLEM,
+ status, reports);
+
+ return report;
+
+ }
+
+ public boolean isTimeConsuming() {
+ return false;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/package.html
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/package.html b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/package.html
new file mode 100644
index 0000000..8b6e7a5
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/java/net/sf/taverna/t2/activities/beanshell/package.html
@@ -0,0 +1,3 @@
+<body>
+Contains the activity classes required to include String constants within a DataFlow.
+</body>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker b/taverna-beanshell-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
new file mode 100644
index 0000000..3fbf5a8
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
@@ -0,0 +1 @@
+net.sf.taverna.t2.activities.beanshell.BeanshellActivityHealthChecker
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context-osgi.xml b/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context-osgi.xml
new file mode 100644
index 0000000..b98c9e4
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context-osgi.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <service ref="beanshellActivityHealthChecker" interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
+
+ <service ref="beanshellActivityFactory" interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
+
+ <reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
+
+</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context.xml
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context.xml b/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context.xml
new file mode 100644
index 0000000..c6cc552
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/resources/META-INF/spring/beanshell-activity-context.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="beanshellActivityHealthChecker" class="net.sf.taverna.t2.activities.beanshell.BeanshellActivityHealthChecker" />
+
+ <bean id="beanshellActivityFactory" class="net.sf.taverna.t2.activities.beanshell.BeanshellActivityFactory">
+ <property name="applicationConfiguration" ref="applicationConfiguration" />
+ </bean>
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/main/resources/schema.json
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/main/resources/schema.json b/taverna-beanshell-activity/src/main/resources/schema.json
new file mode 100644
index 0000000..fcf07b2
--- /dev/null
+++ b/taverna-beanshell-activity/src/main/resources/schema.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "http://json-schema.org/draft-03/schema#",
+ "id": "http://ns.taverna.org.uk/2010/activity/beanshell.schema.json",
+ "title": "Beanshell activity configuration",
+ "type": "object",
+ "extends" : "http://ns.taverna.org.uk/2010/activity/dependency.schema.json",
+ "properties": {
+ "@context": {
+ "description": "JSON-LD context for interpreting the configuration as RDF",
+ "required": true,
+ "enum": ["http://ns.taverna.org.uk/2010/activity/beanshell.context.json"]
+ },
+ "script": {
+ "title": "Beanshell Script",
+ "description": "The beanshell script to be executed",
+ "type": "string",
+ "required": true,
+ "default": ""
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactoryTest.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactoryTest.java b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactoryTest.java
new file mode 100644
index 0000000..32290ac
--- /dev/null
+++ b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityFactoryTest.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.beanshell;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URI;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author David Withers
+ */
+public class BeanshellActivityFactoryTest {
+
+ private BeanshellActivityFactory factory;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ factory = new BeanshellActivityFactory();
+ }
+
+ /**
+ * Test method for {@link net.sf.taverna.t2.activities.beanshell.BeanshellActivityFactory#createActivity()}.
+ */
+ @Test
+ public void testCreateActivity() {
+ BeanshellActivity createActivity = factory.createActivity();
+ assertNotNull(createActivity);
+ }
+
+ /**
+ * Test method for {@link net.sf.taverna.t2.activities.beanshell.BeanshellActivityFactory#getActivityType()}.
+ */
+ @Test
+ public void testGetActivityURI() {
+ assertEquals(URI.create(BeanshellActivity.URI), factory.getActivityType());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthCheckerTest.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthCheckerTest.java b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthCheckerTest.java
new file mode 100644
index 0000000..0b4b5ff
--- /dev/null
+++ b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityHealthCheckerTest.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.beanshell;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.taverna.t2.activities.testutils.ActivityInvoker;
+import net.sf.taverna.t2.visit.VisitReport;
+import net.sf.taverna.t2.visit.VisitReport.Status;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * BeanshellActivityHealthChecker tests
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class BeanshellActivityHealthCheckerTest {
+
+ private Edits edits = new EditsImpl();
+
+ private ObjectNode configuration;
+
+ @Before
+ public void setup() throws Exception {
+ configuration = JsonNodeFactory.instance.objectNode();
+ configuration.put("classLoaderSharing", "workflow");
+ }
+
+ @Test
+ public void oneLinerNoSemicolon() throws Exception {
+ BeanshellActivity activity = new BeanshellActivity(null);
+ configuration.put("script", "a = 5+3");
+ // Notice lack of ;
+ activity.configure(configuration);
+
+ Map<String,Object> inputs = new HashMap<String, Object>();
+ Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>();
+ ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs);
+
+ BeanshellActivityHealthChecker healthChecker = new BeanshellActivityHealthChecker();
+ assertTrue(healthChecker.canVisit(activity));
+ ArrayList<Object> ancestors = new ArrayList<Object>();
+
+ ancestors.add(edits.createProcessor("beanie"));
+ VisitReport visit = healthChecker.visit(activity, ancestors);
+ assertEquals(Status.OK, visit.getStatus());
+ }
+
+ @Test
+ public void oneLiner() throws Exception {
+ BeanshellActivity activity = new BeanshellActivity(null);
+ configuration.put("script", "System.out.println(\"Hello\");");
+ activity.configure(configuration);
+
+ Map<String,Object> inputs = new HashMap<String, Object>();
+ Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>();
+ ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs);
+
+ BeanshellActivityHealthChecker healthChecker = new BeanshellActivityHealthChecker();
+ assertTrue(healthChecker.canVisit(activity));
+ ArrayList<Object> ancestors = new ArrayList<Object>();
+
+ ancestors.add(edits.createProcessor("beanie"));
+ VisitReport visit = healthChecker.visit(activity, ancestors);
+ assertEquals(Status.OK, visit.getStatus());
+ }
+
+ @Test
+ public void threeLines() throws Exception {
+ BeanshellActivity activity = new BeanshellActivity(null);
+ configuration.put("script", "if (2>1) {\n" +
+ " new Integer(4);\n" +
+ "}");
+ activity.configure(configuration);
+
+ Map<String,Object> inputs = new HashMap<String, Object>();
+ Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>();
+ ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs);
+
+ BeanshellActivityHealthChecker healthChecker = new BeanshellActivityHealthChecker();
+ assertTrue(healthChecker.canVisit(activity));
+ ArrayList<Object> ancestors = new ArrayList<Object>();
+
+ ancestors.add(edits.createProcessor("beanie"));
+ VisitReport visit = healthChecker.visit(activity, ancestors);
+ assertEquals(Status.OK, visit.getStatus());
+
+
+
+ }
+
+ @Test
+ public void invalidScript() throws Exception {
+ BeanshellActivity activity = new BeanshellActivity(null);
+ configuration.put("script", "invalid script 5 +");
+ activity.configure(configuration);
+
+ Map<String,Object> inputs = new HashMap<String, Object>();
+ Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>();
+ try {
+ ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs);
+ fail("Script should not be valid");
+ } catch (RuntimeException ex) {
+ // expected to fail
+ }
+
+
+ BeanshellActivityHealthChecker healthChecker = new BeanshellActivityHealthChecker();
+ assertTrue(healthChecker.canVisit(activity));
+ ArrayList<Object> ancestors = new ArrayList<Object>();
+
+ ancestors.add(edits.createProcessor("beanie"));
+ VisitReport visit = healthChecker.visit(activity, ancestors);
+ assertEquals(Status.SEVERE, visit.getStatus());
+ }
+
+ @Test
+ public void strangeWhitespace() throws Exception {
+ BeanshellActivity activity = new BeanshellActivity(null);
+ configuration.put("script", "b = \"fish\";\n" +
+ "a = 2+3\n" +
+ "\n" +
+ "\n" +
+ " +5 ");
+ // Notice lots of whitespace, but still valid
+ activity.configure(configuration);
+
+ Map<String,Object> inputs = new HashMap<String, Object>();
+ Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>();
+ ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs);
+
+ BeanshellActivityHealthChecker healthChecker = new BeanshellActivityHealthChecker();
+ assertTrue(healthChecker.canVisit(activity));
+ ArrayList<Object> ancestors = new ArrayList<Object>();
+
+ ancestors.add(edits.createProcessor("beanie"));
+ VisitReport visit = healthChecker.visit(activity, ancestors);
+ System.out.println(visit);
+ assertEquals(Status.OK, visit.getStatus());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityTest.java b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityTest.java
new file mode 100644
index 0000000..8d724a5
--- /dev/null
+++ b/taverna-beanshell-activity/src/test/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivityTest.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.beanshell;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.taverna.t2.activities.testutils.ActivityInvoker;
+import net.sf.taverna.t2.workflowmodel.AbstractPort;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
+import net.sf.taverna.t2.workflowmodel.processor.activity.impl.ActivityInputPortImpl;
+import net.sf.taverna.t2.workflowmodel.processor.activity.impl.ActivityOutputPortImpl;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * Beanshell Activity Tests
+ * @author Stuart Owen
+ *
+ */
+public class BeanshellActivityTest {
+
+ private ObjectNode configuration;
+
+ @Before
+ public void setup() throws Exception {
+ configuration = JsonNodeFactory.instance.objectNode();
+ configuration.put("classLoaderSharing", "workflow");
+ }
+
+ /**
+ * Tests a simple script (String output = input + "_returned") to ensure the script is invoked correctly.
+ * @throws Exception
+ */
+ @Test
+ public void simpleScript() throws Exception {
+ BeanshellActivity activity = new BeanshellActivity(null);
+ Edits edits = new EditsImpl();
+ edits.getAddActivityInputPortEdit(activity, new ActivityInputPortImpl("input", 0, false, null, String.class)).doEdit();
+ edits.getAddActivityOutputPortEdit(activity, new ActivityOutputPortImpl("output", 0, 0)).doEdit();
+
+ configuration.put("script", "String output = input + \"_returned\";");
+
+ activity.configure(configuration);
+ assertEquals("There should be 1 input port",1,activity.getInputPorts().size());
+ assertEquals("There should be 1 output port",1,activity.getOutputPorts().size());
+
+ assertEquals("The input should be called input", "input",((AbstractPort)activity.getInputPorts().toArray()[0]).getName());
+ assertEquals("The output should be called output", "output",((AbstractPort)activity.getOutputPorts().toArray()[0]).getName());
+
+ Map<String,Object> inputs = new HashMap<String, Object>();
+ inputs.put("input", "aString");
+ Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>();
+ expectedOutputs.put("output", String.class);
+
+ Map<String,Object> outputs = ActivityInvoker.invokeAsyncActivity(activity, inputs, expectedOutputs);
+ assertTrue("there should be an output named output",outputs.containsKey("output"));
+ assertEquals("output should have the value aString_returned","aString_returned",outputs.get("output"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-external-tool-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/pom.xml b/taverna-external-tool-activity/pom.xml
new file mode 100644
index 0000000..49ddfbd
--- /dev/null
+++ b/taverna-external-tool-activity/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.taverna.commonactivities</groupId>
+ <artifactId>taverna-common-activities</artifactId>
+ <version>2.1.0-incubating-SNAPSHOT</version>
+ </parent>
+ <artifactId>taverna-external-tool-activity</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Taverna External Tool Activity</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-reference-api</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-workflowmodel-api</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-credential-manager</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-reference-types</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.osgi</groupId>
+ <artifactId>taverna-app-configuration-api</artifactId>
+ <version>${taverna.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jdom</groupId>
+ <artifactId>com.springsource.org.jdom</artifactId>
+ <version>${jdom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons.io.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>com.springsource.org.apache.commons.lang</artifactId>
+ <version>${commons.lang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openengsb.wrapped</groupId>
+ <artifactId>com.jcraft.jsch-all</artifactId>
+ <version>${jsch.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jsch</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jzlib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!--dependency>
+ <groupId>com.jcraft.jsch</groupId>
+ <artifactId>com.springsource.com.jcraft.jsch</artifactId>
+ <version>${jsch.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-activity-test-utils</artifactId>
+ <version>${taverna.engine.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/AskUserForPwPopup.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/AskUserForPwPopup.java b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/AskUserForPwPopup.java
new file mode 100644
index 0000000..e2ae7e1
--- /dev/null
+++ b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/AskUserForPwPopup.java
@@ -0,0 +1,77 @@
+/* Part of the KnowARC Janitor Use-case processor for taverna
+ * written 2007-2010 by Hajo Nils Krabbenhoeft and Steffen Moeller
+ * University of Luebeck, Institute for Neuro- and Bioinformatics
+ * University of Luebeck, Institute for Dermatolgy
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This package is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this package; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package de.uni_luebeck.inb.knowarc.gui;
+
+import javax.swing.JOptionPane;
+
+import de.uni_luebeck.inb.knowarc.usecases.invocation.AskUserForPw;
+import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNode;
+
+public final class AskUserForPwPopup implements AskUserForPw {
+ private SshNode ret;
+ private String pw, pp, kf, us;
+
+ public static String ask(String message, String title) {
+ return (String) JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE, null, null, "");
+ }
+
+ public static boolean askYN(String message, String title) {
+ return JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION;
+ }
+
+ public String getPassword() {
+ getUsername();
+ if (pw != null)
+ return pw;
+ pw = ask("Please enter your password for " + us + " @ " + ret.getHost(), us + " @ " + ret.getHost());
+ return pw;
+ }
+
+ public String getPassphrase() {
+ getUsername();
+ if (pp != null)
+ return pp;
+ pp = ask("Please enter your passphrase for " + kf + " used for " + us + " @ " + ret.getHost(), us + " @ " + ret.getHost());
+ return pp;
+ }
+
+ public String getKeyfile() {
+ getUsername();
+ if (kf != null)
+ return kf;
+ kf = ask("Please enter the keyfile for " + us + " @ " + ret.getHost(), us + " @ " + ret.getHost());
+ return kf;
+ }
+
+ public String getUsername() {
+ if (us != null)
+ return us;
+ us = ask("Please enter the username for " + ret.getHost(), "Username for " + ret.getHost());
+ return us;
+ }
+
+ public void setSshNode(SshNode sshNode) {
+ this.ret = sshNode;
+ }
+
+ public void authenticationSucceeded() {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/PleaseWaitDialog.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/PleaseWaitDialog.java b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/PleaseWaitDialog.java
new file mode 100755
index 0000000..a6bf707
--- /dev/null
+++ b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/gui/PleaseWaitDialog.java
@@ -0,0 +1,75 @@
+/* Part of the KnowARC Janitor Use-case processor for taverna
+ * written 2007-2010 by Hajo Nils Krabbenhoeft and Steffen Moeller
+ * University of Luebeck, Institute for Neuro- and Bioinformatics
+ * University of Luebeck, Institute for Dermatolgy
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This package is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this package; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package de.uni_luebeck.inb.knowarc.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+
+public class PleaseWaitDialog extends JDialog {
+ private static final long serialVersionUID = 1L;
+
+ static PleaseWaitDialog instance = new PleaseWaitDialog();
+
+ public class WaitMessage{
+ public WaitMessage() {
+ }
+
+ String str;
+ public void set(String newstr) {
+ synchronized (PleaseWaitDialog.instance) {
+ if(this.str != null && this.str.equals(newstr)) return;
+ if(this.str != null) messages.remove(this.str);
+ this.str = newstr;
+ if(this.str != null) messages.add(this.str);
+ }
+ updateDialog();
+ }
+ public void done() {
+ set(null);
+ }
+ }
+
+ private void updateDialog() {
+ synchronized (PleaseWaitDialog.instance) {
+ if(messages.size() > 0) this.setVisible(true);
+ else this.setVisible(false);
+ String t = "";
+ for (String cur : messages) {
+ t += cur + "<br>";
+ }
+ l.setText("<html>"+t+"</html>");
+ }
+ }
+
+ List<String> messages = new ArrayList<String>();
+
+ JLabel l;
+ private PleaseWaitDialog() {
+ this.setAlwaysOnTop(true);
+ this.setTitle("Please wait");
+ l = new JLabel("");
+ this.add(l);
+ this.setSize(400, 100);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/390c286b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/usecases/RuntimeEnvironment.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/usecases/RuntimeEnvironment.java b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/usecases/RuntimeEnvironment.java
new file mode 100644
index 0000000..ea49079
--- /dev/null
+++ b/taverna-external-tool-activity/src/main/java/de/uni_luebeck/inb/knowarc/usecases/RuntimeEnvironment.java
@@ -0,0 +1,253 @@
+/* Part of the KnowARC Janitor Use-case processor for taverna
+ * written 2007-2010 by Hajo Nils Krabbenhoeft and Steffen Moeller
+ * University of Luebeck, Institute for Neuro- and Bioinformatics
+ * University of Luebeck, Institute for Dermatolgy
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This package is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this package; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package de.uni_luebeck.inb.knowarc.usecases;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Representation of information about a single runtime environment. It is used
+ * to decide if one runtime environment is possibly compatible with another one
+ * for the selection of queues to commit to.
+ *
+ * To experiment/test these functions, run the following java -cp
+ * target/taverna-knowarc-processor-0.1.7.jar
+ * de.uni_luebeck.janitor.ldap.RuntimeEnvironment compare bla-1 foo-1 java -cp
+ * target/taverna-knowarc-processor-0.1.7.jar
+ * de.uni_luebeck.janitor.ldap.RuntimeEnvironment compare bla-1 bla-2 java -cp
+ * target/taverna-knowarc-processor-0.1.7.jar
+ * de.uni_luebeck.janitor.ldap.RuntimeEnvironment compare bla-1.2 bla-1
+ *
+ * @author Steffen Moeller
+ */
+@SuppressWarnings("unchecked")
+public class RuntimeEnvironment implements Comparable {
+
+ private static Logger logger = Logger.getLogger(RuntimeEnvironment.class);
+
+
+ /**
+ * Unique identification of the runtime environment - the full name
+ */
+ protected String id;
+
+ /**
+ * Accessor function for the complete identifier of the runtime environment
+ */
+ public String getID() {
+ return id;
+ }
+
+ protected String name;
+
+ /**
+ * Accessor function for the RE's name
+ */
+ public String getName() {
+ return name;
+ }
+
+ protected String version;
+
+ /**
+ * Accessfor function for the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * for those busy fellows who don't have the time to convert the String into
+ * a RuntimeEnvironment object.
+ *
+ * @author Steffen Moeller
+ */
+ public boolean atLeastAsCapableAs(String s) {
+ RuntimeEnvironment tmpRE = new RuntimeEnvironment(s);
+ return this.atLeastAsCapableAs(tmpRE);
+ }
+
+ /**
+ * Indicates if a runtime environment has the same name, and if so, if the
+ * given RE has the same or a later version.
+ *
+ * @author Steffen Moeller
+ */
+ public boolean atLeastAsCapableAs(RuntimeEnvironment re) {
+ if (!name.equals(re.name))
+ return false;
+ int c = compareVersions(getVersion(), re.getVersion());
+ if (c >= 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Indicates if this runtimeEnvironment is the same version or later as any
+ * in that list.
+ *
+ * @author Steffen Moeller
+ */
+ public boolean atLeastAsCapableAsAnyOf(Iterable<RuntimeEnvironment> res) {
+ boolean compatibleOneFound = false;
+ Iterator<RuntimeEnvironment> i = res.iterator();
+ while (i.hasNext() && !compatibleOneFound) {
+ RuntimeEnvironment r = i.next();
+ compatibleOneFound = atLeastAsCapableAs(r);
+ }
+ return compatibleOneFound;
+ }
+
+ /**
+ * Indicates if any of the runtime environments listed is the same version
+ * as this or later.
+ *
+ * @author Steffen Moeller
+ */
+ public boolean isInferiorToAtLeastOneIn(Iterable<RuntimeEnvironment> res) {
+ boolean compatibleOneFound = false;
+ Iterator<RuntimeEnvironment> i = res.iterator();
+ while (i.hasNext() && !compatibleOneFound) {
+ RuntimeEnvironment r = i.next();
+ compatibleOneFound = r.atLeastAsCapableAs(this);
+ }
+ return compatibleOneFound;
+ }
+
+ /**
+ * Parses a string as commonly presented by the infosystem
+ *
+ * @author Steffen Moeller
+ */
+ public RuntimeEnvironment(String raw) {
+ id = raw;
+ int dashpos = raw.indexOf("-");
+ if (-1 == dashpos) {
+ version = "";
+ name = raw;
+ } else {
+ name = raw.substring(0, dashpos);
+ if (dashpos + 1 <= raw.length()) {
+ version = raw.substring(dashpos + 1, raw.length());
+ } else {
+ version = "";
+ }
+ }
+ }
+
+ /**
+ * to make it behave like a string at time, as it was originally implemented
+ */
+ @Override
+ public String toString() {
+ return id;
+ }
+
+ /**
+ * Implementation of Comparable interface. It comes handy albeit this
+ * function says nothing about the compatibility of two runtime environments
+ * unless their names are identical and the relation of the constraint was
+ * taken into account. It just sorts them in lists.
+ */
+ public int compareTo(Object o) throws ClassCastException {
+ RuntimeEnvironment r = (RuntimeEnvironment) o;
+ if (getName().equals(r.getName())) {
+ return RuntimeEnvironment.compareVersions(getVersion(), r.getVersion());
+ } else {
+ return id.compareTo(r.getID());
+ }
+ }
+
+ /**
+ * FIXME: For the sake of simplicity, this implementation makes an error in
+ * treating . and - in the versions equally. Versions, if numerical, are
+ * treated numerically. Otherwise it is lexicographical, which is error
+ * prone, though. Should the 'Scanner' class should be tapped into?
+ *
+ * @author Steffen Moeller
+ */
+ public static int compareVersions(String a, String b) {
+
+ // null pointer exceptions are not risked .. we are nice
+ if (null == a)
+ a = "";
+ if (null == b)
+ b = "";
+
+ // catching the dumb case first
+ if (a.equals(b))
+ return 0;
+
+ List as = Arrays.asList(a.split("[.-]"));
+ List bs = Arrays.asList(b.split("[.-]"));
+
+ // both lists have the empty element as members at least
+ Iterator aIterator = as.iterator();
+ Iterator bIterator = bs.iterator();
+
+ while (aIterator.hasNext()) {
+ String aa = (String) aIterator.next();
+ if (!bIterator.hasNext()) {
+ // a is longer while equal so far
+ return 1; // a > b
+ }
+ String bb = (String) bIterator.next();
+ if (!aa.equals(bb)) {
+ // a and b differ
+ try {
+ Integer aInt = Integer.parseInt(aa);
+ Integer bInt = Integer.parseInt(bb);
+ return aInt.compareTo(bInt);
+ } catch (Exception e) {
+ return aa.compareTo(bb);
+ }
+ }
+ }
+ if (bIterator.hasNext()) {
+ // b is longer while equal so far
+ return -1; // a < b
+ }
+ return 0; // a == b
+ }
+
+ /**
+ * For testing purposes
+ */
+ public static void main(String argv[]) {
+ if ("compare".equals(argv[0])) {
+ RuntimeEnvironment r1 = new RuntimeEnvironment(argv[1]);
+ RuntimeEnvironment r2 = new RuntimeEnvironment(argv[2]);
+ logger.info("r1.getName(): " + r1.getName());
+ logger.info("r1.getVersion(): " + r1.getVersion());
+ logger.info("r2.getName(): " + r2.getName());
+ logger.info("r2.getVersion(): " + r2.getVersion());
+ logger.info("r1.atLeastAsCapableAs(r2): " + String.valueOf(r1.atLeastAsCapableAs(r2)));
+ } else {
+ logger.info("Don't know how to '" + argv[0] + "'");
+ }
+ }
+
+}