You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/24 11:45:23 UTC
[1/5] incubator-taverna-commandline git commit: package name changes
Repository: incubator-taverna-commandline
Updated Branches:
refs/heads/master 7db5214de -> 9965dffe9
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/src/test/resources/workflows/xmlSplitter/xmlSplitter.t2flow
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/src/test/resources/workflows/xmlSplitter/xmlSplitter.t2flow b/taverna-commandline-tests/src/test/resources/workflows/xmlSplitter/xmlSplitter.t2flow
index bd0875d..10b592a 100644
--- a/taverna-commandline-tests/src/test/resources/workflows/xmlSplitter/xmlSplitter.t2flow
+++ b/taverna-commandline-tests/src/test/resources/workflows/xmlSplitter/xmlSplitter.t2flow
@@ -1,61 +1,61 @@
-<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="taverna-2.2.0"><dataflow id="52ddd8d4-d1fc-4b62-932a-288df52b77cf" role="top"><name>Workflow1</name><inputPorts><port><name>lastName</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="taverna-2.2.0"><dataflow id="52ddd8d4-d1fc-4b62-932a-288df52b77cf" role="top"><name>Workflow1</name><inputPorts><port><name>lastName</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.ExampleValue">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.ExampleValue">
<text>Smith</text>
</annotationBean>
<date>2011-02-17 10:48:23.657 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain></annotations></port><port><name>firstName</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain></annotations></port><port><name>firstName</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.ExampleValue">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.ExampleValue">
<text>John</text>
</annotationBean>
<date>2011-02-17 10:48:16.703 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain></annotations></port><port><name>age</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain></annotations></port><port><name>age</name><depth>0</depth><granularDepth>0</granularDepth><annotations><annotation_chain encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.ExampleValue">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.ExampleValue">
<text>John</text>
</annotationBean>
<date>2011-02-17 10:47:56.513 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain><annotation_chain encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain><annotation_chain encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.ExampleValue">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.ExampleValue">
<text>21</text>
</annotationBean>
<date>2011-02-17 10:48:30.905 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain></annotations></port></inputPorts><outputPorts><port><name>out</name><annotations /></port></outputPorts><processors><processor><name>personToString</name><inputPorts><port><name>parameters</name><depth>0</depth></port></inputPorts><outputPorts><port><name>parameters</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.wsdl.WSDLActivity</class><inputMap><map from="parameters" to="parameters" /></inputMap><outputMap><map from="parameters" to="parameters" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.wsdl.WSDLActivityConfigurationBean xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain></annotations></port></inputPorts><outputPorts><port><name>out</name><annotations /></port></outputPorts><processors><processor><name>personToString</name><inputPorts><port><name>parameters</name><depth>0</depth></port></inputPorts><outputPorts><port><name>parameters</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>activities.wsdl.WSDLActivity</class><inputMap><map from="parameters" to="parameters" /></inputMap><outputMap><map from="parameters" to="parameters" /></outputMap><configBean encoding="xstream"><activities.wsdl.WSDLActivityConfigurationBean xmlns="">
<wsdl>http://www.mygrid.org.uk/menagerie/xfire/Complex-dlw?wsdl</wsdl>
<operation>personToString</operation>
-</net.sf.taverna.t2.activities.wsdl.WSDLActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.wsdl.WSDLActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="parameters" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>personToString_output</name><inputPorts><port><name>input</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLOutputSplitt
erActivity</class><inputMap><map from="input" to="input" /></inputMap><outputMap><map from="out" to="out" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="parameters" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>personToString_output</name><inputPorts><port><name>input</name><depth>0</depth></port></inputPorts><outputPorts><port><name>out</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>activities.wsdl.xmlsplitter.XMLOutputSplitterActivity</class><inputMap><map from="input" to="input" /></inputMap><outputMap><map from
="out" to="out" /></outputMap><configBean encoding="xstream"><activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
<wrappedTypeXML><s:extensions xmlns:s="http://org.embl.ebi.escience/xscufl/0.1alpha"><s:complextype optional="false" unbounded="false" typename="personToStringResponse" name="parameters" qname="{http://xfire.codehaus.org/BookService}personToStringResponse"><s:elements><s:basetype optional="false" unbounded="false" typename="string" name="out" qname="{http://xfire.codehaus.org/BookService}&gt;personToStringResponse&gt;out" /></s:elements></s:complextype></s:extensions></wrappedTypeXML>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>false</allowsLiteralValues>
@@ -64,276 +64,276 @@
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/xml'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>out</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/plain'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="input" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>personToString_input</name><inputPorts><port><name>person</name><depth>0</depth></port></inputPorts><outputPorts><port><name>output</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLInputSplitterA
ctivity</class><inputMap><map from="person" to="person" /></inputMap><outputMap><map from="output" to="output" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="input" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>personToString_input</name><inputPorts><port><name>person</name><depth>0</depth></port></inputPorts><outputPorts><port><name>output</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>activities.wsdl.xmlsplitter.XMLInputSplitterActivity</class><inputMap><map from="person" to="person" /></inputMap><outputMap><map from=
"output" to="output" /></outputMap><configBean encoding="xstream"><activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
<wrappedTypeXML><s:extensions xmlns:s="http://org.embl.ebi.escience/xscufl/0.1alpha"><s:complextype optional="false" unbounded="false" typename="personToString" name="parameters" qname="{http://xfire.codehaus.org/BookService}personToString"><s:elements><s:complextype optional="false" unbounded="false" typename="Person" name="person" qname="{http://xfire.codehaus.org/BookService}&gt;personToString&gt;person"><s:elements><s:complextype optional="true" unbounded="false" typename="Address" name="address" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;address"><s:elements><s:basetype optional="true" unbounded="false" typename="string" name="city" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;city" /><s:basetype optional="true" unbounded="false" typename="string" name="road" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;road" /><s:basetype optional="true
" unbounded="false" typename="int" name="roadNumber" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;roadNumber" /></s:elements></s:complextype><s:basetype optional="true" unbounded="false" typename="int" name="age" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;age" /><s:basetype optional="true" unbounded="false" typename="string" name="firstName" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;firstName" /><s:basetype optional="true" unbounded="false" typename="string" name="lastName" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;lastName" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions></wrappedTypeXML>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>person</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/xml'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>output</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/xml'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="person" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>personToString_person</name><inputPorts><port><name>lastName</name><depth>0</depth></port><port><name>firstName</name><depth>0</depth></port><port><name>age</name><depth>0</depth></port><port><name>address</name><depth>0</depth></port></inputPorts><outputPorts><port><name>output</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.act
ivities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLInputSplitterActivity</class><inputMap><map from="lastName" to="lastName" /><map from="address" to="address" /><map from="age" to="age" /><map from="firstName" to="firstName" /></inputMap><outputMap><map from="output" to="output" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="person" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>personToString_person</name><inputPorts><port><name>lastName</name><depth>0</depth></port><port><name>firstName</name><depth>0</depth></port><port><name>age</name><depth>0</depth></port><port><name>address</name><depth>0</depth></port></inputPorts><outputPorts><port><name>output</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>wsdl-activity</artifact><version>1.2</version><
/raven><class>activities.wsdl.xmlsplitter.XMLInputSplitterActivity</class><inputMap><map from="lastName" to="lastName" /><map from="address" to="address" /><map from="age" to="age" /><map from="firstName" to="firstName" /></inputMap><outputMap><map from="output" to="output" /></outputMap><configBean encoding="xstream"><activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
<wrappedTypeXML><s:extensions xmlns:s="http://org.embl.ebi.escience/xscufl/0.1alpha"><s:complextype optional="false" unbounded="false" typename="Person" name="person" qname="{http://xfire.codehaus.org/BookService}&gt;personToString&gt;person"><s:elements><s:complextype optional="true" unbounded="false" typename="Address" name="address" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;address"><s:elements><s:basetype optional="true" unbounded="false" typename="string" name="city" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;city" /><s:basetype optional="true" unbounded="false" typename="string" name="road" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;road" /><s:basetype optional="true" unbounded="false" typename="int" name="roadNumber" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;roadNumber" /></s:elements></s:complextype>
;<s:basetype optional="true" unbounded="false" typename="int" name="age" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;age" /><s:basetype optional="true" unbounded="false" typename="string" name="firstName" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;firstName" /><s:basetype optional="true" unbounded="false" typename="string" name="lastName" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;lastName" /></s:elements></s:complextype></s:extensions></wrappedTypeXML>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>address</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/xml'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>age</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/plain'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>firstName</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/plain'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>lastName</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/plain'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>output</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/xml'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="lastName" depth="0" /><port name="firstName" depth="0" /><port name="age" depth="0" /><port name="address" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>person_address</name><inputPorts><port><name>city</name><depth>0</depth></port><port><name>road</name><depth>0</depth></port><port><name>roadNumber</name><depth>0</depth></port></inputPorts><outputPorts><port><name>output</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><act
ivity><raven><group>net.sf.taverna.t2.activities</group><artifact>wsdl-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLInputSplitterActivity</class><inputMap><map from="road" to="road" /><map from="roadNumber" to="roadNumber" /><map from="city" to="city" /></inputMap><outputMap><map from="output" to="output" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="lastName" depth="0" /><port name="firstName" depth="0" /><port name="age" depth="0" /><port name="address" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>person_address</name><inputPorts><port><name>city</name><depth>0</depth></port><port><name>road</name><depth>0</depth></port><port><name>roadNumber</name><depth>0</depth></port></inputPorts><outputPorts><port><name>output</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>wsdl-a
ctivity</artifact><version>1.2</version></raven><class>activities.wsdl.xmlsplitter.XMLInputSplitterActivity</class><inputMap><map from="road" to="road" /><map from="roadNumber" to="roadNumber" /><map from="city" to="city" /></inputMap><outputMap><map from="output" to="output" /></outputMap><configBean encoding="xstream"><activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean xmlns="">
<wrappedTypeXML><s:extensions xmlns:s="http://org.embl.ebi.escience/xscufl/0.1alpha"><s:complextype optional="true" unbounded="false" typename="Address" name="address" qname="{http://complex.pojo.axis2.menagerie.googlecode}Person&gt;address"><s:elements><s:basetype optional="true" unbounded="false" typename="string" name="city" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;city" /><s:basetype optional="true" unbounded="false" typename="string" name="road" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;road" /><s:basetype optional="true" unbounded="false" typename="int" name="roadNumber" qname="{http://complex.pojo.axis2.menagerie.googlecode}Address&gt;roadNumber" /></s:elements></s:complextype></s:extensions></wrappedTypeXML>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>city</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/plain'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>road</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/plain'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<allowsLiteralValues>false</allowsLiteralValues>
<name>roadNumber</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/plain'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>output</name>
<depth>0</depth>
<mimeTypes class="java.util.Collections$SingletonList">
<element class="string">'text/xml'</element>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.wsdl.xmlsplitter.XMLSplitterConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="city" depth="0" /><port name="road" depth="0" /><port name="roadNumber" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>city_value</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstant
Activity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy><cross><port name="city" depth="0" /><port name="road" depth="0" /><port name="roadNumber" depth="0" /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>city_value</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configB
ean encoding="xstream"><activities.stringconstant.StringConstantConfigurationBean xmlns="">
<value>Manchester</value>
-</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor><processor><name>road_value</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf
.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor><processor><name>road_value</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><activities.stringconstant.StringConstantConfigurationBean xmlns="">
<value>Oxford Road</value>
-</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor><processor><name>roadNumber_value</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><
net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor><processor><name>roadNumber_value</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><activities.stringconstant.StringConstantConfigurationBean xmlns="">
<value>40</value>
-</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
+</activities.stringconstant.StringConstantConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
<maxJobs>1</maxJobs>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="
">
+</workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
<backoffFactor>1.0</backoffFactor>
<initialDelay>1000</initialDelay>
<maxDelay>5000</maxDelay>
<maxRetries>0</maxRetries>
-</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>personToString</processor><port>parameters</port></sink><source type="processor"><processor>personToString_input</processor><port>output</port></source></datalink><datalink><sink type="processor"><processor>personToString_output</processor><port>input</port></sink><source type="processor"><processor>personToString</processor><port>parameters</port></source></datalink><datalink><sink type="processor"><processor>pers
onToString_input</processor><port>person</port></sink><source type="processor"><processor>personToString_person</processor><port>output</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>lastName</port></sink><source type="dataflow"><port>lastName</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>firstName</port></sink><source type="dataflow"><port>firstName</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>age</port></sink><source type="dataflow"><port>age</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>address</port></sink><source type="processor"><processor>person_address</processor><port>output</port></source></datalink><datalink><sink type="processor"><processor>person_address</processor><port>city</port></sink><source type="processor"><processo
r>city_value</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>person_address</processor><port>road</port></sink><source type="processor"><processor>road_value</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>person_address</processor><port>roadNumber</port></sink><source type="processor"><processor>roadNumber_value</processor><port>value</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type="processor"><processor>personToString_output</processor><port>out</port></source></datalink></datalinks><annotations><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="processor"><processor>personToString</processor><port>parameters</port></sink><source type="processor"><processor>personToString_input</processor><port>output</port></source></datalink><datalink><sink type="processor"><processor>personToString_output</processor><port>input</port></sink><source type="processor"><processor>personToString</processor><port>parameters</port></source></datalink><datalink><sink type="processor"><processor>personToString_input</processor><port>person</port></sink>
<source type="processor"><processor>personToString_person</processor><port>output</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>lastName</port></sink><source type="dataflow"><port>lastName</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>firstName</port></sink><source type="dataflow"><port>firstName</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>age</port></sink><source type="dataflow"><port>age</port></source></datalink><datalink><sink type="processor"><processor>personToString_person</processor><port>address</port></sink><source type="processor"><processor>person_address</processor><port>output</port></source></datalink><datalink><sink type="processor"><processor>person_address</processor><port>city</port></sink><source type="processor"><processor>city_value</processor><port>value</port></source></d
atalink><datalink><sink type="processor"><processor>person_address</processor><port>road</port></sink><source type="processor"><processor>road_value</processor><port>value</port></source></datalink><datalink><sink type="processor"><processor>person_address</processor><port>roadNumber</port></sink><source type="processor"><processor>roadNumber_value</processor><port>value</port></source></datalink><datalink><sink type="dataflow"><port>out</port></sink><source type="processor"><processor>personToString_output</processor><port>out</port></source></datalink></datalinks><annotations><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>d79eeb60-919e-4076-af14-70ac4d605bec</identification>
</annotationBean>
<date>2011-02-17 10:49:46.785 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>52ddd8d4-d1fc-4b62-932a-288df52b77cf</identification>
</annotationBean>
<date>2011-02-17 10:53:16.981 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>8815f1ea-2659-4b7e-a90e-787c6a3c4ad6</identification>
</annotationBean>
<date>2011-02-17 10:29:40.492 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>eee0128a-4afe-4566-851a-fe50dcb36340</identification>
</annotationBean>
<date>2011-02-17 10:48:35.150 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>e64ae430-dd6e-468d-b3dd-de1fea9c717b</identification>
</annotationBean>
<date>2011-02-17 10:20:55.279 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>2aa76794-f001-42f9-b945-797badfeebb1</identification>
</annotationBean>
<date>2011-02-17 10:17:24.893 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>2ece2565-7498-4154-9d61-996d8a1db5f3</identification>
</annotationBean>
<date>2011-02-17 10:24:47.509 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>97fbd479-a423-4e8c-9033-bfc28f1a7885</identification>
</annotationBean>
<date>2011-02-17 10:42:59.63 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
+</annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><annotation.AnnotationChainImpl xmlns="">
<annotationAssertions>
- <net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
- <annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
+ <annotation.AnnotationAssertionImpl>
+ <annotationBean class="annotation.annotationbeans.IdentificationAssertion">
<identification>24e8b191-9f48-4864-82be-d9578f1b8450</identification>
</annotationBean>
<date>2011-02-17 10:25:38.788 GMT</date>
<creators />
<curationEventList />
- </net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
+ </annotation.AnnotationAssertionImpl>
</annotationAssertions>
-</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></dataflow></workflow>
\ No newline at end of file
+</annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></dataflow></workflow>
\ No newline at end of file
[3/5] incubator-taverna-commandline git commit: package name changes
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/TavernaCommandLine.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/TavernaCommandLine.java b/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/TavernaCommandLine.java
new file mode 100644
index 0000000..64a7f38
--- /dev/null
+++ b/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/TavernaCommandLine.java
@@ -0,0 +1,142 @@
+/*
+* 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.taverna.commandline;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.taverna.commandline.exceptions.ArgumentsParsingException;
+import org.apache.taverna.commandline.exceptions.InvalidOptionException;
+import org.apache.taverna.commandline.options.CommandLineOptions;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
+import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
+import uk.org.taverna.commons.profile.xml.jaxb.FrameworkConfiguration;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
+import uk.org.taverna.configuration.app.impl.Log4JConfiguration;
+import uk.org.taverna.osgi.OsgiLauncher;
+
+/**
+ * Main entry point for starting the Taverna Command Line Tool.
+ *
+ * @author David Withers
+ */
+public class TavernaCommandLine {
+
+ private static final String COMMANDLINE_BUNDLE_NAME = "org.apache.taverna.commandline.taverna-commandline-common";
+
+ private static File commandlineBundle = null;
+
+ private static ApplicationConfiguration applicationConfiguration = new ApplicationConfigurationImpl();
+
+ private static Log4JConfiguration log4jConfiguration = new Log4JConfiguration();
+
+ /**
+ * Starts the Taverna Command Line Tool.
+ *
+ * @param args
+ * Taverna Command Line arguments
+ */
+ public static void main(final String[] args) {
+ try {
+ CommandLineOptions commandLineOptions = new CommandLineOptionsImpl(args);
+ if (commandLineOptions.askedForHelp()) {
+ commandLineOptions.displayHelp();
+ } else {
+ log4jConfiguration.setApplicationConfiguration(applicationConfiguration);
+ log4jConfiguration.prepareLog4J();
+ setDerbyPaths();
+ OsgiLauncher osgilauncher = new OsgiLauncher(getAppDirectory(), getBundleURIs());
+ setFrameworkConfiguration(osgilauncher);
+ osgilauncher.start();
+ BundleContext context = osgilauncher.getContext();
+ context.registerService("org.apache.taverna.commandline.options.CommandLineOptions",
+ commandLineOptions, null);
+ osgilauncher.startServices(true);
+ if (commandlineBundle == null) {
+ System.err.println("Can't locate command line bundle " + COMMANDLINE_BUNDLE_NAME);
+ System.exit(1);
+ }
+ osgilauncher.startBundle(osgilauncher.installBundle(commandlineBundle.toURI()));
+ }
+ } catch (ArgumentsParsingException e) {
+ System.out.println(e.getMessage());
+ } catch (InvalidOptionException e) {
+ System.out.println(e.getMessage());
+ } catch (BundleException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ /**
+ * Sets the OSGi Framework configuration.
+ *
+ * @param osgilauncher
+ */
+ private static void setFrameworkConfiguration(OsgiLauncher osgilauncher) {
+ ApplicationProfile applicationProfile = applicationConfiguration.getApplicationProfile();
+ List<FrameworkConfiguration> frameworkConfigurations = applicationProfile
+ .getFrameworkConfiguration();
+ if (!frameworkConfigurations.isEmpty()) {
+ Map<String, String> configurationMap = new HashMap<String, String>();
+ for (FrameworkConfiguration frameworkConfiguration : frameworkConfigurations) {
+ configurationMap.put(frameworkConfiguration.getName(),
+ frameworkConfiguration.getValue());
+ }
+ osgilauncher.setFrameworkConfiguration(configurationMap);
+ }
+ }
+
+ private static List<URI> getBundleURIs() {
+ List<URI> bundleURIs = new ArrayList<URI>();
+ ApplicationProfile applicationProfile = applicationConfiguration.getApplicationProfile();
+ File libDir = new File(applicationConfiguration.getStartupDir(), "lib");
+ if (applicationProfile != null) {
+ for (BundleInfo bundle : applicationProfile.getBundle()) {
+ File bundleFile = new File(libDir, bundle.getFileName());
+ if (bundle.getSymbolicName().equals(COMMANDLINE_BUNDLE_NAME)) {
+ commandlineBundle = bundleFile;
+ } else {
+ bundleURIs.add(bundleFile.toURI());
+ }
+ }
+ }
+ return bundleURIs;
+ }
+
+ private static File getAppDirectory() {
+ return new File(applicationConfiguration.getApplicationHomeDir().getAbsolutePath());
+ }
+
+ private static void setDerbyPaths() {
+ System.setProperty("derby.system.home", getAppDirectory().getAbsolutePath());
+ File logFile = new File(applicationConfiguration.getLogDir(), "derby.log");
+ System.setProperty("derby.stream.error.file", logFile.getAbsolutePath());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/CommandLineOptionsImpl.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/CommandLineOptionsImpl.java b/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/CommandLineOptionsImpl.java
deleted file mode 100644
index b702e03..0000000
--- a/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/CommandLineOptionsImpl.java
+++ /dev/null
@@ -1,445 +0,0 @@
-/*******************************************************************************
- * 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 uk.org.taverna.commandline;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import net.sf.taverna.t2.commandline.exceptions.ArgumentsParsingException;
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-
-/**
- * Handles the processing of command line arguments for enacting a workflow.
- * This class encapsulates all command line options, and exposes them through higher-level
- * accessors. Upon creation it checks the validity of the command line options and raises an
- * {@link InvalidOptionException} if they are invalid.
- *
- * @author Stuart Owen
- * @author David Withers
- */
-public class CommandLineOptionsImpl implements CommandLineOptions {
-
- private static final String OUTPUTDIR = "outputdir";
- private static final String BUNDLE = "bundle";
- private static final Logger logger = Logger.getLogger(CommandLineOptionsImpl.class);
- private Options options;
- private CommandLine commandLine;
-
- public CommandLineOptionsImpl(String[] args) throws ArgumentsParsingException, InvalidOptionException {
- this.options = intitialiseOptions();
- this.commandLine = processArgs(args);
- checkForInvalid();
- }
-
- @Override
- public boolean askedForHelp() {
- return hasOption("help") || (getArgs().length==0 && getOptions().length==0);
- }
-
- @Override
- public boolean isProvenanceEnabled() {
- return hasOption("provenance");
- }
-
- protected void checkForInvalid() throws InvalidOptionException {
- if (askedForHelp()) return;
- if (isProvenanceEnabled()
- && !(hasOption("embedded") || hasOption("clientserver") || hasOption("dbproperties")))
- throw new InvalidOptionException(
- "You should be running with a database to use provenance");
- if (isProvenanceEnabled() && hasOption("inmemory"))
- throw new InvalidOptionException(
- "You should be running with a database to use provenance");
- if ((hasOption("inputfile") || hasOption("inputvalue"))
- && hasOption("inputdoc"))
- throw new InvalidOptionException(
- "You can't provide both -input and -inputdoc arguments");
-
- if (hasOption("inputdelimiter") && hasOption("inputdoc"))
- throw new InvalidOptionException("You cannot combine the -inputdelimiter and -inputdoc arguments");
-
- if (getArgs().length == 0
- && !(hasOption("help") || hasOption("startdb")))
- throw new InvalidOptionException("You must specify a workflow");
-
- if (hasOption("inmemory") && hasOption("embedded"))
- throw new InvalidOptionException(
- "The options -embedded, -clientserver and -inmemory cannot be used together");
- if (hasOption("inmemory") && hasOption("clientserver"))
- throw new InvalidOptionException(
- "The options -embedded, -clientserver and -inmemory cannot be used together");
- if (hasOption("embedded") && hasOption("clientserver"))
- throw new InvalidOptionException(
- "The options -embedded, -clientserver and -inmemory cannot be used together");
- }
-
- @Override
- public void displayHelp() {
- boolean full = false;
- if (hasOption("help")) full=true;
- displayHelp(full);
- }
-
- @Override
- public void displayHelp(boolean showFullText) {
-
- HelpFormatter formatter = new HelpFormatter();
- try {
- formatter
- .printHelp("executeworkflow [options] [workflow]", options);
- if (showFullText) {
- InputStream helpStream = CommandLineOptionsImpl.class
- .getClassLoader().getResourceAsStream("help.txt");
- String helpText = IOUtils.toString(helpStream);
- System.out.println(helpText);
- }
-
- } catch (IOException e) {
- logger.error("Failed to load the help document", e);
- System.out.println("Failed to load the help document");
- //System.exit(-1);
- }
- }
-
- @Override
- public String[] getArgs() {
- return commandLine.getArgs();
- }
-
- /**
- *
- * @return the port that the database should run on
- */
- @Override
- public String getDatabasePort() {
- return getOptionValue("port");
- }
-
- /**
- *
- * @return a path to a properties file that contains database configuration
- * settings
- */
- @Override
- public String getDatabaseProperties() {
- return getOptionValue("dbproperties");
- }
-
- /**
- * Returns an array that alternates between a portname and path to a file
- * containing the input values. Therefore the array will always contain an
- * even number of elements
- *
- * @return an array of portname and path to files containing individual
- * inputs.
- */
- @Override
- public String[] getInputFiles() {
- if (hasInputFiles()) {
- return getOptionValues("inputfile");
- } else {
- return new String[] {};
- }
- }
-
- @Override
- public String[] getInputValues() {
- if (hasInputValues()) {
- return getOptionValues("inputvalue");
- } else {
- return new String[] {};
- }
- }
-
- @Override
- public String getLogFile() {
- return getOptionValue("logfile");
- }
-
- public Option [] getOptions() {
- return commandLine.getOptions();
- }
-
- private String getOptionValue(String opt) {
- return commandLine.getOptionValue(opt);
- }
-
- private String[] getOptionValues(String arg0) {
- return commandLine.getOptionValues(arg0);
- }
-
- /**
- *
- * @return the directory to write the results to
- */
- @Override
- public String getOutputDirectory() {
- return getOptionValue(OUTPUTDIR);
- }
-
- @Override
- public boolean getStartDatabase() {
- return hasOption("startdb");
- }
-
- /**
- * @return the directory with Credential Manager's files
- */
- @Override
- public String getCredentialManagerDir() {
- return getOptionValue(CREDENTIAL_MANAGER_DIR_OPTION);
- }
-
- @Override
- public boolean getStartDatabaseOnly() throws InvalidOptionException {
- return (getStartDatabase() && (getWorkflow() == null));
- }
-
- @Override
- public String getWorkflow() throws InvalidOptionException {
- if (getArgs().length == 0) {
- return null;
- } else if (getArgs().length != 1) {
- throw new InvalidOptionException(
- "You should only specify one workflow file");
- } else {
- return getArgs()[0];
- }
- }
-
- @Override
- public boolean hasDelimiterFor(String inputName) {
- boolean result = false;
- if (hasOption("inputdelimiter")) {
- String [] values = getOptionValues("inputdelimiter");
- for (int i=0;i<values.length;i+=2) {
- if (values[i].equals(inputName))
- {
- result=true;
- break;
- }
- }
- }
- return result;
- }
-
- @Override
- public boolean hasInputFiles() {
- return hasOption("inputfile");
- }
-
- @Override
- public boolean hasInputValues() {
- return hasOption("inputvalue");
- }
-
- @Override
- public boolean hasLogFile() {
- return hasOption("logfile");
- }
-
- @Override
- public boolean hasOption(String option) {
- return commandLine.hasOption(option);
- }
-
- @Override
- public String inputDelimiter(String inputName) {
- String result = null;
- if (hasOption("inputdelimiter")) {
- String [] values = getOptionValues("inputdelimiter");
- for (int i=0;i<values.length;i+=2) {
- if (values[i].equals(inputName))
- {
- result=values[i+1];
- break;
- }
- }
- }
- return result;
- }
-
- @SuppressWarnings("static-access")
- private Options intitialiseOptions() {
- Option helpOption = new Option("help", "Display comprehensive help information.");
-
- Option outputOption = OptionBuilder
- .withArgName("directory")
- .hasArg()
- .withDescription(
- "Save outputs as files in directory, default "
- + "is to make a new directory workflowName_output.")
- .create(OUTPUTDIR);
-
- Option bundleOption = OptionBuilder.withArgName(BUNDLE).hasArg()
- .withDescription("Save outputs to a new Workflow Run Bundle (zip).")
- .create(BUNDLE);
-
- Option logFileOption = OptionBuilder
- .withArgName("filename")
- .hasArg()
- .withDescription(
- "The logfile to which more verbose logging will be written to.")
- .create("logfile");
-
- Option inputdocOption = OptionBuilder.withArgName("document").hasArg()
- .withDescription("Load inputs from a Baclava document.").create(
- "inputdoc");
-
- Option inputFileOption = OptionBuilder
- .withArgName("inputname filename").hasArgs(2)
- .withValueSeparator(' ').withDescription(
- "Load the named input from file or URL.").create(
- "inputfile");
-
- Option inputValueOption = OptionBuilder.withArgName("inputname value")
- .hasArgs(2).withValueSeparator(' ').withDescription(
- "Directly use the value for the named input.").create(
- "inputvalue");
-
- Option inputDelimiterOption = OptionBuilder
- .withArgName("inputname delimiter")
- .hasArgs(2)
- .withValueSeparator(' ')
- .withDescription(
- "Cause an inputvalue or inputfile to be split into a list according to the delimiter. The associated workflow input must be expected to receive a list.")
- .create("inputdelimiter");
-
- Option dbProperties = OptionBuilder.withArgName("filename").hasArg()
- .withDescription(
- "Load a properties file to configure the database.")
- .create("dbproperties");
-
- Option port = OptionBuilder
- .withArgName("portnumber")
- .hasArg()
- .withDescription(
- "The port that the database is running on. If set requested to start its own internal server, this is the start port that will be used.")
- .create("port");
-
- Option embedded = new Option("embedded",
- "Connect to an embedded Derby database. This can prevent mulitple invocations.");
- Option clientserver = new Option("clientserver",
- "Connect as a client to a derby server instance.");
- Option inMemOption = new Option(
- "inmemory",
- "Run the workflow with data stored in-memory rather than in a database (this is the default option). This can give performance inprovements, at the cost of overall memory usage.");
- Option startDB = new Option("startdb",
- "Automatically start an internal Derby database server.");
- Option provenance = new Option("provenance",
- "Generate provenance information and store it in the database.");
-
-
- Option credentialManagerDirectory = OptionBuilder.withArgName("directory path").
- hasArg().withDescription(
- "Absolute path to a directory where Credential Manager's files (keystore and truststore) are located.")
- .create(CREDENTIAL_MANAGER_DIR_OPTION);
- Option credentialManagerPassword = new Option(CREDENTIAL_MANAGER_PASSWORD_OPTION, "Indicate that the master password for Credential Manager will be provided on standard input."); // optional password option, to be read from standard input
-
- Options options = new Options();
- options.addOption(helpOption);
- options.addOption(inputFileOption);
- options.addOption(inputValueOption);
- options.addOption(inputDelimiterOption);
- options.addOption(inputdocOption);
- options.addOption(outputOption);
- options.addOption(bundleOption);
- options.addOption(inMemOption);
- options.addOption(embedded);
- options.addOption(clientserver);
- options.addOption(dbProperties);
- options.addOption(port);
- options.addOption(startDB);
- options.addOption(provenance);
- options.addOption(logFileOption);
- options.addOption(credentialManagerDirectory);
- options.addOption(credentialManagerPassword);
-
- return options;
- }
-
- @Override
- public boolean isClientServer() {
- return hasOption("clientserver");
- }
-
- @Override
- public boolean isEmbedded() {
- return hasOption("embedded");
- }
-
- @Override
- public boolean isInMemory() {
- return hasOption("inmemory");
- }
-
- private CommandLine processArgs(String[] args) throws ArgumentsParsingException {
- CommandLineParser parser = new GnuParser();
- CommandLine line = null;
- try {
- // parse the command line arguments
- line = parser.parse(options, args);
- } catch (ParseException exp) {
- // oops, something went wrong
-// System.err.println("Taverna command line arguments' parsing failed. Reason: " + exp.getMessage());
-// System.exit(1);
- throw new ArgumentsParsingException("Taverna command line arguments' parsing failed. Reason: " + exp.getMessage(), exp);
- }
- return line;
- }
-
- /**
- * Save the results to a directory if -outputdir has been explicitly defined,
- * or if -outputdoc has not been defined.
- *
- * @return boolean
- */
- @Override
- public boolean saveResultsToDirectory() {
- return (options.hasOption(OUTPUTDIR) || !hasSaveResultsToBundle());
- }
-
- @Override
- public String saveResultsToBundle() {
- if (! hasSaveResultsToBundle()) {
- return null;
- }
- return getOptionValue(BUNDLE);
- }
-
- @Override
- public boolean hasSaveResultsToBundle() {
- return hasOption(BUNDLE);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/TavernaCommandLine.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/TavernaCommandLine.java b/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/TavernaCommandLine.java
deleted file mode 100644
index 426ab98..0000000
--- a/taverna-commandline-launcher/src/main/java/uk/org/taverna/commandline/TavernaCommandLine.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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 uk.org.taverna.commandline;
-
-import java.io.File;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.commandline.exceptions.ArgumentsParsingException;
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-import uk.org.taverna.commons.profile.xml.jaxb.ApplicationProfile;
-import uk.org.taverna.commons.profile.xml.jaxb.BundleInfo;
-import uk.org.taverna.commons.profile.xml.jaxb.FrameworkConfiguration;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
-import uk.org.taverna.configuration.app.impl.Log4JConfiguration;
-import uk.org.taverna.osgi.OsgiLauncher;
-
-/**
- * Main entry point for starting the Taverna Command Line Tool.
- *
- * @author David Withers
- */
-public class TavernaCommandLine {
-
- private static final String COMMANDLINE_BUNDLE_NAME = "org.apache.taverna.commandline.taverna-commandline-common";
-
- private static File commandlineBundle = null;
-
- private static ApplicationConfiguration applicationConfiguration = new ApplicationConfigurationImpl();
-
- private static Log4JConfiguration log4jConfiguration = new Log4JConfiguration();
-
- /**
- * Starts the Taverna Command Line Tool.
- *
- * @param args
- * Taverna Command Line arguments
- */
- public static void main(final String[] args) {
- try {
- CommandLineOptions commandLineOptions = new CommandLineOptionsImpl(args);
- if (commandLineOptions.askedForHelp()) {
- commandLineOptions.displayHelp();
- } else {
- log4jConfiguration.setApplicationConfiguration(applicationConfiguration);
- log4jConfiguration.prepareLog4J();
- setDerbyPaths();
- OsgiLauncher osgilauncher = new OsgiLauncher(getAppDirectory(), getBundleURIs());
- setFrameworkConfiguration(osgilauncher);
- osgilauncher.start();
- BundleContext context = osgilauncher.getContext();
- context.registerService("net.sf.taverna.t2.commandline.options.CommandLineOptions",
- commandLineOptions, null);
- osgilauncher.startServices(true);
- if (commandlineBundle == null) {
- System.err.println("Can't locate command line bundle " + COMMANDLINE_BUNDLE_NAME);
- System.exit(1);
- }
- osgilauncher.startBundle(osgilauncher.installBundle(commandlineBundle.toURI()));
- }
- } catch (ArgumentsParsingException e) {
- System.out.println(e.getMessage());
- } catch (InvalidOptionException e) {
- System.out.println(e.getMessage());
- } catch (BundleException e) {
- System.out.println(e.getMessage());
- }
- }
-
- /**
- * Sets the OSGi Framework configuration.
- *
- * @param osgilauncher
- */
- private static void setFrameworkConfiguration(OsgiLauncher osgilauncher) {
- ApplicationProfile applicationProfile = applicationConfiguration.getApplicationProfile();
- List<FrameworkConfiguration> frameworkConfigurations = applicationProfile
- .getFrameworkConfiguration();
- if (!frameworkConfigurations.isEmpty()) {
- Map<String, String> configurationMap = new HashMap<String, String>();
- for (FrameworkConfiguration frameworkConfiguration : frameworkConfigurations) {
- configurationMap.put(frameworkConfiguration.getName(),
- frameworkConfiguration.getValue());
- }
- osgilauncher.setFrameworkConfiguration(configurationMap);
- }
- }
-
- private static List<URI> getBundleURIs() {
- List<URI> bundleURIs = new ArrayList<URI>();
- ApplicationProfile applicationProfile = applicationConfiguration.getApplicationProfile();
- File libDir = new File(applicationConfiguration.getStartupDir(), "lib");
- if (applicationProfile != null) {
- for (BundleInfo bundle : applicationProfile.getBundle()) {
- File bundleFile = new File(libDir, bundle.getFileName());
- if (bundle.getSymbolicName().equals(COMMANDLINE_BUNDLE_NAME)) {
- commandlineBundle = bundleFile;
- } else {
- bundleURIs.add(bundleFile.toURI());
- }
- }
- }
- return bundleURIs;
- }
-
- private static File getAppDirectory() {
- return new File(applicationConfiguration.getApplicationHomeDir().getAbsolutePath());
- }
-
- private static void setDerbyPaths() {
- System.setProperty("derby.system.home", getAppDirectory().getAbsolutePath());
- File logFile = new File(applicationConfiguration.getLogDir(), "derby.log");
- System.setProperty("derby.stream.error.file", logFile.getAbsolutePath());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-launcher/src/test/java/org/apache/taverna/commandline/TestCommandLineOptionsHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-launcher/src/test/java/org/apache/taverna/commandline/TestCommandLineOptionsHandler.java b/taverna-commandline-launcher/src/test/java/org/apache/taverna/commandline/TestCommandLineOptionsHandler.java
new file mode 100644
index 0000000..9fb1bf3
--- /dev/null
+++ b/taverna-commandline-launcher/src/test/java/org/apache/taverna/commandline/TestCommandLineOptionsHandler.java
@@ -0,0 +1,286 @@
+/*
+* 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.taverna.commandline;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import org.apache.taverna.commandline.exceptions.InvalidOptionException;
+import org.apache.taverna.commandline.options.CommandLineOptions;
+
+import org.junit.Test;
+
+public class TestCommandLineOptionsHandler {
+
+ @Test
+ public void testWorkflowName() throws Exception {
+ CommandLineOptions handler = new CommandLineOptionsImpl(
+ new String[] { "myworkflow.t2flow" });
+ assertEquals("myworkflow.t2flow", handler.getWorkflow());
+ }
+
+ @Test
+ public void shouldShowHelp() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(
+ new String[] { "-help" });
+ assertTrue(options.askedForHelp());
+ options = new CommandLineOptionsImpl(
+ new String[] {});
+ assertTrue(options.askedForHelp());
+ options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
+ assertFalse(options.askedForHelp());
+ }
+
+ @Test
+ public void getWorkflow() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(
+ new String[] { "-help" });
+ assertNull(options.getWorkflow());
+ options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
+ assertEquals("myworkflow.t2flow", options.getWorkflow());
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void cannotProvideInputFileAndInputDoc() throws Exception {
+ new CommandLineOptionsImpl(new String[] { "-inputfile", "fred", "fred.txt",
+ "-inputdoc", "myworkflow.t2flow" });
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void cannotProvideInputValueAndInputDoc() throws Exception {
+ new CommandLineOptionsImpl(new String[] { "-inputvalue", "fred", "fred.txt",
+ "-inputdoc", "myworkflow.t2flow" });
+ }
+
+ @Test
+ public void canProvideInputValueAndFileTogether() throws Exception {
+ //should not be an error
+ new CommandLineOptionsImpl(new String[] { "-inputvalue", "fred", "abc",
+ "-inputfile","fred2","fred2.txt","myworkflow.t2flow" });
+ }
+
+ @Test
+ public void getInputs() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-inputfile", "fred", "fred.txt", "myworkflow.t2flow" });
+ assertEquals(2, options.getInputFiles().length);
+ assertEquals("fred", options.getInputFiles()[0]);
+ assertEquals("fred.txt", options.getInputFiles()[1]);
+
+ options = new CommandLineOptionsImpl(new String[] { "-inputfile", "fred",
+ "fred.txt", "-inputfile", "fred2", "fred2.txt",
+ "myworkflow.t2flow" });
+ assertEquals(4, options.getInputFiles().length);
+ assertEquals("fred", options.getInputFiles()[0]);
+ assertEquals("fred.txt", options.getInputFiles()[1]);
+ assertEquals("fred2", options.getInputFiles()[2]);
+ assertEquals("fred2.txt", options.getInputFiles()[3]);
+
+ options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
+ assertNotNull(options.getInputFiles());
+ assertEquals(0, options.getInputFiles().length);
+
+ }
+
+ @Test
+ public void hasInputValue() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-inputvalue", "fred", "abc", "myworkflow.t2flow" });
+ assertTrue(options.hasInputValues());
+
+ options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
+ assertFalse(options.hasInputValues());
+ }
+
+ @Test
+ public void getInputValues() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-inputvalue", "fred", "abc", "myworkflow.t2flow" });
+ assertEquals(2, options.getInputValues().length);
+
+ options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
+ assertNotNull(options.getInputValues());
+ assertEquals(0,options.getInputValues().length);
+ }
+
+ @Test
+ public void hasInputs() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-inputfile", "fred", "fred.txt", "myworkflow.t2flow" });
+ assertTrue(options.hasInputFiles());
+
+ options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
+ assertFalse(options.hasInputFiles());
+ }
+
+ @Test
+ public void noWorkflowNameButStartDB() throws Exception {
+ // should not throw an error
+ CommandLineOptions options = new CommandLineOptionsImpl(
+ new String[] { "-startdb" });
+ assertTrue(options.getStartDatabase());
+ assertTrue(options.getStartDatabaseOnly());
+ }
+
+ @Test
+ public void workflowNameAndStartDB() throws Exception {
+ // should not throw an error
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-startdb", "myworkflow.t2flow" });
+ assertTrue(options.getStartDatabase());
+ assertFalse(options.getStartDatabaseOnly());
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void provenanceButNoDatabase() throws Exception {
+ new CommandLineOptionsImpl(new String[] { "-provenance",
+ "myworkflow.t2flow" });
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void provenanceButNoDatabase2() throws Exception {
+ new CommandLineOptionsImpl(new String[] { "-provenance", "-inmemory",
+ "myworkflow.t2flow" });
+ }
+
+ @Test
+ public void provenanceDatabase() throws Exception {
+ // should be no errors
+ new CommandLineOptionsImpl(new String[] { "-provenance", "-embedded",
+ "myworkflow.t2flow" });
+ new CommandLineOptionsImpl(new String[] { "-provenance", "-clientserver",
+ "myworkflow.t2flow" });
+ new CommandLineOptionsImpl(new String[] { "-provenance", "-dbproperties",
+ "dbproperties.properties", "myworkflow.t2flow" });
+ }
+
+ @Test
+ public void testHasInputDelimiter() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-inputvalue","in1","1,2,3","-inputdelimiter","in1",",","-inputdelimiter","in2",",","myworkflow.t2flow" });
+ assertTrue(options.hasDelimiterFor("in1"));
+ assertTrue(options.hasDelimiterFor("in2"));
+ assertFalse(options.hasDelimiterFor("in3"));
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void testInputDelimiterInvalidWithInputDoc() throws Exception {
+ new CommandLineOptionsImpl(new String[] {
+ "-inputdoc","doc.xml","-inputdelimiter","in1",",","myworkflow.t2flow" });
+ }
+
+
+ @Test
+ public void testInputDelimiter() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-inputvalue","in1","1,2,3","-inputdelimiter","in1",",","-inputdelimiter","in2","!","myworkflow.t2flow" });
+ assertEquals(",",options.inputDelimiter("in1"));
+ assertEquals("!",options.inputDelimiter("in2"));
+ assertNull(options.inputDelimiter("in3"));
+ }
+
+ @Test
+ public void testInMemory() throws Exception {
+ CommandLineOptions handler = new CommandLineOptionsImpl(new String[] {
+ "-inmemory", "myworkflow.t2flow" });
+ assertTrue(handler.hasOption("inmemory"));
+ }
+
+ @Test
+ public void testEmbedded() throws Exception {
+ CommandLineOptions handler = new CommandLineOptionsImpl(new String[] {
+ "-embedded", "myworkflow.t2flow" });
+ assertTrue(handler.hasOption("embedded"));
+ }
+
+ @Test
+ public void testClientServer() throws Exception {
+ CommandLineOptions handler = new CommandLineOptionsImpl(new String[] {
+ "-clientserver", "myworkflow.t2flow" });
+ assertTrue(handler.hasOption("clientserver"));
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void testInvalidEmbeddedAndClientServer() throws Exception {
+ new CommandLineOptionsImpl(new String[] { "-clientserver", "-embedded",
+ "myworkflow.t2flow" });
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void testInvalidEmbeddedAndMemory() throws Exception {
+ new CommandLineOptionsImpl(new String[] { "-embedded", "-inmemory",
+ "myworkflow.t2flow" });
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ public void testInvalidClientServerAndInMemory() throws Exception {
+ new CommandLineOptionsImpl(new String[] { "-clientserver", "-inmemory",
+ "myworkflow.t2flow" });
+ }
+
+ @Test
+ public void isInMemory() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-inmemory", "myworkflow.t2flow" });
+
+ assertTrue(options.isInMemory());
+ assertFalse(options.isClientServer());
+ assertFalse(options.isEmbedded());
+ }
+
+ @Test
+ public void isClientServer() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-clientserver", "myworkflow.t2flow" });
+
+ assertTrue(options.isClientServer());
+ assertFalse(options.isInMemory());
+ assertFalse(options.isEmbedded());
+ }
+
+ @Test
+ public void hasLogFile() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-logfile","/tmp/logging", "myworkflow.t2flow" });
+
+ assertTrue(options.hasLogFile());
+ assertEquals("/tmp/logging", options.getLogFile());
+ }
+
+ @Test(expected = InvalidOptionException.class)
+ @SuppressWarnings("unused")
+ public void hasLogFileNotValidWithoutWorkflow() throws Exception{
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-logfile","/tmp/logging"});
+ }
+
+ @Test
+ public void isEmbedded() throws Exception {
+ CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
+ "-embedded", "myworkflow.t2flow" });
+
+ assertTrue(options.isEmbedded());
+ assertFalse(options.isInMemory());
+ assertFalse(options.isClientServer());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-launcher/src/test/java/uk/org/taverna/commandline/TestCommandLineOptionsHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-launcher/src/test/java/uk/org/taverna/commandline/TestCommandLineOptionsHandler.java b/taverna-commandline-launcher/src/test/java/uk/org/taverna/commandline/TestCommandLineOptionsHandler.java
deleted file mode 100644
index 3e1d0f4..0000000
--- a/taverna-commandline-launcher/src/test/java/uk/org/taverna/commandline/TestCommandLineOptionsHandler.java
+++ /dev/null
@@ -1,267 +0,0 @@
-package uk.org.taverna.commandline;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-
-import org.junit.Test;
-
-public class TestCommandLineOptionsHandler {
-
- @Test
- public void testWorkflowName() throws Exception {
- CommandLineOptions handler = new CommandLineOptionsImpl(
- new String[] { "myworkflow.t2flow" });
- assertEquals("myworkflow.t2flow", handler.getWorkflow());
- }
-
- @Test
- public void shouldShowHelp() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(
- new String[] { "-help" });
- assertTrue(options.askedForHelp());
- options = new CommandLineOptionsImpl(
- new String[] {});
- assertTrue(options.askedForHelp());
- options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
- assertFalse(options.askedForHelp());
- }
-
- @Test
- public void getWorkflow() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(
- new String[] { "-help" });
- assertNull(options.getWorkflow());
- options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
- assertEquals("myworkflow.t2flow", options.getWorkflow());
- }
-
- @Test(expected = InvalidOptionException.class)
- public void cannotProvideInputFileAndInputDoc() throws Exception {
- new CommandLineOptionsImpl(new String[] { "-inputfile", "fred", "fred.txt",
- "-inputdoc", "myworkflow.t2flow" });
- }
-
- @Test(expected = InvalidOptionException.class)
- public void cannotProvideInputValueAndInputDoc() throws Exception {
- new CommandLineOptionsImpl(new String[] { "-inputvalue", "fred", "fred.txt",
- "-inputdoc", "myworkflow.t2flow" });
- }
-
- @Test
- public void canProvideInputValueAndFileTogether() throws Exception {
- //should not be an error
- new CommandLineOptionsImpl(new String[] { "-inputvalue", "fred", "abc",
- "-inputfile","fred2","fred2.txt","myworkflow.t2flow" });
- }
-
- @Test
- public void getInputs() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-inputfile", "fred", "fred.txt", "myworkflow.t2flow" });
- assertEquals(2, options.getInputFiles().length);
- assertEquals("fred", options.getInputFiles()[0]);
- assertEquals("fred.txt", options.getInputFiles()[1]);
-
- options = new CommandLineOptionsImpl(new String[] { "-inputfile", "fred",
- "fred.txt", "-inputfile", "fred2", "fred2.txt",
- "myworkflow.t2flow" });
- assertEquals(4, options.getInputFiles().length);
- assertEquals("fred", options.getInputFiles()[0]);
- assertEquals("fred.txt", options.getInputFiles()[1]);
- assertEquals("fred2", options.getInputFiles()[2]);
- assertEquals("fred2.txt", options.getInputFiles()[3]);
-
- options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
- assertNotNull(options.getInputFiles());
- assertEquals(0, options.getInputFiles().length);
-
- }
-
- @Test
- public void hasInputValue() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-inputvalue", "fred", "abc", "myworkflow.t2flow" });
- assertTrue(options.hasInputValues());
-
- options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
- assertFalse(options.hasInputValues());
- }
-
- @Test
- public void getInputValues() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-inputvalue", "fred", "abc", "myworkflow.t2flow" });
- assertEquals(2, options.getInputValues().length);
-
- options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
- assertNotNull(options.getInputValues());
- assertEquals(0,options.getInputValues().length);
- }
-
- @Test
- public void hasInputs() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-inputfile", "fred", "fred.txt", "myworkflow.t2flow" });
- assertTrue(options.hasInputFiles());
-
- options = new CommandLineOptionsImpl(new String[] { "myworkflow.t2flow" });
- assertFalse(options.hasInputFiles());
- }
-
- @Test
- public void noWorkflowNameButStartDB() throws Exception {
- // should not throw an error
- CommandLineOptions options = new CommandLineOptionsImpl(
- new String[] { "-startdb" });
- assertTrue(options.getStartDatabase());
- assertTrue(options.getStartDatabaseOnly());
- }
-
- @Test
- public void workflowNameAndStartDB() throws Exception {
- // should not throw an error
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-startdb", "myworkflow.t2flow" });
- assertTrue(options.getStartDatabase());
- assertFalse(options.getStartDatabaseOnly());
- }
-
- @Test(expected = InvalidOptionException.class)
- public void provenanceButNoDatabase() throws Exception {
- new CommandLineOptionsImpl(new String[] { "-provenance",
- "myworkflow.t2flow" });
- }
-
- @Test(expected = InvalidOptionException.class)
- public void provenanceButNoDatabase2() throws Exception {
- new CommandLineOptionsImpl(new String[] { "-provenance", "-inmemory",
- "myworkflow.t2flow" });
- }
-
- @Test
- public void provenanceDatabase() throws Exception {
- // should be no errors
- new CommandLineOptionsImpl(new String[] { "-provenance", "-embedded",
- "myworkflow.t2flow" });
- new CommandLineOptionsImpl(new String[] { "-provenance", "-clientserver",
- "myworkflow.t2flow" });
- new CommandLineOptionsImpl(new String[] { "-provenance", "-dbproperties",
- "dbproperties.properties", "myworkflow.t2flow" });
- }
-
- @Test
- public void testHasInputDelimiter() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-inputvalue","in1","1,2,3","-inputdelimiter","in1",",","-inputdelimiter","in2",",","myworkflow.t2flow" });
- assertTrue(options.hasDelimiterFor("in1"));
- assertTrue(options.hasDelimiterFor("in2"));
- assertFalse(options.hasDelimiterFor("in3"));
- }
-
- @Test(expected = InvalidOptionException.class)
- public void testInputDelimiterInvalidWithInputDoc() throws Exception {
- new CommandLineOptionsImpl(new String[] {
- "-inputdoc","doc.xml","-inputdelimiter","in1",",","myworkflow.t2flow" });
- }
-
-
- @Test
- public void testInputDelimiter() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-inputvalue","in1","1,2,3","-inputdelimiter","in1",",","-inputdelimiter","in2","!","myworkflow.t2flow" });
- assertEquals(",",options.inputDelimiter("in1"));
- assertEquals("!",options.inputDelimiter("in2"));
- assertNull(options.inputDelimiter("in3"));
- }
-
- @Test
- public void testInMemory() throws Exception {
- CommandLineOptions handler = new CommandLineOptionsImpl(new String[] {
- "-inmemory", "myworkflow.t2flow" });
- assertTrue(handler.hasOption("inmemory"));
- }
-
- @Test
- public void testEmbedded() throws Exception {
- CommandLineOptions handler = new CommandLineOptionsImpl(new String[] {
- "-embedded", "myworkflow.t2flow" });
- assertTrue(handler.hasOption("embedded"));
- }
-
- @Test
- public void testClientServer() throws Exception {
- CommandLineOptions handler = new CommandLineOptionsImpl(new String[] {
- "-clientserver", "myworkflow.t2flow" });
- assertTrue(handler.hasOption("clientserver"));
- }
-
- @Test(expected = InvalidOptionException.class)
- public void testInvalidEmbeddedAndClientServer() throws Exception {
- new CommandLineOptionsImpl(new String[] { "-clientserver", "-embedded",
- "myworkflow.t2flow" });
- }
-
- @Test(expected = InvalidOptionException.class)
- public void testInvalidEmbeddedAndMemory() throws Exception {
- new CommandLineOptionsImpl(new String[] { "-embedded", "-inmemory",
- "myworkflow.t2flow" });
- }
-
- @Test(expected = InvalidOptionException.class)
- public void testInvalidClientServerAndInMemory() throws Exception {
- new CommandLineOptionsImpl(new String[] { "-clientserver", "-inmemory",
- "myworkflow.t2flow" });
- }
-
- @Test
- public void isInMemory() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-inmemory", "myworkflow.t2flow" });
-
- assertTrue(options.isInMemory());
- assertFalse(options.isClientServer());
- assertFalse(options.isEmbedded());
- }
-
- @Test
- public void isClientServer() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-clientserver", "myworkflow.t2flow" });
-
- assertTrue(options.isClientServer());
- assertFalse(options.isInMemory());
- assertFalse(options.isEmbedded());
- }
-
- @Test
- public void hasLogFile() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-logfile","/tmp/logging", "myworkflow.t2flow" });
-
- assertTrue(options.hasLogFile());
- assertEquals("/tmp/logging", options.getLogFile());
- }
-
- @Test(expected = InvalidOptionException.class)
- @SuppressWarnings("unused")
- public void hasLogFileNotValidWithoutWorkflow() throws Exception{
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-logfile","/tmp/logging"});
- }
-
- @Test
- public void isEmbedded() throws Exception {
- CommandLineOptions options = new CommandLineOptionsImpl(new String[] {
- "-embedded", "myworkflow.t2flow" });
-
- assertTrue(options.isEmbedded());
- assertFalse(options.isInMemory());
- assertFalse(options.isClientServer());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-product/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-product/pom.xml b/taverna-commandline-product/pom.xml
index 5751c3d..df940b5 100644
--- a/taverna-commandline-product/pom.xml
+++ b/taverna-commandline-product/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
</parent>
<artifactId>taverna-command-line-product</artifactId>
<name>Apache Taverna Commandline Product</name>
@@ -100,7 +100,7 @@
</frameworkConfiguration>
<frameworkConfiguration>
<name>org.osgi.framework.system.packages.extra</name>
- <value>com.sun.org.apache.xml.internal.utils,com.sun.source.util,com.sun.source.tree,org.apache.log4j;version=${log4j.version},net.sf.taverna.t2.commandline.options;version=${project.parent.version}</value>
+ <value>com.sun.org.apache.xml.internal.utils,com.sun.source.util,com.sun.source.tree,org.apache.log4j;version=${log4j.version},org.apache.taverna.commandline.options;version=${project.parent.version}</value>
</frameworkConfiguration>
<frameworkConfiguration>
<name>org.osgi.framework.storage.clean</name>
@@ -431,7 +431,7 @@
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-osgi</artifactId>
- <version>2.12.2-SNAPSHOT</version>
+ <version>2.13.0</version>
</dependency>
<!-- slf4j implementation -->
<!-- The bundle "org.purl.wf4ever.robundle_0.3.1 " could not be resolved. Reason: Missing Constraint: Import-Package: org.slf4j; version="[1.7.0,2.0.0)"-->
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/pom.xml b/taverna-commandline-tests/pom.xml
index 1fe77cd..b62b356 100644
--- a/taverna-commandline-tests/pom.xml
+++ b/taverna-commandline-tests/pom.xml
@@ -32,8 +32,9 @@
<dependency>
<groupId>org.apache.taverna.language</groupId>
<artifactId>taverna-scufl2-wfbundle</artifactId>
- <version>${taverna.language.version}</version>
+ <version>0.15.0-incubating-SNAPSHOT</version>
<scope>test</scope>
+ <type>jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -67,5 +68,12 @@
<version>1.1.2</version>
<scope>test</scope>
</dependency> -->
+ <dependency>
+ <groupId>org.apache.taverna.language</groupId>
+ <artifactId>taverna-scufl2-api</artifactId>
+ <version>0.15.0-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ <type>jar</type>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/TavernaCommandLineTest.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/TavernaCommandLineTest.java b/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/TavernaCommandLineTest.java
new file mode 100644
index 0000000..2ed7a11
--- /dev/null
+++ b/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/TavernaCommandLineTest.java
@@ -0,0 +1,485 @@
+/*******************************************************************************
+ * Copyright (C) 2012 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 org.apache.taverna.commandline;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.URI;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.comparator.NameFileComparator;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.taverna.commandline.WorkflowTestSuite.Workflows;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.rdfxml.RDFXMLReader;
+
+/**
+ * Regression tests for Taverna Command Line Tool.
+ *
+ * @author David Withers
+ */
+@RunWith(WorkflowTestSuite.class)
+public class TavernaCommandLineTest {
+
+ private static String baseVersion = "2.4.0";
+ private static boolean baseVersionReleased = true;
+
+ private static String testVersion = "3.0.1-SNAPSHOT";
+ private static boolean testVersionReleased = false;
+ private static boolean testVersionSupportsScufl2 = true;
+
+ private static String script = "executeworkflow.sh";
+ private static String baseName = "taverna-commandline-" + baseVersion;
+ private static String testName = "taverna-command-line-" + testVersion;
+ private static String releasedLocation = "https://launchpad.net/taverna/t2/";
+ private static String unreleasedLocation = "http://build.mygrid.org.uk/ci/job/t3-taverna-commandline-product/lastSuccessfulBuild/net.sf.taverna.t2$taverna-commandline/artifact/net.sf.taverna.t2/taverna-commandline/";
+
+ private static String baseVersionLocation = (baseVersionReleased ? releasedLocation
+ : unreleasedLocation) + baseVersion + "/+download/" + baseName + ".zip";
+ private static String testVersionLocation = (testVersionReleased ? releasedLocation
+ : unreleasedLocation)
+ + testVersion
+ + "/"
+ + testName
+ + (testVersionReleased ? ".zip" : "-bin.zip");
+
+ private static String baseCommand;
+ private static String testCommand;
+
+ private static File buildDirectory;
+
+ private File workflowDirectory;
+ private File baseOutput;
+ private File testOutput;
+ private boolean secure;
+ private List<File> inputs;
+ private String ignorePort;
+ private String message;
+
+ public TavernaCommandLineTest(File workflowDirectory) throws Exception {
+ this.workflowDirectory = workflowDirectory;
+ if (buildDirectory == null) {
+ String buildDirectoryLocation = System.getProperty("buildDirectory");
+ if (buildDirectoryLocation == null) {
+ buildDirectoryLocation = System.getProperty("user.dir")
+ + System.getProperty("file.separator") + "target";
+ }
+ buildDirectory = new File(buildDirectoryLocation);
+ buildDirectory.mkdirs();
+ }
+ if (baseCommand == null) {
+ File commandDirectory = new File(buildDirectory, baseName);
+ if (!commandDirectory.exists()) {
+ System.out.println("Fetching " + baseName);
+ fetchTaverna(baseVersionLocation, baseName);
+ }
+ baseCommand = new File(baseName, script).getPath();
+ }
+ if (testCommand == null) {
+ File commandDirectory = new File(buildDirectory, testName);
+ if (!commandDirectory.exists()) {
+ System.out.println("Fetching " + testName);
+ fetchTaverna(testVersionLocation, testName);
+ }
+ testCommand = new File(testName, script).getPath();
+ }
+ File outputsDirectory = new File(buildDirectory, "test-outputs");
+ baseOutput = new File(outputsDirectory, workflowDirectory.getName() + "-" + baseVersion);
+ testOutput = new File(outputsDirectory, workflowDirectory.getName() + "-" + testVersion);
+ secure = workflowDirectory.getName().startsWith("secure");
+ inputs = getInputs();
+ ignorePort = getIgnorePort();
+ message = "Running {0} with version {1}";
+ }
+
+ @Workflows
+ public static List<File> workflows() {
+ List<File> workflows = new ArrayList<File>();
+ for (File workflowDirectory : getResources("workflows")) {
+ workflows.add(workflowDirectory);
+ }
+ for (File workflowDirectory : getResources("myexperiment")) {
+ workflows.add(workflowDirectory);
+ }
+ return workflows;
+ }
+
+ @Before
+ public void setup() throws Exception {
+ if (!baseOutput.exists()) {
+ if (baseVersion.equals("2.3.0") && workflowDirectory.getName().equals("tool"))
+ return;// version 2.3.0 is missing tool plugin
+ String workflow = getWorkflow().toASCIIString();
+ System.out.println(MessageFormat.format(message, workflow, baseVersion)
+ + (inputs.size() > 0 ? " using input values" : ""));
+ runWorkflow(baseCommand, workflow, baseOutput, true, secure, false);
+ assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
+ baseOutput.exists());
+ }
+ }
+
+ public boolean testExcluded() {
+ // version 3.0.0 is missing biomoby activity
+ if (testVersion.startsWith("3.") && workflowDirectory.getName().contains("biomoby"))
+ return true;
+ // version 3.0.0 is missing tool activity
+ if (testVersion.startsWith("3.")
+ && workflowDirectory.getName().equals("unix_external_tools_with_zip_and_unzip"))
+ return true;
+ if (testVersion.startsWith("3.")
+ && workflowDirectory.getName().equals("unix_numerically_adding_two_values"))
+ return true;
+ if (testVersion.startsWith("3.")
+ && workflowDirectory.getName().equals("unix_tool_service_using_string_replacement"))
+ return true;
+ // version 3.0.0 is missing looping configuration
+ if (testVersion.startsWith("3.")
+ && workflowDirectory.getName().equals("ebi_interproscan_newservices"))
+ return true;
+ if (testVersion.startsWith("3.")
+ && workflowDirectory.getName().equals("biomartandembossanalysis"))
+ return true;
+ return false;
+ }
+
+ @Test
+ public void testWorkflowWithoutInputs() throws Exception {
+ assumeTrue(!testExcluded());
+ assumeTrue(baseOutput.exists());
+ assumeTrue(inputs.isEmpty());
+ FileUtils.deleteDirectory(testOutput);
+ String workflow = getWorkflow().toASCIIString();
+ System.out.println(MessageFormat.format(message, workflow, testVersion));
+ runWorkflow(testCommand, workflow, testOutput, true, secure, false);
+ assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
+ testOutput.exists());
+ assertOutputsEquals(baseOutput, testOutput);
+ }
+
+ @Test
+ public void testWorkflowWithInputValues() throws Exception {
+ assumeTrue(!testExcluded());
+ assumeTrue(baseOutput.exists());
+ assumeTrue(inputs.size() > 0);
+ FileUtils.deleteDirectory(testOutput);
+ String workflow = getWorkflow().toASCIIString();
+ System.out.println(MessageFormat.format(message, workflow, testVersion)
+ + " using input values");
+ runWorkflow(testCommand, workflow, testOutput, true, secure, false);
+ assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
+ testOutput.exists());
+ assertOutputsEquals(baseOutput, testOutput);
+ }
+
+ @Test
+ public void testWorkflowWithInputFiles() throws Exception {
+ assumeTrue(!testExcluded());
+ assumeTrue(baseOutput.exists());
+ assumeTrue(inputs.size() > 0);
+ FileUtils.deleteDirectory(testOutput);
+ String workflow = getWorkflow().toASCIIString();
+ System.out.println(MessageFormat.format(message, workflow, testVersion)
+ + " using input files");
+ runWorkflow(testCommand, workflow, testOutput, false, secure, false);
+ assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
+ testOutput.exists());
+ assertOutputsEquals(baseOutput, testOutput);
+ }
+
+ @Test
+ @Ignore
+ public void testWorkflowWithDatabase() throws Exception {
+ assumeTrue(!testExcluded());
+ assumeTrue(baseOutput.exists());
+ assumeTrue(inputs.size() > 0);
+ FileUtils.deleteDirectory(testOutput);
+ String workflow = getWorkflow().toASCIIString();
+ System.out
+ .println(MessageFormat.format(message, workflow, testVersion) + " using database");
+ runWorkflow(testCommand, workflow, testOutput, true, secure, true);
+ assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
+ testOutput.exists());
+ assertOutputsEquals(baseOutput, testOutput);
+ }
+
+ @Test
+ public void testScufl2Workflow() throws Exception {
+ assumeTrue(!testExcluded());
+ assumeTrue(baseOutput.exists());
+ assumeTrue(testVersionSupportsScufl2);
+
+ FileUtils.deleteDirectory(testOutput);
+ String workflow = getScufl2Workflow().toASCIIString();
+ System.out.println(MessageFormat.format(message, workflow, testVersion)
+ + (inputs.size() > 0 ? " using input values" : ""));
+ runWorkflow(testCommand, workflow, testOutput, true, secure, true);
+ assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
+ testOutput.exists());
+ assertOutputsEquals(baseOutput, testOutput);
+ }
+
+ private synchronized void runWorkflow(String command, String workflow, File outputsDirectory,
+ boolean inputValues, boolean secure, boolean database) throws Exception {
+ ProcessBuilder processBuilder = new ProcessBuilder("sh", command);
+ processBuilder.redirectErrorStream(true);
+ processBuilder.directory(buildDirectory);
+ List<String> args = processBuilder.command();
+ for (File input : inputs) {
+ if (inputValues) {
+ args.add("-inputvalue");
+ args.add(input.getName());
+ args.add(IOUtils.toString(new FileReader(input)));
+ } else {
+ args.add("-inputfile");
+ args.add(input.getName());
+ args.add(input.getAbsolutePath());
+ }
+ }
+ args.add("-outputdir");
+ args.add(outputsDirectory.getPath());
+ if (secure) {
+ args.add("-cmdir");
+ args.add(getClass().getResource("/security").getFile());
+ args.add("-cmpassword");
+ }
+ if (database) {
+ args.add("-embedded");
+ }
+ args.add(workflow);
+ Process process = processBuilder.start();
+ if (secure) {
+ PrintStream outputStream = new PrintStream(process.getOutputStream());
+ outputStream.println("test");
+ outputStream.flush();
+ }
+ waitFor(process);
+ }
+
+ private URI getWorkflow() throws Exception {
+ File workflow = new File(workflowDirectory, workflowDirectory.getName() + ".t2flow");
+ if (!workflow.exists()) {
+ workflow = new File(workflowDirectory, workflowDirectory.getName() + ".url");
+ return new URI(IOUtils.toString(new FileReader(workflow)));
+ }
+ return workflow.toURI();
+ }
+
+ private URI getScufl2Workflow() throws Exception {
+ File workflow = new File(buildDirectory, workflowDirectory.getName() + ".wfbundle");
+ // if (!workflow.exists()) {
+ WorkflowBundleIO workflowBundleIO = new WorkflowBundleIO();
+ WorkflowBundle bundle = workflowBundleIO.readBundle(getWorkflow().toURL(), null);
+ workflowBundleIO.writeBundle(bundle, workflow,
+ RDFXMLReader.APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
+ // }
+ return workflow.toURI();
+ }
+
+ private synchronized int waitFor(Process process) throws IOException {
+ while (true) {
+ try {
+ wait(500);
+ } catch (InterruptedException e) {
+ }
+ IOUtils.copy(process.getInputStream(), System.out);
+ try {
+ return process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ }
+ }
+ }
+
+ private void assertOutputsEquals(File directory1, File directory2) {
+ File[] directory1Files = directory1.listFiles();
+ File[] directory2Files = directory2.listFiles();
+ // assert directories contain same number of files
+ assertEquals(String.format("%s has %s files but %s has %s files", directory1.getName(),
+ directory1Files.length, directory2.getName(), directory2Files.length),
+ directory1Files.length, directory2Files.length);
+ // sort files in directory
+ Arrays.sort(directory1Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
+ Arrays.sort(directory2Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
+ for (int i = 0; i < directory1Files.length; i++) {
+ assertFilesEqual(directory1Files[i], directory2Files[i], !directory1Files[i].getName()
+ .equals(ignorePort));
+ }
+ }
+
+ private void assertDirectoriesEquals(File directory1, File directory2, boolean checkFileContents) {
+ if (directory1.exists()) {
+ assertTrue(String.format("%s exists but %s does not", directory1, directory2),
+ directory2.exists());
+ } else {
+ assertFalse(String.format("%s does not exists but %s does", directory1, directory2),
+ directory2.exists());
+ }
+ File[] directory1Files = directory1.listFiles();
+ File[] directory2Files = directory2.listFiles();
+ // assert directories contain same number of files
+ assertEquals(String.format("%s has %s files but %s has %s files", directory1.getName(),
+ directory1Files.length, directory2.getName(), directory2Files.length),
+ directory1Files.length, directory2Files.length);
+ // sort files in directory
+ Arrays.sort(directory1Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
+ Arrays.sort(directory2Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
+ for (int i = 0; i < directory1Files.length; i++) {
+ assertFilesEqual(directory1Files[i], directory2Files[i], checkFileContents);
+ }
+ }
+
+ private void assertFilesEqual(File file1, File file2, boolean checkFileContents) {
+ if (file1.isHidden()) {
+ assertTrue(String.format("%s is hidden but %s is not", file1, file2), file2.isHidden());
+ } else {
+ assertFalse(String.format("%s is not hidden but %s is", file1, file2), file2.isHidden());
+ assertEquals(file1.getName(), file2.getName());
+ if (file1.isDirectory()) {
+ assertTrue(String.format("%s is a directory but %s is not", file1, file2),
+ file2.isDirectory());
+ assertDirectoriesEquals(file1, file2, checkFileContents);
+ } else {
+ assertFalse(String.format("%s is not a directory but %s is", file1, file2),
+ file2.isDirectory());
+ if (isZipFile(file1)) {
+ assertZipFilesEqual(file1, file2);
+ } else if (checkFileContents) {
+ assertEquals(String.format("%s is a different length to %s", file1, file2),
+ file1.length(), file2.length());
+ try {
+ byte[] byteArray1 = IOUtils.toByteArray(new FileReader(file1));
+ byte[] byteArray2 = IOUtils.toByteArray(new FileReader(file2));
+ assertArrayEquals(String.format("%s != %s", file1, file2), byteArray1,
+ byteArray2);
+ } catch (FileNotFoundException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ }
+ }
+ }
+ }
+
+ private void assertZipFilesEqual(File file1, File file2) {
+ ZipFile zipFile1 = null;
+ ZipFile zipFile2 = null;
+ try {
+ zipFile1 = new ZipFile(file1);
+ zipFile2 = new ZipFile(file2);
+ } catch (Exception e) {
+ assertTrue(String.format("%s and %s are not both zip files"), zipFile1 == null);
+ }
+ if (zipFile1 != null && zipFile2 != null) {
+ Enumeration<? extends ZipEntry> entries1 = zipFile1.entries();
+ Enumeration<? extends ZipEntry> entries2 = zipFile2.entries();
+ while (entries1.hasMoreElements()) {
+ assertTrue(entries2.hasMoreElements());
+ ZipEntry zipEntry1 = entries1.nextElement();
+ ZipEntry zipEntry2 = entries2.nextElement();
+ assertEquals(
+ String.format("%s and %s are not both directories", zipEntry1, zipEntry2),
+ zipEntry1.isDirectory(), zipEntry2.isDirectory());
+ assertEquals(String.format("%s and %s have different names", zipEntry1, zipEntry2),
+ zipEntry1.getName(), zipEntry2.getName());
+ assertEquals(String.format("%s and %s have different sizes", zipEntry1, zipEntry2),
+ zipEntry1.getSize(), zipEntry2.getSize());
+ try {
+ byte[] byteArray1 = IOUtils.toByteArray(zipFile1.getInputStream(zipEntry1));
+ byte[] byteArray2 = IOUtils.toByteArray(zipFile2.getInputStream(zipEntry2));
+ assertArrayEquals(String.format("%s != %s", zipEntry1, zipEntry2), byteArray1,
+ byteArray2);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ assertFalse(entries2.hasMoreElements());
+ }
+ }
+
+ private boolean isZipFile(File file) {
+ try {
+ new ZipFile(file);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ private static File[] getResources(String directory) {
+ return new File(TavernaCommandLineTest.class.getResource("/" + directory).getFile())
+ .listFiles();
+ }
+
+ private List<File> getInputs() {
+ File inputsDirectory = new File(workflowDirectory, "inputs");
+ if (inputsDirectory.exists() && inputsDirectory.isDirectory()) {
+ return Arrays.asList(inputsDirectory.listFiles());
+ }
+ return Collections.emptyList();
+ }
+
+ private String getIgnorePort() throws Exception {
+ File ignorePort = new File(workflowDirectory, "ignorePort");
+ if (ignorePort.exists()) {
+ return IOUtils.toString(new FileReader(ignorePort));
+ }
+ return "";
+ }
+
+ private void fetchTaverna(String location, String name) throws Exception {
+ File zipFile = new File(buildDirectory, name + ".zip");
+ IOUtils.copy(new URL(location).openStream(), new FileOutputStream(zipFile));
+ ProcessBuilder processBuilder = new ProcessBuilder("unzip", "-q", name);
+ processBuilder.redirectErrorStream(true);
+ processBuilder.directory(buildDirectory);
+ System.out.println(processBuilder.command());
+ Process process = processBuilder.start();
+ waitFor(process);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestRunner.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestRunner.java b/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestRunner.java
new file mode 100644
index 0000000..7fca90e
--- /dev/null
+++ b/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestRunner.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (C) 2012 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 org.apache.taverna.commandline;
+
+import java.io.File;
+import java.util.List;
+
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+/**
+ * Test runner for running workflows.
+ *
+ * @author David Withers
+ */
+public class WorkflowTestRunner extends BlockJUnit4ClassRunner {
+ private File workflow;
+
+ public WorkflowTestRunner(Class<?> type, File workflow) throws InitializationError {
+ super(type);
+ this.workflow = workflow;
+ }
+
+ @Override
+ public Object createTest() throws Exception {
+ return getTestClass().getOnlyConstructor().newInstance(workflow);
+ }
+
+ @Override
+ protected String getName() {
+ return String.format("[%s]", workflow.getName());
+ }
+
+ @Override
+ protected String testName(final FrameworkMethod method) {
+ return String.format("%s[%s]", method.getName(), workflow.getName());
+ }
+
+ @Override
+ protected void validateConstructor(List<Throwable> errors) {
+ validateOnlyOneConstructor(errors);
+ }
+
+ @Override
+ protected Statement classBlock(RunNotifier notifier) {
+ return childrenInvoker(notifier);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestSuite.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestSuite.java b/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestSuite.java
new file mode 100644
index 0000000..a441aea
--- /dev/null
+++ b/taverna-commandline-tests/src/test/java/org/apache/taverna/commandline/WorkflowTestSuite.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (C) 2012 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 org.apache.taverna.commandline;
+
+import java.io.File;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.runner.Runner;
+import org.junit.runners.Suite;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.TestClass;
+
+/**
+ * Test suite for running workflows specified by a method annotated by @Workflows.
+ *
+ * @author David Withers
+ */
+public class WorkflowTestSuite extends Suite {
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.METHOD)
+ public static @interface Workflows {}
+
+ private ArrayList<Runner> runners = new ArrayList<Runner>();
+
+ public WorkflowTestSuite(Class<?> klass) throws Throwable {
+ super(klass, Collections.<Runner>emptyList());
+ for (File workflow : getWorkflows(getTestClass())) {
+ runners.add(new WorkflowTestRunner(getTestClass().getJavaClass(), workflow));
+ }
+ }
+
+ @Override
+ protected List<Runner> getChildren() {
+ return runners;
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<File> getWorkflows(TestClass klass) throws Throwable {
+ return (List<File>) getWorkflowsMethod(klass).invokeExplosively(null);
+ }
+
+ public FrameworkMethod getWorkflowsMethod(TestClass testClass) throws Exception {
+ List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Workflows.class);
+ for (FrameworkMethod method : methods) {
+ int modifiers = method.getMethod().getModifiers();
+ if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
+ return method;
+ }
+ }
+ throw new Exception("No public static Workflows annotated method on class " + testClass.getName());
+ }
+
+}
[5/5] incubator-taverna-commandline git commit: package name changes
Posted by re...@apache.org.
package name changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/commit/9965dffe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/tree/9965dffe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/diff/9965dffe
Branch: refs/heads/master
Commit: 9965dffe95f0a9568f3defde1b20487c96024b02
Parents: 7db5214
Author: Dmitry Repchevsky <re...@list.ru>
Authored: Tue Mar 24 11:44:58 2015 +0100
Committer: Dmitry Repchevsky <re...@list.ru>
Committed: Tue Mar 24 11:44:58 2015 +0100
----------------------------------------------------------------------
pom.xml | 2 +-
taverna-commandline-api/pom.xml | 2 +-
.../exceptions/ArgumentsParsingException.java | 34 --
.../CommandLineMasterPasswordException.java | 34 --
.../DatabaseConfigurationException.java | 43 --
.../exceptions/InputMismatchException.java | 61 ---
.../exceptions/InvalidOptionException.java | 30 --
.../exceptions/OpenDataflowException.java | 44 --
.../exceptions/ReadInputException.java | 35 --
.../exceptions/SaveResultsException.java | 34 --
.../commandline/options/CommandLineOptions.java | 119 -----
.../exceptions/ArgumentsParsingException.java | 33 ++
.../CommandLineMasterPasswordException.java | 33 ++
.../DatabaseConfigurationException.java | 42 ++
.../exceptions/InputMismatchException.java | 60 +++
.../exceptions/InvalidOptionException.java | 29 ++
.../exceptions/OpenDataflowException.java | 43 ++
.../exceptions/ReadInputException.java | 34 ++
.../exceptions/SaveResultsException.java | 33 ++
.../commandline/options/CommandLineOptions.java | 118 +++++
taverna-commandline-common/pom.xml | 2 +-
.../CommandLineMasterPasswordProvider.java | 184 -------
.../taverna/t2/commandline/CommandLineTool.java | 437 -----------------
.../data/DatabaseConfigurationHandler.java | 154 ------
.../t2/commandline/data/ErrorValueHandler.java | 72 ---
.../t2/commandline/data/InputsHandler.java | 277 -----------
.../t2/commandline/data/SaveResultsHandler.java | 86 ----
.../CommandLineMasterPasswordProvider.java | 183 +++++++
.../taverna/commandline/CommandLineTool.java | 436 +++++++++++++++++
.../data/DatabaseConfigurationHandler.java | 153 ++++++
.../commandline/data/ErrorValueHandler.java | 71 +++
.../taverna/commandline/data/InputsHandler.java | 276 +++++++++++
.../commandline/data/SaveResultsHandler.java | 85 ++++
.../taverna-commandline-common-context-osgi.xml | 16 +-
.../taverna-commandline-common-context.xml | 4 +-
.../TestDatabaseConfigurationHandler.java | 15 -
.../TestDatabaseConfigurationHandler.java | 33 ++
taverna-commandline-launcher/pom.xml | 2 +-
.../commandline/CommandLineOptionsImpl.java | 444 +++++++++++++++++
.../taverna/commandline/TavernaCommandLine.java | 142 ++++++
.../commandline/CommandLineOptionsImpl.java | 445 -----------------
.../taverna/commandline/TavernaCommandLine.java | 143 ------
.../TestCommandLineOptionsHandler.java | 286 +++++++++++
.../TestCommandLineOptionsHandler.java | 267 ----------
taverna-commandline-product/pom.xml | 6 +-
taverna-commandline-tests/pom.xml | 10 +-
.../commandline/TavernaCommandLineTest.java | 485 +++++++++++++++++++
.../taverna/commandline/WorkflowTestRunner.java | 70 +++
.../taverna/commandline/WorkflowTestSuite.java | 79 +++
.../commandline/TavernaCommandLineTest.java | 485 -------------------
.../taverna/commandline/WorkflowTestRunner.java | 70 ---
.../taverna/commandline/WorkflowTestSuite.java | 79 ---
.../workflows/xmlSplitter/xmlSplitter.t2flow | 206 ++++----
53 files changed, 3297 insertions(+), 3269 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 861f32f..4446961 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
</parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Apache Taverna Command Line</name>
<properties>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/pom.xml b/taverna-commandline-api/pom.xml
index 98ae247..ab49d38 100644
--- a/taverna-commandline-api/pom.xml
+++ b/taverna-commandline-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
</parent>
<packaging>bundle</packaging>
<artifactId>taverna-commandline-api</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java
deleted file mode 100644
index eb21cd7..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ArgumentsParsingException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-@SuppressWarnings("serial")
-public class ArgumentsParsingException extends Exception {
-
- public ArgumentsParsingException(String message) {
- super(message);
- }
-
- public ArgumentsParsingException(String message, Throwable cause) {
- super(message, cause);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java
deleted file mode 100644
index 0714275..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/CommandLineMasterPasswordException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-@SuppressWarnings("serial")
-public class CommandLineMasterPasswordException extends Exception {
-
- public CommandLineMasterPasswordException(String message) {
- super(message);
- }
-
- public CommandLineMasterPasswordException(String message, Throwable cause) {
- super(message, cause);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java
deleted file mode 100644
index 616fb70..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/DatabaseConfigurationException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-public class DatabaseConfigurationException extends Exception {
-
- private static final long serialVersionUID = -4128248547532355697L;
-
- public DatabaseConfigurationException() {
-
- }
-
- public DatabaseConfigurationException(String message) {
- super(message);
- }
-
- public DatabaseConfigurationException(Throwable cause) {
- super(cause);
- }
-
- public DatabaseConfigurationException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java
deleted file mode 100644
index da03891..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InputMismatchException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-import java.util.Set;
-
-public class InputMismatchException extends InvalidOptionException {
-
- private static final long serialVersionUID = -5368068332397293706L;
- private final Set<String> expectedInputNames;
- private final Set<String> providedInputNames;
-
- public InputMismatchException(String msg, Set<String> expectedInputNames, Set<String> providedInputNames) {
- super(msg);
- this.expectedInputNames = expectedInputNames;
- this.providedInputNames = providedInputNames;
- }
-
- public String getMessage() {
- String result = super.getMessage();
-
- if (expectedInputNames != null){
- result += "\n" + expectedInputNames.size() + " inputs were expected";
- if (expectedInputNames.size()>0) result += " which are:\n";
- for (String name : expectedInputNames) {
- result += "'"+name+"' ";
- }
- }
-
- if (providedInputNames != null){
- result += "\n" + providedInputNames.size()
- + " inputs were provided";
- if (providedInputNames.size() > 0)
- result += " which are:\n";
- for (String name : providedInputNames) {
- result += "'" + name + "' ";
- }
- }
- return result;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java
deleted file mode 100644
index c07a19f..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/InvalidOptionException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-public class InvalidOptionException extends Exception {
-
- private static final long serialVersionUID = 2467409785164223258L;
-
- public InvalidOptionException(String message) {
- super(message);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java
deleted file mode 100644
index 664ab71..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/OpenDataflowException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-public class OpenDataflowException extends Exception {
-
-
- private static final long serialVersionUID = 4778578311101082197L;
-
- public OpenDataflowException() {
-
- }
-
- public OpenDataflowException(String message) {
- super(message);
- }
-
- public OpenDataflowException(Throwable cause) {
- super(cause);
- }
-
- public OpenDataflowException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java
deleted file mode 100644
index 226d6ea..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/ReadInputException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-public class ReadInputException extends Exception {
-
- private static final long serialVersionUID = -3494432791254643055L;
-
- public ReadInputException(String msg) {
- super(msg);
- }
-
- public ReadInputException(String msg, Throwable e) {
- super(msg,e);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java
deleted file mode 100644
index 7ad460d..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/exceptions/SaveResultsException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.commandline.exceptions;
-
-@SuppressWarnings("serial")
-public class SaveResultsException extends Exception {
-
- public SaveResultsException(String message) {
- super(message);
- }
-
- public SaveResultsException(String message, Throwable cause) {
- super(message, cause);
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java b/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java
deleted file mode 100644
index dd8e20f..0000000
--- a/taverna-commandline-api/src/main/java/net/sf/taverna/t2/commandline/options/CommandLineOptions.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.commandline.options;
-
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-
-/**
- *
- *
- * @author David Withers
- */
-public interface CommandLineOptions {
-
- public static final String CREDENTIAL_MANAGER_DIR_OPTION = "cmdir";
- public static final String CREDENTIAL_MANAGER_PASSWORD_OPTION = "cmpassword";
-
- public boolean askedForHelp();
-
- public boolean isProvenanceEnabled();
-
- public void displayHelp();
-
- public void displayHelp(boolean showFullText);
-
- public String[] getArgs();
-
- /**
- *
- * @return the port that the database should run on
- */
- public String getDatabasePort();
-
- /**
- *
- * @return a path to a properties file that contains database configuration
- * settings
- */
- public String getDatabaseProperties();
-
- /**
- * Returns an array that alternates between a portname and path to a file
- * containing the input values. Therefore the array will always contain an
- * even number of elements
- *
- * @return an array of portname and path to files containing individual
- * inputs.
- */
- public String[] getInputFiles();
-
- public String[] getInputValues();
-
- public String getLogFile();
-
- /**
- *
- * @return the directory to write the results to
- */
- public String getOutputDirectory();
-
- public boolean getStartDatabase();
-
- /**
- * @return the directory with Credential Manager's files
- */
- public String getCredentialManagerDir();
-
- public boolean getStartDatabaseOnly() throws InvalidOptionException;
-
- public String getWorkflow() throws InvalidOptionException;
-
- public boolean hasDelimiterFor(String inputName);
-
- public boolean hasInputFiles();
-
- public boolean hasInputValues();
-
- public boolean hasLogFile();
-
- public boolean hasOption(String option);
-
- public boolean hasSaveResultsToBundle() ;
-
- public String inputDelimiter(String inputName);
-
- public boolean isClientServer();
-
- public boolean isEmbedded();
-
- public boolean isInMemory();
-
- /**
- * Save the results to a directory if -outputdir has been explicitly defined,
- * or if -outputdoc has not been defined.
- *
- * @return boolean
- */
- public boolean saveResultsToDirectory();
-
- public String saveResultsToBundle();
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java
new file mode 100644
index 0000000..bf3785f
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ArgumentsParsingException.java
@@ -0,0 +1,33 @@
+/*
+* 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.taverna.commandline.exceptions;
+
+@SuppressWarnings("serial")
+public class ArgumentsParsingException extends Exception {
+
+ public ArgumentsParsingException(String message) {
+ super(message);
+ }
+
+ public ArgumentsParsingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java
new file mode 100644
index 0000000..65442ab
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/CommandLineMasterPasswordException.java
@@ -0,0 +1,33 @@
+/*
+* 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.taverna.commandline.exceptions;
+
+@SuppressWarnings("serial")
+public class CommandLineMasterPasswordException extends Exception {
+
+ public CommandLineMasterPasswordException(String message) {
+ super(message);
+ }
+
+ public CommandLineMasterPasswordException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java
new file mode 100644
index 0000000..05da893
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/DatabaseConfigurationException.java
@@ -0,0 +1,42 @@
+/*
+* 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.taverna.commandline.exceptions;
+
+public class DatabaseConfigurationException extends Exception {
+
+ private static final long serialVersionUID = -4128248547532355697L;
+
+ public DatabaseConfigurationException() {
+
+ }
+
+ public DatabaseConfigurationException(String message) {
+ super(message);
+ }
+
+ public DatabaseConfigurationException(Throwable cause) {
+ super(cause);
+ }
+
+ public DatabaseConfigurationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java
new file mode 100644
index 0000000..cae6bfb
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InputMismatchException.java
@@ -0,0 +1,60 @@
+/*
+* 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.taverna.commandline.exceptions;
+
+import java.util.Set;
+
+public class InputMismatchException extends InvalidOptionException {
+
+ private static final long serialVersionUID = -5368068332397293706L;
+ private final Set<String> expectedInputNames;
+ private final Set<String> providedInputNames;
+
+ public InputMismatchException(String msg, Set<String> expectedInputNames, Set<String> providedInputNames) {
+ super(msg);
+ this.expectedInputNames = expectedInputNames;
+ this.providedInputNames = providedInputNames;
+ }
+
+ public String getMessage() {
+ String result = super.getMessage();
+
+ if (expectedInputNames != null){
+ result += "\n" + expectedInputNames.size() + " inputs were expected";
+ if (expectedInputNames.size()>0) result += " which are:\n";
+ for (String name : expectedInputNames) {
+ result += "'"+name+"' ";
+ }
+ }
+
+ if (providedInputNames != null){
+ result += "\n" + providedInputNames.size()
+ + " inputs were provided";
+ if (providedInputNames.size() > 0)
+ result += " which are:\n";
+ for (String name : providedInputNames) {
+ result += "'" + name + "' ";
+ }
+ }
+ return result;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java
new file mode 100644
index 0000000..410803c
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/InvalidOptionException.java
@@ -0,0 +1,29 @@
+/*
+* 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.taverna.commandline.exceptions;
+
+public class InvalidOptionException extends Exception {
+
+ private static final long serialVersionUID = 2467409785164223258L;
+
+ public InvalidOptionException(String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.java
new file mode 100644
index 0000000..3926dd7
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/OpenDataflowException.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.taverna.commandline.exceptions;
+
+public class OpenDataflowException extends Exception {
+
+
+ private static final long serialVersionUID = 4778578311101082197L;
+
+ public OpenDataflowException() {
+
+ }
+
+ public OpenDataflowException(String message) {
+ super(message);
+ }
+
+ public OpenDataflowException(Throwable cause) {
+ super(cause);
+ }
+
+ public OpenDataflowException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java
new file mode 100644
index 0000000..22b6f82
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/ReadInputException.java
@@ -0,0 +1,34 @@
+/*
+* 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.taverna.commandline.exceptions;
+
+public class ReadInputException extends Exception {
+
+ private static final long serialVersionUID = -3494432791254643055L;
+
+ public ReadInputException(String msg) {
+ super(msg);
+ }
+
+ public ReadInputException(String msg, Throwable e) {
+ super(msg,e);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java
new file mode 100644
index 0000000..501b4b5
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/exceptions/SaveResultsException.java
@@ -0,0 +1,33 @@
+/*
+* 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.taverna.commandline.exceptions;
+
+@SuppressWarnings("serial")
+public class SaveResultsException extends Exception {
+
+ public SaveResultsException(String message) {
+ super(message);
+ }
+
+ public SaveResultsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java
new file mode 100644
index 0000000..1b00c96
--- /dev/null
+++ b/taverna-commandline-api/src/main/java/org/apache/taverna/commandline/options/CommandLineOptions.java
@@ -0,0 +1,118 @@
+/*
+* 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.taverna.commandline.options;
+
+import org.apache.taverna.commandline.exceptions.InvalidOptionException;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public interface CommandLineOptions {
+
+ public static final String CREDENTIAL_MANAGER_DIR_OPTION = "cmdir";
+ public static final String CREDENTIAL_MANAGER_PASSWORD_OPTION = "cmpassword";
+
+ public boolean askedForHelp();
+
+ public boolean isProvenanceEnabled();
+
+ public void displayHelp();
+
+ public void displayHelp(boolean showFullText);
+
+ public String[] getArgs();
+
+ /**
+ *
+ * @return the port that the database should run on
+ */
+ public String getDatabasePort();
+
+ /**
+ *
+ * @return a path to a properties file that contains database configuration
+ * settings
+ */
+ public String getDatabaseProperties();
+
+ /**
+ * Returns an array that alternates between a portname and path to a file
+ * containing the input values. Therefore the array will always contain an
+ * even number of elements
+ *
+ * @return an array of portname and path to files containing individual
+ * inputs.
+ */
+ public String[] getInputFiles();
+
+ public String[] getInputValues();
+
+ public String getLogFile();
+
+ /**
+ *
+ * @return the directory to write the results to
+ */
+ public String getOutputDirectory();
+
+ public boolean getStartDatabase();
+
+ /**
+ * @return the directory with Credential Manager's files
+ */
+ public String getCredentialManagerDir();
+
+ public boolean getStartDatabaseOnly() throws InvalidOptionException;
+
+ public String getWorkflow() throws InvalidOptionException;
+
+ public boolean hasDelimiterFor(String inputName);
+
+ public boolean hasInputFiles();
+
+ public boolean hasInputValues();
+
+ public boolean hasLogFile();
+
+ public boolean hasOption(String option);
+
+ public boolean hasSaveResultsToBundle() ;
+
+ public String inputDelimiter(String inputName);
+
+ public boolean isClientServer();
+
+ public boolean isEmbedded();
+
+ public boolean isInMemory();
+
+ /**
+ * Save the results to a directory if -outputdir has been explicitly defined,
+ * or if -outputdoc has not been defined.
+ *
+ * @return boolean
+ */
+ public boolean saveResultsToDirectory();
+
+ public String saveResultsToBundle();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/pom.xml b/taverna-commandline-common/pom.xml
index 0627097..f9af66e 100644
--- a/taverna-commandline-common/pom.xml
+++ b/taverna-commandline-common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
</parent>
<artifactId>taverna-commandline-common</artifactId>
<packaging>bundle</packaging>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java
deleted file mode 100644
index f9a0171..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineMasterPasswordProvider.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008-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.commandline;
-
-import java.io.BufferedReader;
-import java.io.Console;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import net.sf.taverna.t2.commandline.exceptions.CommandLineMasterPasswordException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
-
-import org.apache.log4j.Logger;
-
-/**
- * An implementation of {@link MasterPasswordProvider} that reads Credential Manager's
- * master password from stdin (pipe or terminal) is -cmpassword option is present in command
- * line arguments. Otherwise it tries to read it from a special file password.txt in a special
- * directory specified by -cmdir option, if present.
- *
- * @author Alex Nenadic
- */
-public class CommandLineMasterPasswordProvider implements MasterPasswordProvider {
-
- private static final String CREDENTIAL_MANAGER_MASTER_PASSWORD_OPTION = "cmpassword";
- private static final String CREDENTIAL_MANAGER_DIRECTORY_OPTION = "cmdir";
-
- private static Logger logger = Logger.getLogger(CommandLineMasterPasswordProvider.class);
-
- private String masterPassword = null;
- private int priority = 200;
-
- private boolean finishedReadingPassword = false;
- private final CommandLineOptions commandLineOptions;
-
- public CommandLineMasterPasswordProvider(CommandLineOptions commandLineOptions) {
- this.commandLineOptions = commandLineOptions;
- }
-
- @Override
- public String getMasterPassword(boolean firstTime) {
- if (!finishedReadingPassword) {
- // -cmpassword option was present in the command line arguments
- if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_MASTER_PASSWORD_OPTION)) {
- // Try to read the password from stdin (terminal or pipe)
- try {
- masterPassword = getCredentialManagerPasswordFromStdin();
- } catch (CommandLineMasterPasswordException e) {
- masterPassword = null;
- }
- }
- // -cmpassword option was not present in the command line arguments
- // and -cmdir option was there - try to get the master password from
- // the "special" password file password.txt inside the Cred. Manager directory.
- else {
- if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_DIRECTORY_OPTION)) {
- // Try to read the password from a special file located in
- // Credential Manager directory (if the dir was not null)
- try {
- masterPassword = getCredentialManagerPasswordFromFile();
- } catch (CommandLineMasterPasswordException ex) {
- masterPassword = null;
- }
- }
- }
- finishedReadingPassword = true; // we do not want to attempt to read from stdin several
- // times
- }
- return masterPassword;
- }
-
- public void setMasterPassword(String masterPassword) {
- this.masterPassword = masterPassword;
- finishedReadingPassword = true;
- }
-
- @Override
- public int getProviderPriority() {
- return priority;
- }
-
- private String getCredentialManagerPasswordFromStdin()
- throws CommandLineMasterPasswordException {
-
- String password = null;
-
- Console console = System.console();
-
- if (console == null) { // password is being piped in, not entered in the terminal by user
- BufferedReader buffReader = null;
- try {
- buffReader = new BufferedReader(new InputStreamReader(System.in));
- password = buffReader.readLine();
- } catch (IOException ex) {
- // For some reason the error of the exception thrown
- // does not get printed from the Launcher so print it here as
- // well as it gives more clue as to what is going wrong.
- logger.error(
- "An error occured while trying to read Credential Manager's password that was piped in: "
- + ex.getMessage(), ex);
- throw new CommandLineMasterPasswordException(
- "An error occured while trying to read Credential Manager's password that was piped in: "
- + ex.getMessage(), ex);
- } finally {
- try {
- buffReader.close();
- } catch (Exception ioe1) {
- // Ignore
- }
- }
- } else { // read the password from the terminal as entered by the user
- try {
- // Block until user enters password
- char passwordArray[] = console.readPassword("Password for Credential Manager: ");
- if (passwordArray != null) { // user did not abort input
- password = new String(passwordArray);
- } // else password will be null
-
- } catch (Exception ex) {
- // For some reason the error of the exception thrown
- // does not get printed from the Launcher so print it here as
- // well as it gives more clue as to what is going wrong.
- logger.error(
- "An error occured while trying to read Credential Manager's password from the terminal: "
- + ex.getMessage(), ex);
- throw new CommandLineMasterPasswordException(
- "An error occured while trying to read Credential Manager's password from the terminal: "
- + ex.getMessage(), ex);
- }
- }
- return password;
- }
-
- private String getCredentialManagerPasswordFromFile() throws CommandLineMasterPasswordException {
- String password = null;
- if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_DIRECTORY_OPTION)) {
- String cmDir = commandLineOptions.getCredentialManagerDir();
-
- File passwordFile = new File(cmDir, "password.txt");
- BufferedReader buffReader = null;
- try {
- buffReader = new BufferedReader(new FileReader(passwordFile));
- password = buffReader.readLine();
- } catch (IOException ioe) {
- // For some reason the error of the exception thrown
- // does not get printed from the Launcher so print it here as
- // well as it gives more clue as to what is going wrong.
- logger.error("There was an error reading the Credential Manager password from "
- + passwordFile.toString() + ": " + ioe.getMessage(), ioe);
- throw new CommandLineMasterPasswordException(
- "There was an error reading the Credential Manager password from "
- + passwordFile.toString() + ": " + ioe.getMessage(), ioe);
- } finally {
- try {
- buffReader.close();
- } catch (Exception ioe1) {
- // Ignore
- }
- }
- }
- return password;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java
deleted file mode 100644
index 87be64b..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/CommandLineTool.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*******************************************************************************
- * 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.commandline;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.NamingException;
-
-import net.sf.taverna.t2.commandline.data.DatabaseConfigurationHandler;
-import net.sf.taverna.t2.commandline.data.InputsHandler;
-import net.sf.taverna.t2.commandline.data.SaveResultsHandler;
-import net.sf.taverna.t2.commandline.exceptions.DatabaseConfigurationException;
-import net.sf.taverna.t2.commandline.exceptions.InputMismatchException;
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-import net.sf.taverna.t2.commandline.exceptions.OpenDataflowException;
-import net.sf.taverna.t2.commandline.exceptions.ReadInputException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.RollingFileAppender;
-import org.apache.taverna.databundle.DataBundles;
-import org.apache.taverna.robundle.Bundle;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.validation.ValidationException;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.structural.ReportStructuralValidationListener;
-import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
-
-import uk.org.taverna.configuration.database.DatabaseConfiguration;
-import uk.org.taverna.configuration.database.DatabaseManager;
-import uk.org.taverna.platform.execution.api.ExecutionEnvironment;
-import uk.org.taverna.platform.execution.api.InvalidExecutionIdException;
-import uk.org.taverna.platform.execution.api.InvalidWorkflowException;
-import uk.org.taverna.platform.report.State;
-import uk.org.taverna.platform.report.WorkflowReport;
-import uk.org.taverna.platform.run.api.InvalidRunIdException;
-import uk.org.taverna.platform.run.api.RunProfile;
-import uk.org.taverna.platform.run.api.RunProfileException;
-import uk.org.taverna.platform.run.api.RunService;
-import uk.org.taverna.platform.run.api.RunStateException;
-
-/**
- * A utility class that wraps the process of executing a workflow, allowing workflows to be easily
- * executed independently of the GUI.
- *
- * @author Stuart Owen
- * @author Alex Nenadic
- */
-public class CommandLineTool {
- private static boolean BOOTSTRAP_LOGGING = false;
- private static Logger logger = Logger.getLogger(CommandLineTool.class);
-
- private RunService runService;
- private CredentialManager credentialManager;
- private CommandLineOptions commandLineOptions;
- private WorkflowBundle workflowBundle;
- private WorkflowBundleIO workflowBundleIO;
- private DatabaseConfiguration databaseConfiguration;
- private DatabaseManager databaseManager;
-
- public void run() {
- try {
- if (BOOTSTRAP_LOGGING)
- initialiseLogging();
- int result = setupAndExecute();
- System.exit(result);
- } catch (InvalidOptionException | IOException | ReadInputException
- | InvalidRunIdException | RunStateException
- | InvalidExecutionIdException | OpenDataflowException
- | RunProfileException e) {
- error(e.getMessage());
- } catch (CMException e) {
- error("There was an error initializing Taverna's SSLSocketFactory from Credential Manager. "
- + e.getMessage());
- } catch (ReaderException e) {
- error("There was an error reading the workflow: " + e.getMessage());
- } catch (ValidationException e) {
- error("There was an error validating the workflow: " + e.getMessage());
- } catch (InvalidWorkflowException e) {
- error("There was an error validating the workflow: " + e.getMessage());
- } catch (DatabaseConfigurationException e) {
- error("There was an error configuring the database: " + e.getMessage());
- }
- System.exit(1);
- }
-
- private void initialiseLogging() {
- LogManager.resetConfiguration();
-
- if (System.getProperty("log4j.configuration") == null) {
- try {
- PropertyConfigurator.configure(CommandLineTool.class.getClassLoader()
- .getResource("cl-log4j.properties").toURI().toURL());
- } catch (MalformedURLException e) {
- logger.error("There was a serious error reading the default logging configuration",
- e);
- } catch (URISyntaxException e) {
- logger.error("There was a serious error reading the default logging configuration",
- e);
- }
-
- } else {
- PropertyConfigurator.configure(System.getProperty("log4j.configuration"));
- }
-
- if (commandLineOptions.hasLogFile()) {
- RollingFileAppender appender;
- try {
-
- PatternLayout layout = new PatternLayout("%-5p %d{ISO8601} (%c:%L) - %m%n");
- appender = new RollingFileAppender(layout, commandLineOptions.getLogFile());
- appender.setMaxFileSize("1MB");
- appender.setEncoding("UTF-8");
- appender.setMaxBackupIndex(4);
- // Let root logger decide level
- appender.setThreshold(Level.ALL);
- LogManager.getRootLogger().addAppender(appender);
- } catch (IOException e) {
- System.err.println("Could not log to " + commandLineOptions.getLogFile());
- }
- }
- }
-
- public int setupAndExecute() throws InputMismatchException, InvalidOptionException,
- CMException, OpenDataflowException, ReaderException, IOException, ValidationException,
- ReadInputException, InvalidWorkflowException, RunProfileException,
- InvalidRunIdException, RunStateException, InvalidExecutionIdException, DatabaseConfigurationException {
-
- if (!commandLineOptions.askedForHelp()) {
- setupDatabase(commandLineOptions);
-
- if (commandLineOptions.getWorkflow() != null) {
-
- /* Set context class loader to us,
- * so that things such as JSON-LD caching of
- * robundle works.
- */
-
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
-
- /*
- * Initialise Credential Manager and SSL stuff quite early as
- * parsing and validating the workflow may require it
- */
- String credentialManagerDirPath = commandLineOptions.getCredentialManagerDir();
-
- /*
- * If credentialManagerDirPath is null, the Credential Manager
- * will be initialized from the default location in
- * <TAVERNA_HOME>/security somewhere inside user's home
- * directory. This should not be used when running command line
- * tool on a server and the Credential Manager dir path should
- * always be passed in as we do not want to store the security
- * files in user's home directory on the server (we do not even
- * know which user the command line tool will be running as).
- */
- if (credentialManagerDirPath != null) {
- credentialManager.setConfigurationDirectoryPath(new File(
- credentialManagerDirPath));
- }
-
- // Initialise the SSL stuff - set the SSLSocketFactory
- // to use Taverna's Keystore and Truststore.
- credentialManager.initializeSSL();
-
- URL workflowURL = readWorkflowURL(commandLineOptions.getWorkflow());
-
- workflowBundle = workflowBundleIO.readBundle(workflowURL, null);
-
- logger.debug("Read the wf bundle");
-
- validateWorkflowBundle(workflowBundle);
- logger.debug("Validated the wf bundle");
-
-
- Set<ExecutionEnvironment> executionEnvironments = runService
- .getExecutionEnvironments();
-
- ExecutionEnvironment executionEnvironment = null;
-
- /*
- * Find the right execution environment, e.g. local execution
- * with the correct reference service based on command line
- * options
- */
- while (executionEnvironments.iterator().hasNext()) {
- // TODO Choose the right one
- // take the fist one for now
- executionEnvironment = executionEnvironments.iterator().next();
- break;
- }
-
- logger.debug("Got the execution environment");
-
- InputsHandler inputsHandler = new InputsHandler();
- Map<String, InputWorkflowPort> portMap = new HashMap<String, InputWorkflowPort>();
-
- Workflow workflow = workflowBundle.getMainWorkflow();
-
- for (InputWorkflowPort port : workflow.getInputPorts()) {
- portMap.put(port.getName(), port);
- }
- inputsHandler.checkProvidedInputs(portMap, commandLineOptions);
- logger.debug("Checked inputs");
-
- Bundle inputs = inputsHandler.registerInputs(portMap, commandLineOptions, null);
- logger.debug("Registered inputs");
-
- RunProfile runProfile = new RunProfile(executionEnvironment, workflowBundle, inputs);
-
- String runId = runService.createRun(runProfile);
-
- runService.start(runId);
- logger.debug("Started wf run");
-
- WorkflowReport report = runService.getWorkflowReport(runId);
-
- while (!workflowFinished(report)) {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- System.err.println("Interrupted while waiting for workflow to finish");
- return 1;
- }
- }
-
- NamedSet<OutputWorkflowPort> workflowOutputPorts = workflow.getOutputPorts();
- if (!workflowOutputPorts.isEmpty()) {
- File outputDir = null;
-
- if (commandLineOptions.saveResultsToDirectory()) {
- outputDir = determineOutputDir(commandLineOptions, workflowBundle.getName());
- outputDir.mkdirs();
- }
-
- Path outputs = DataBundles.getOutputs(runService.getDataBundle(runId));
-
- if (outputDir != null) {
- SaveResultsHandler saveResultsHandler = new SaveResultsHandler(outputDir);
-
- for (OutputWorkflowPort outputWorkflowPort : workflowOutputPorts) {
- String workflowOutputPortName = outputWorkflowPort.getName();
- Path output = DataBundles.getPort(outputs, workflowOutputPortName);
- if (!DataBundles.isMissing(output)) {
- saveResultsHandler.saveResultsForPort(workflowOutputPortName, output);
- }
- }
- }
- }
- if (commandLineOptions.saveResultsToBundle() != null) {
- Path bundlePath = Paths.get(commandLineOptions.saveResultsToBundle());
- DataBundles.closeAndSaveBundle(runService.getDataBundle(runId), bundlePath);
- System.out.println("Workflow Run Bundle saved to: " + bundlePath.toAbsolutePath());
- } else {
- System.out.println("Workflow Run Bundle: " + runService.getDataBundle(runId).getSource());
- // For debugging we'll leave it in /tmp for now
- runService.getDataBundle(runId).setDeleteOnClose(false);
- DataBundles.closeBundle(runService.getDataBundle(runId));
- }
-
- if (report.getState().equals(State.FAILED)) {
- System.out.println("Workflow failed - see report below.");
- System.out.println(report);
- } else if (report.getState().equals(State.COMPLETED)) {
- System.out.println("Workflow completed.");
- }
-
- }
- } else {
- commandLineOptions.displayHelp();
- }
-
- // wait until user hits CTRL-C before exiting
- if (commandLineOptions.getStartDatabaseOnly()) {
- // FIXME: need to do this more gracefully.
- while (true) {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- return 0;
- }
- }
- }
-
- return 0;
- }
-
- private boolean workflowFinished(WorkflowReport report) {
- State state = report.getState();
- if (state == State.CANCELLED || state == State.COMPLETED || state == State.FAILED) {
- return true;
- }
- return false;
- }
-
- protected void validateWorkflowBundle(WorkflowBundle workflowBundle) throws ValidationException {
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
- cv.checkCorrectness(workflowBundle, true, rcvl);
- if (rcvl.detectedProblems()) {
- throw rcvl.getException();
- }
-
- StructuralValidator sv = new StructuralValidator();
- ReportStructuralValidationListener rsvl = new ReportStructuralValidationListener();
- sv.checkStructure(workflowBundle, rsvl);
- if (rsvl.detectedProblems()) {
- throw rcvl.getException();
- }
- }
-
- private void setupDatabase(CommandLineOptions options)
- throws DatabaseConfigurationException {
- DatabaseConfigurationHandler dbHandler = new DatabaseConfigurationHandler(
- options, databaseConfiguration, databaseManager);
- dbHandler.configureDatabase();
- try {
- if (!options.isInMemory())
- dbHandler.testDatabaseConnection();
- } catch (NamingException e) {
- throw new DatabaseConfigurationException(
- "There was an error trying to setup the database datasource: "
- + e.getMessage(), e);
- } catch (SQLException e) {
- if (options.isClientServer())
- throw new DatabaseConfigurationException(
- "There was an error whilst making a test database connection. If running with -clientserver you should check that a server is running (check -startdb or -dbproperties)",
- e);
- if (options.isEmbedded())
- throw new DatabaseConfigurationException(
- "There was an error whilst making a test database connection. If running with -embedded you should make sure that another process isn't using the database, or a server running through -startdb",
- e);
- }
- }
-
- private File determineOutputDir(CommandLineOptions options, String dataflowName) {
- File result = new File(dataflowName + "_output");
- int x = 1;
- while (result.exists()) {
- result = new File(dataflowName + "_output_" + x);
- x++;
- }
- System.out.println("Outputs will be saved to the directory: "
- + result.getAbsolutePath());
- return result;
- }
-
- protected void error(String msg) {
- System.err.println(msg);
- }
-
- private URL readWorkflowURL(String workflowOption) throws OpenDataflowException {
- try {
- return new URL(new URL("file:"), workflowOption);
- } catch (MalformedURLException e) {
- throw new OpenDataflowException("The was an error processing the URL to the workflow: "
- + e.getMessage(), e);
- }
- }
-
- public void setCommandLineOptions(CommandLineOptions commandLineOptions){
- this.commandLineOptions = commandLineOptions;
- }
-
- public void setRunService(RunService runService) {
- this.runService = runService;
- }
-
- public void setCredentialManager(CredentialManager credentialManager) {
- this.credentialManager = credentialManager;
- }
-
- public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
- this.workflowBundleIO = workflowBundleIO;
- }
-
- /**
- * Sets the databaseConfiguration.
- *
- * @param databaseConfiguration the new value of databaseConfiguration
- */
- public void setDatabaseConfiguration(DatabaseConfiguration databaseConfiguration) {
- this.databaseConfiguration = databaseConfiguration;
- }
-
- /**
- * Sets the databaseManager.
- *
- * @param databaseManager the new value of databaseManager
- */
- public void setDatabaseManager(DatabaseManager databaseManager) {
- this.databaseManager = databaseManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java
deleted file mode 100644
index 46b6c92..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/DatabaseConfigurationHandler.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * 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.commandline.data;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import javax.naming.NamingException;
-
-import net.sf.taverna.t2.commandline.exceptions.DatabaseConfigurationException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.database.DatabaseConfiguration;
-import uk.org.taverna.configuration.database.DatabaseManager;
-
-/**
- * Handles the initialisation and configuration of the data source according to
- * the command line arguments, or a properties file.
- * This also handles starting a network based instance of a Derby server, if requested.
- *
- * @author Stuart Owen
- *
- */
-public class DatabaseConfigurationHandler {
-
- private static Logger logger = Logger.getLogger(DatabaseConfigurationHandler.class);
- private final CommandLineOptions options;
- private final DatabaseConfiguration dbConfig;
- private final DatabaseManager databaseManager;
-
- public DatabaseConfigurationHandler(CommandLineOptions options, DatabaseConfiguration databaseConfiguration, DatabaseManager databaseManager) {
- this.options = options;
- this.dbConfig = databaseConfiguration;
- this.databaseManager = databaseManager;
- databaseConfiguration.disableAutoSave();
- }
-
- public void configureDatabase() throws DatabaseConfigurationException {
- overrideDefaults();
- useOptions();
- if (dbConfig.getStartInternalDerbyServer()) {
- databaseManager.startDerbyNetworkServer();
- System.out.println("Started Derby Server on Port: "
- + dbConfig.getCurrentPort());
- }
- }
-
- public DatabaseConfiguration getDBConfig() {
- return dbConfig;
- }
-
- private void importConfigurationFromStream(InputStream inStr)
- throws IOException {
- Properties p = new Properties();
- p.load(inStr);
- for (Object key : p.keySet()) {
- dbConfig.setProperty((String)key, p.getProperty((String)key).trim());
- }
- }
-
- protected void overrideDefaults() throws DatabaseConfigurationException {
-
- InputStream inStr = DatabaseConfigurationHandler.class.getClassLoader().getResourceAsStream("database-defaults.properties");
- try {
- importConfigurationFromStream(inStr);
- } catch (IOException e) {
- throw new DatabaseConfigurationException("There was an error reading the default database configuration settings: "+e.getMessage(),e);
- }
- }
-
- protected void readConfigirationFromFile(String filename) throws IOException {
- FileInputStream fileInputStream = new FileInputStream(filename);
- importConfigurationFromStream(fileInputStream);
- fileInputStream.close();
- }
-
- public void testDatabaseConnection()
- throws DatabaseConfigurationException, NamingException, SQLException {
- //try and get a connection
- Connection con = null;
- try {
- con = databaseManager.getConnection();
- } finally {
- if (con!=null)
- try {
- con.close();
- } catch (SQLException e) {
- logger.warn("There was an SQL error whilst closing the test connection: "+e.getMessage(),e);
- }
- }
- }
-
- public void useOptions() throws DatabaseConfigurationException {
-
- if (options.hasOption("port")) {
- dbConfig.setPort(options.getDatabasePort());
- }
-
- if (options.hasOption("startdb")) {
- dbConfig.setStartInternalDerbyServer(true);
- }
-
- if (options.hasOption("inmemory")) {
- dbConfig.setInMemory(true);
- }
-
- if (options.hasOption("embedded")) {
- dbConfig.setInMemory(false);
- dbConfig.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
- }
-
- if (options.isProvenanceEnabled()) {
- dbConfig.setProvenanceEnabled(true);
- }
-
- if (options.hasOption("clientserver")) {
- dbConfig.setInMemory(false);
- dbConfig.setDriverClassName("org.apache.derby.jdbc.ClientDriver");
- dbConfig.setJDBCUri("jdbc:derby://localhost:" + dbConfig.getPort() + "/t2-database;create=true;upgrade=true");
- }
-
- if (options.hasOption("dbproperties")) {
- try {
- readConfigirationFromFile(options.getDatabaseProperties());
- } catch (IOException e) {
- throw new DatabaseConfigurationException("There was an error reading the database configuration options at "+options.getDatabaseProperties()+" : "+e.getMessage(),e);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java
deleted file mode 100644
index bd83e8f..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/ErrorValueHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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.commandline.data;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.List;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import org.apache.taverna.databundle.DataBundles;
-import org.apache.taverna.databundle.ErrorDocument;
-
-/**
- * Handles ErrorValues and transforming them into String representations
- * that can be stored as a file, or within a Baclava document.
- *
- * @author Stuart Owen
- * @author David Withers
- */
-public class ErrorValueHandler {
-
- /**
- * Creates a string representation of the ErrorValue.
- * @throws IOException
- */
- public static String buildErrorValueString(ErrorDocument errorValue) throws IOException {
-
- String errDocumentString = errorValue.getMessage() + "\n";
-
- String exceptionMessage = errorValue.getMessage();
- if (exceptionMessage != null && !exceptionMessage.equals("")) {
- DefaultMutableTreeNode exceptionMessageNode = new DefaultMutableTreeNode(
- exceptionMessage);
- errDocumentString += exceptionMessageNode + "\n";
- errDocumentString += errorValue.getTrace();
- }
-
- List<Path> errorReferences = errorValue.getCausedBy();
- if (!errorReferences.isEmpty()) {
- errDocumentString += "Set of cause errors to follow." + "\n";
- }
- int errorCounter = 1;
- for (Path cause : errorReferences) {
- if (DataBundles.isError(cause)) {
- errDocumentString += "ErrorValue " + (errorCounter++) + "\n";
- errDocumentString += buildErrorValueString(DataBundles.getError(cause)) + "\n";
- }
- }
-
- return errDocumentString;
- }
-
-}
[2/5] incubator-taverna-commandline git commit: package name changes
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/TavernaCommandLineTest.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/TavernaCommandLineTest.java b/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/TavernaCommandLineTest.java
deleted file mode 100644
index 07df1c3..0000000
--- a/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/TavernaCommandLineTest.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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 uk.org.taverna.commandline;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.net.URI;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.comparator.NameFileComparator;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import uk.org.taverna.commandline.WorkflowTestSuite.Workflows;
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-import uk.org.taverna.scufl2.rdfxml.RDFXMLReader;
-
-/**
- * Regression tests for Taverna Command Line Tool.
- *
- * @author David Withers
- */
-@RunWith(WorkflowTestSuite.class)
-public class TavernaCommandLineTest {
-
- private static String baseVersion = "2.4.0";
- private static boolean baseVersionReleased = true;
-
- private static String testVersion = "3.0.1-SNAPSHOT";
- private static boolean testVersionReleased = false;
- private static boolean testVersionSupportsScufl2 = true;
-
- private static String script = "executeworkflow.sh";
- private static String baseName = "taverna-commandline-" + baseVersion;
- private static String testName = "taverna-command-line-" + testVersion;
- private static String releasedLocation = "https://launchpad.net/taverna/t2/";
- private static String unreleasedLocation = "http://build.mygrid.org.uk/ci/job/t3-taverna-commandline-product/lastSuccessfulBuild/net.sf.taverna.t2$taverna-commandline/artifact/net.sf.taverna.t2/taverna-commandline/";
-
- private static String baseVersionLocation = (baseVersionReleased ? releasedLocation
- : unreleasedLocation) + baseVersion + "/+download/" + baseName + ".zip";
- private static String testVersionLocation = (testVersionReleased ? releasedLocation
- : unreleasedLocation)
- + testVersion
- + "/"
- + testName
- + (testVersionReleased ? ".zip" : "-bin.zip");
-
- private static String baseCommand;
- private static String testCommand;
-
- private static File buildDirectory;
-
- private File workflowDirectory;
- private File baseOutput;
- private File testOutput;
- private boolean secure;
- private List<File> inputs;
- private String ignorePort;
- private String message;
-
- public TavernaCommandLineTest(File workflowDirectory) throws Exception {
- this.workflowDirectory = workflowDirectory;
- if (buildDirectory == null) {
- String buildDirectoryLocation = System.getProperty("buildDirectory");
- if (buildDirectoryLocation == null) {
- buildDirectoryLocation = System.getProperty("user.dir")
- + System.getProperty("file.separator") + "target";
- }
- buildDirectory = new File(buildDirectoryLocation);
- buildDirectory.mkdirs();
- }
- if (baseCommand == null) {
- File commandDirectory = new File(buildDirectory, baseName);
- if (!commandDirectory.exists()) {
- System.out.println("Fetching " + baseName);
- fetchTaverna(baseVersionLocation, baseName);
- }
- baseCommand = new File(baseName, script).getPath();
- }
- if (testCommand == null) {
- File commandDirectory = new File(buildDirectory, testName);
- if (!commandDirectory.exists()) {
- System.out.println("Fetching " + testName);
- fetchTaverna(testVersionLocation, testName);
- }
- testCommand = new File(testName, script).getPath();
- }
- File outputsDirectory = new File(buildDirectory, "test-outputs");
- baseOutput = new File(outputsDirectory, workflowDirectory.getName() + "-" + baseVersion);
- testOutput = new File(outputsDirectory, workflowDirectory.getName() + "-" + testVersion);
- secure = workflowDirectory.getName().startsWith("secure");
- inputs = getInputs();
- ignorePort = getIgnorePort();
- message = "Running {0} with version {1}";
- }
-
- @Workflows
- public static List<File> workflows() {
- List<File> workflows = new ArrayList<File>();
- for (File workflowDirectory : getResources("workflows")) {
- workflows.add(workflowDirectory);
- }
- for (File workflowDirectory : getResources("myexperiment")) {
- workflows.add(workflowDirectory);
- }
- return workflows;
- }
-
- @Before
- public void setup() throws Exception {
- if (!baseOutput.exists()) {
- if (baseVersion.equals("2.3.0") && workflowDirectory.getName().equals("tool"))
- return;// version 2.3.0 is missing tool plugin
- String workflow = getWorkflow().toASCIIString();
- System.out.println(MessageFormat.format(message, workflow, baseVersion)
- + (inputs.size() > 0 ? " using input values" : ""));
- runWorkflow(baseCommand, workflow, baseOutput, true, secure, false);
- assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
- baseOutput.exists());
- }
- }
-
- public boolean testExcluded() {
- // version 3.0.0 is missing biomoby activity
- if (testVersion.startsWith("3.") && workflowDirectory.getName().contains("biomoby"))
- return true;
- // version 3.0.0 is missing tool activity
- if (testVersion.startsWith("3.")
- && workflowDirectory.getName().equals("unix_external_tools_with_zip_and_unzip"))
- return true;
- if (testVersion.startsWith("3.")
- && workflowDirectory.getName().equals("unix_numerically_adding_two_values"))
- return true;
- if (testVersion.startsWith("3.")
- && workflowDirectory.getName().equals("unix_tool_service_using_string_replacement"))
- return true;
- // version 3.0.0 is missing looping configuration
- if (testVersion.startsWith("3.")
- && workflowDirectory.getName().equals("ebi_interproscan_newservices"))
- return true;
- if (testVersion.startsWith("3.")
- && workflowDirectory.getName().equals("biomartandembossanalysis"))
- return true;
- return false;
- }
-
- @Test
- public void testWorkflowWithoutInputs() throws Exception {
- assumeTrue(!testExcluded());
- assumeTrue(baseOutput.exists());
- assumeTrue(inputs.isEmpty());
- FileUtils.deleteDirectory(testOutput);
- String workflow = getWorkflow().toASCIIString();
- System.out.println(MessageFormat.format(message, workflow, testVersion));
- runWorkflow(testCommand, workflow, testOutput, true, secure, false);
- assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
- testOutput.exists());
- assertOutputsEquals(baseOutput, testOutput);
- }
-
- @Test
- public void testWorkflowWithInputValues() throws Exception {
- assumeTrue(!testExcluded());
- assumeTrue(baseOutput.exists());
- assumeTrue(inputs.size() > 0);
- FileUtils.deleteDirectory(testOutput);
- String workflow = getWorkflow().toASCIIString();
- System.out.println(MessageFormat.format(message, workflow, testVersion)
- + " using input values");
- runWorkflow(testCommand, workflow, testOutput, true, secure, false);
- assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
- testOutput.exists());
- assertOutputsEquals(baseOutput, testOutput);
- }
-
- @Test
- public void testWorkflowWithInputFiles() throws Exception {
- assumeTrue(!testExcluded());
- assumeTrue(baseOutput.exists());
- assumeTrue(inputs.size() > 0);
- FileUtils.deleteDirectory(testOutput);
- String workflow = getWorkflow().toASCIIString();
- System.out.println(MessageFormat.format(message, workflow, testVersion)
- + " using input files");
- runWorkflow(testCommand, workflow, testOutput, false, secure, false);
- assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
- testOutput.exists());
- assertOutputsEquals(baseOutput, testOutput);
- }
-
- @Test
- @Ignore
- public void testWorkflowWithDatabase() throws Exception {
- assumeTrue(!testExcluded());
- assumeTrue(baseOutput.exists());
- assumeTrue(inputs.size() > 0);
- FileUtils.deleteDirectory(testOutput);
- String workflow = getWorkflow().toASCIIString();
- System.out
- .println(MessageFormat.format(message, workflow, testVersion) + " using database");
- runWorkflow(testCommand, workflow, testOutput, true, secure, true);
- assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
- testOutput.exists());
- assertOutputsEquals(baseOutput, testOutput);
- }
-
- @Test
- public void testScufl2Workflow() throws Exception {
- assumeTrue(!testExcluded());
- assumeTrue(baseOutput.exists());
- assumeTrue(testVersionSupportsScufl2);
-
- FileUtils.deleteDirectory(testOutput);
- String workflow = getScufl2Workflow().toASCIIString();
- System.out.println(MessageFormat.format(message, workflow, testVersion)
- + (inputs.size() > 0 ? " using input values" : ""));
- runWorkflow(testCommand, workflow, testOutput, true, secure, true);
- assertTrue(String.format("No output produced for %s", workflowDirectory.getName()),
- testOutput.exists());
- assertOutputsEquals(baseOutput, testOutput);
- }
-
- private synchronized void runWorkflow(String command, String workflow, File outputsDirectory,
- boolean inputValues, boolean secure, boolean database) throws Exception {
- ProcessBuilder processBuilder = new ProcessBuilder("sh", command);
- processBuilder.redirectErrorStream(true);
- processBuilder.directory(buildDirectory);
- List<String> args = processBuilder.command();
- for (File input : inputs) {
- if (inputValues) {
- args.add("-inputvalue");
- args.add(input.getName());
- args.add(IOUtils.toString(new FileReader(input)));
- } else {
- args.add("-inputfile");
- args.add(input.getName());
- args.add(input.getAbsolutePath());
- }
- }
- args.add("-outputdir");
- args.add(outputsDirectory.getPath());
- if (secure) {
- args.add("-cmdir");
- args.add(getClass().getResource("/security").getFile());
- args.add("-cmpassword");
- }
- if (database) {
- args.add("-embedded");
- }
- args.add(workflow);
- Process process = processBuilder.start();
- if (secure) {
- PrintStream outputStream = new PrintStream(process.getOutputStream());
- outputStream.println("test");
- outputStream.flush();
- }
- waitFor(process);
- }
-
- private URI getWorkflow() throws Exception {
- File workflow = new File(workflowDirectory, workflowDirectory.getName() + ".t2flow");
- if (!workflow.exists()) {
- workflow = new File(workflowDirectory, workflowDirectory.getName() + ".url");
- return new URI(IOUtils.toString(new FileReader(workflow)));
- }
- return workflow.toURI();
- }
-
- private URI getScufl2Workflow() throws Exception {
- File workflow = new File(buildDirectory, workflowDirectory.getName() + ".wfbundle");
- // if (!workflow.exists()) {
- WorkflowBundleIO workflowBundleIO = new WorkflowBundleIO();
- WorkflowBundle bundle = workflowBundleIO.readBundle(getWorkflow().toURL(), null);
- workflowBundleIO.writeBundle(bundle, workflow,
- RDFXMLReader.APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE);
- // }
- return workflow.toURI();
- }
-
- private synchronized int waitFor(Process process) throws IOException {
- while (true) {
- try {
- wait(500);
- } catch (InterruptedException e) {
- }
- IOUtils.copy(process.getInputStream(), System.out);
- try {
- return process.exitValue();
- } catch (IllegalThreadStateException e) {
- }
- }
- }
-
- private void assertOutputsEquals(File directory1, File directory2) {
- File[] directory1Files = directory1.listFiles();
- File[] directory2Files = directory2.listFiles();
- // assert directories contain same number of files
- assertEquals(String.format("%s has %s files but %s has %s files", directory1.getName(),
- directory1Files.length, directory2.getName(), directory2Files.length),
- directory1Files.length, directory2Files.length);
- // sort files in directory
- Arrays.sort(directory1Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
- Arrays.sort(directory2Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
- for (int i = 0; i < directory1Files.length; i++) {
- assertFilesEqual(directory1Files[i], directory2Files[i], !directory1Files[i].getName()
- .equals(ignorePort));
- }
- }
-
- private void assertDirectoriesEquals(File directory1, File directory2, boolean checkFileContents) {
- if (directory1.exists()) {
- assertTrue(String.format("%s exists but %s does not", directory1, directory2),
- directory2.exists());
- } else {
- assertFalse(String.format("%s does not exists but %s does", directory1, directory2),
- directory2.exists());
- }
- File[] directory1Files = directory1.listFiles();
- File[] directory2Files = directory2.listFiles();
- // assert directories contain same number of files
- assertEquals(String.format("%s has %s files but %s has %s files", directory1.getName(),
- directory1Files.length, directory2.getName(), directory2Files.length),
- directory1Files.length, directory2Files.length);
- // sort files in directory
- Arrays.sort(directory1Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
- Arrays.sort(directory2Files, NameFileComparator.NAME_SYSTEM_COMPARATOR);
- for (int i = 0; i < directory1Files.length; i++) {
- assertFilesEqual(directory1Files[i], directory2Files[i], checkFileContents);
- }
- }
-
- private void assertFilesEqual(File file1, File file2, boolean checkFileContents) {
- if (file1.isHidden()) {
- assertTrue(String.format("%s is hidden but %s is not", file1, file2), file2.isHidden());
- } else {
- assertFalse(String.format("%s is not hidden but %s is", file1, file2), file2.isHidden());
- assertEquals(file1.getName(), file2.getName());
- if (file1.isDirectory()) {
- assertTrue(String.format("%s is a directory but %s is not", file1, file2),
- file2.isDirectory());
- assertDirectoriesEquals(file1, file2, checkFileContents);
- } else {
- assertFalse(String.format("%s is not a directory but %s is", file1, file2),
- file2.isDirectory());
- if (isZipFile(file1)) {
- assertZipFilesEqual(file1, file2);
- } else if (checkFileContents) {
- assertEquals(String.format("%s is a different length to %s", file1, file2),
- file1.length(), file2.length());
- try {
- byte[] byteArray1 = IOUtils.toByteArray(new FileReader(file1));
- byte[] byteArray2 = IOUtils.toByteArray(new FileReader(file2));
- assertArrayEquals(String.format("%s != %s", file1, file2), byteArray1,
- byteArray2);
- } catch (FileNotFoundException e) {
- fail(e.getMessage());
- } catch (IOException e) {
- fail(e.getMessage());
- }
- }
- }
- }
- }
-
- private void assertZipFilesEqual(File file1, File file2) {
- ZipFile zipFile1 = null;
- ZipFile zipFile2 = null;
- try {
- zipFile1 = new ZipFile(file1);
- zipFile2 = new ZipFile(file2);
- } catch (Exception e) {
- assertTrue(String.format("%s and %s are not both zip files"), zipFile1 == null);
- }
- if (zipFile1 != null && zipFile2 != null) {
- Enumeration<? extends ZipEntry> entries1 = zipFile1.entries();
- Enumeration<? extends ZipEntry> entries2 = zipFile2.entries();
- while (entries1.hasMoreElements()) {
- assertTrue(entries2.hasMoreElements());
- ZipEntry zipEntry1 = entries1.nextElement();
- ZipEntry zipEntry2 = entries2.nextElement();
- assertEquals(
- String.format("%s and %s are not both directories", zipEntry1, zipEntry2),
- zipEntry1.isDirectory(), zipEntry2.isDirectory());
- assertEquals(String.format("%s and %s have different names", zipEntry1, zipEntry2),
- zipEntry1.getName(), zipEntry2.getName());
- assertEquals(String.format("%s and %s have different sizes", zipEntry1, zipEntry2),
- zipEntry1.getSize(), zipEntry2.getSize());
- try {
- byte[] byteArray1 = IOUtils.toByteArray(zipFile1.getInputStream(zipEntry1));
- byte[] byteArray2 = IOUtils.toByteArray(zipFile2.getInputStream(zipEntry2));
- assertArrayEquals(String.format("%s != %s", zipEntry1, zipEntry2), byteArray1,
- byteArray2);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- assertFalse(entries2.hasMoreElements());
- }
- }
-
- private boolean isZipFile(File file) {
- try {
- new ZipFile(file);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- private static File[] getResources(String directory) {
- return new File(TavernaCommandLineTest.class.getResource("/" + directory).getFile())
- .listFiles();
- }
-
- private List<File> getInputs() {
- File inputsDirectory = new File(workflowDirectory, "inputs");
- if (inputsDirectory.exists() && inputsDirectory.isDirectory()) {
- return Arrays.asList(inputsDirectory.listFiles());
- }
- return Collections.emptyList();
- }
-
- private String getIgnorePort() throws Exception {
- File ignorePort = new File(workflowDirectory, "ignorePort");
- if (ignorePort.exists()) {
- return IOUtils.toString(new FileReader(ignorePort));
- }
- return "";
- }
-
- private void fetchTaverna(String location, String name) throws Exception {
- File zipFile = new File(buildDirectory, name + ".zip");
- IOUtils.copy(new URL(location).openStream(), new FileOutputStream(zipFile));
- ProcessBuilder processBuilder = new ProcessBuilder("unzip", "-q", name);
- processBuilder.redirectErrorStream(true);
- processBuilder.directory(buildDirectory);
- System.out.println(processBuilder.command());
- Process process = processBuilder.start();
- waitFor(process);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestRunner.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestRunner.java b/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestRunner.java
deleted file mode 100644
index 56ed82d..0000000
--- a/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestRunner.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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 uk.org.taverna.commandline;
-
-import java.io.File;
-import java.util.List;
-
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-/**
- * Test runner for running workflows.
- *
- * @author David Withers
- */
-public class WorkflowTestRunner extends BlockJUnit4ClassRunner {
- private File workflow;
-
- public WorkflowTestRunner(Class<?> type, File workflow) throws InitializationError {
- super(type);
- this.workflow = workflow;
- }
-
- @Override
- public Object createTest() throws Exception {
- return getTestClass().getOnlyConstructor().newInstance(workflow);
- }
-
- @Override
- protected String getName() {
- return String.format("[%s]", workflow.getName());
- }
-
- @Override
- protected String testName(final FrameworkMethod method) {
- return String.format("%s[%s]", method.getName(), workflow.getName());
- }
-
- @Override
- protected void validateConstructor(List<Throwable> errors) {
- validateOnlyOneConstructor(errors);
- }
-
- @Override
- protected Statement classBlock(RunNotifier notifier) {
- return childrenInvoker(notifier);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestSuite.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestSuite.java b/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestSuite.java
deleted file mode 100644
index 140dec6..0000000
--- a/taverna-commandline-tests/src/test/java/uk/org/taverna/commandline/WorkflowTestSuite.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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 uk.org.taverna.commandline;
-
-import java.io.File;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.junit.runner.Runner;
-import org.junit.runners.Suite;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.TestClass;
-
-/**
- * Test suite for running workflows specified by a method annotated by @Workflows.
- *
- * @author David Withers
- */
-public class WorkflowTestSuite extends Suite {
-
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- public static @interface Workflows {}
-
- private ArrayList<Runner> runners = new ArrayList<Runner>();
-
- public WorkflowTestSuite(Class<?> klass) throws Throwable {
- super(klass, Collections.<Runner>emptyList());
- for (File workflow : getWorkflows(getTestClass())) {
- runners.add(new WorkflowTestRunner(getTestClass().getJavaClass(), workflow));
- }
- }
-
- @Override
- protected List<Runner> getChildren() {
- return runners;
- }
-
- @SuppressWarnings("unchecked")
- private List<File> getWorkflows(TestClass klass) throws Throwable {
- return (List<File>) getWorkflowsMethod(klass).invokeExplosively(null);
- }
-
- public FrameworkMethod getWorkflowsMethod(TestClass testClass) throws Exception {
- List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Workflows.class);
- for (FrameworkMethod method : methods) {
- int modifiers = method.getMethod().getModifiers();
- if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
- return method;
- }
- }
- throw new Exception("No public static Workflows annotated method on class " + testClass.getName());
- }
-
-}
[4/5] incubator-taverna-commandline git commit: package name changes
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/InputsHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/InputsHandler.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/InputsHandler.java
deleted file mode 100644
index 6f91514..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/InputsHandler.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * 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.commandline.data;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardOpenOption;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.commandline.exceptions.InputMismatchException;
-import net.sf.taverna.t2.commandline.exceptions.InvalidOptionException;
-import net.sf.taverna.t2.commandline.exceptions.ReadInputException;
-import net.sf.taverna.t2.commandline.options.CommandLineOptions;
-import net.sf.taverna.t2.invocation.InvocationContext;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-import org.apache.taverna.databundle.DataBundles;
-import org.apache.taverna.robundle.Bundle;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-
-/**
- * Handles the reading, or processing, or input values according to arguments provided to the
- * commandline.
- * The may be either as direct values, from a file, or from a Baclava document.
- * Also handles registering the input values with the Data Service, ready to initiate
- * the workflow run.
- *
- * @author Stuart Owen
- */
-public class InputsHandler {
-
- private static Logger logger = Logger.getLogger(InputsHandler.class);
-
- public void checkProvidedInputs(Map<String, InputWorkflowPort> portMap,
- CommandLineOptions options) throws InputMismatchException {
- // we dont check for the document
- Set<String> providedInputNames = new HashSet<String>();
- for (int i = 0; i < options.getInputFiles().length; i += 2) {
- // If it already contains a value for the input port, e.g
- // two inputs are provided for the same port
- if (providedInputNames.contains(options.getInputFiles()[i])) {
- throw new InputMismatchException(
- "Two input values were provided for the same input port "
- + options.getInputFiles()[i] + ".", null, null);
- }
- providedInputNames.add(options.getInputFiles()[i]);
- }
-
- for (int i = 0; i < options.getInputValues().length; i += 2) {
- // If it already contains a value for the input port, e.g
- // two inputs are provided for the same port
- if (providedInputNames.contains(options.getInputValues()[i])) {
- throw new InputMismatchException(
- "Two input values were provided for the same input port "
- + options.getInputValues()[i] + ".", null, null);
- }
- providedInputNames.add(options.getInputValues()[i]);
- }
-
- if (portMap.size() * 2 != (options.getInputFiles().length + options.getInputValues().length)) {
- throw new InputMismatchException(
- "The number of inputs provided does not match the number of input ports.",
- portMap.keySet(), providedInputNames);
- }
-
- for (String portName : portMap.keySet()) {
- if (!providedInputNames.contains(portName)) {
- throw new InputMismatchException(
- "The provided inputs does not contain an input for the port '"
- + portName + "'", portMap.keySet(), providedInputNames);
- }
- }
- }
-
- public Bundle registerInputs(Map<String, InputWorkflowPort> portMap,
- CommandLineOptions options, InvocationContext context) throws InvalidOptionException,
- ReadInputException, IOException {
- Bundle inputDataBundle;
- inputDataBundle = DataBundles.createBundle();
- inputDataBundle.setDeleteOnClose(false);
- System.out.println("Bundle: " + inputDataBundle.getSource());
-
- Path inputs = DataBundles.getInputs(inputDataBundle);
-
- URL url;
- try {
- url = new URL("file:");
- } catch (MalformedURLException e1) {
- // Should never happen, but just in case:
- throw new ReadInputException(
- "The was an internal error setting up the URL to open the inputs. You should contact Taverna support.",
- e1);
- }
-
- if (options.hasInputFiles()) {
- regesterInputsFromFiles(portMap, options, inputs, url);
- }
-
- if (options.hasInputValues()) {
- registerInputsFromValues(portMap, options, inputs);
-
- }
-
- return inputDataBundle;
- }
-
- private void registerInputsFromValues(Map<String, InputWorkflowPort> portMap,
- CommandLineOptions options, Path inputs) throws InvalidOptionException {
- String[] inputParams = options.getInputValues();
- for (int i = 0; i < inputParams.length; i = i + 2) {
- String inputName = inputParams[i];
- try {
- String inputValue = inputParams[i + 1];
- InputWorkflowPort port = portMap.get(inputName);
-
- if (port == null) {
- throw new InvalidOptionException("Cannot find an input port named '"
- + inputName + "'");
- }
-
- Path portPath = DataBundles.getPort(inputs, inputName);
- if (options.hasDelimiterFor(inputName)) {
- String delimiter = options.inputDelimiter(inputName);
- Object value = checkForDepthMismatch(1, port.getDepth(), inputName,
- inputValue.split(delimiter));
- setValue(portPath, value);
- } else {
- Object value = checkForDepthMismatch(0, port.getDepth(), inputName, inputValue);
- setValue(portPath, value);
- }
-
- } catch (IndexOutOfBoundsException e) {
- throw new InvalidOptionException("Missing input value for input " + inputName);
- } catch (IOException e) {
- throw new InvalidOptionException("Error creating value for input " + inputName);
- }
- }
- }
-
- private void regesterInputsFromFiles(Map<String, InputWorkflowPort> portMap,
- CommandLineOptions options, Path inputs, URL url) throws InvalidOptionException {
- String[] inputParams = options.getInputFiles();
- for (int i = 0; i < inputParams.length; i = i + 2) {
- String inputName = inputParams[i];
- try {
- URL inputURL = new URL(url, inputParams[i + 1]);
- InputWorkflowPort port = portMap.get(inputName);
-
- if (port == null) {
- throw new InvalidOptionException("Cannot find an input port named '"
- + inputName + "'");
- }
-
- Path portPath = DataBundles.getPort(inputs, inputName);
- if (options.hasDelimiterFor(inputName)) {
- String delimiter = options.inputDelimiter(inputName);
- Object value = IOUtils.toString(inputURL.openStream()).split(delimiter);
- value = checkForDepthMismatch(1, port.getDepth(), inputName, value);
- setValue(portPath, value);
- } else {
- Object value = IOUtils.toByteArray(inputURL.openStream());
- value = checkForDepthMismatch(0, port.getDepth(), inputName, value);
- setValue(portPath, value);
- }
- } catch (IndexOutOfBoundsException e) {
- throw new InvalidOptionException("Missing input filename for input " + inputName);
- } catch (IOException e) {
- throw new InvalidOptionException("Could not read input " + inputName + ": "
- + e.getMessage());
- }
- }
- }
-
- private void setValue(Path port, Object userInput) throws IOException {
- if (userInput instanceof File) {
- DataBundles.setReference(port, ((File) userInput).toURI());
- } else if (userInput instanceof URL) {
- try {
- DataBundles.setReference(port, ((URL) userInput).toURI());
- } catch (URISyntaxException e) {
- logger.warn(String.format("Error converting %1$s to URI", userInput), e);
- }
- } else if (userInput instanceof String) {
- DataBundles.setStringValue(port, (String) userInput);
- } else if (userInput instanceof byte[]) {
- Files.write(port, (byte[]) userInput, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
- } else if (userInput instanceof List<?>) {
- DataBundles.createList(port);
- List<?> list = (List<?>) userInput;
- for (Object object : list) {
- setValue(DataBundles.newListItem(port), object);
- }
- } else {
- logger.warn("Unknown input type : " + userInput.getClass().getName());
- }
- }
-
- private Object checkForDepthMismatch(int inputDepth, int portDepth, String inputName,
- Object inputValue) throws InvalidOptionException {
- if (inputDepth != portDepth) {
- if (inputDepth < portDepth) {
- logger.warn("Wrapping input for '" + inputName + "' from a depth of " + inputDepth
- + " to the required depth of " + portDepth);
- while (inputDepth < portDepth) {
- List<Object> l = new ArrayList<Object>();
- l.add(inputValue);
- inputValue = l;
- inputDepth++;
- }
- } else {
- String msg = "There is a mismatch between depth of the list for the input port '"
- + inputName + "' and the data presented. The input port requires a "
- + depthToString(portDepth) + " and the data presented is a "
- + depthToString(inputDepth);
- throw new InvalidOptionException(msg);
- }
- }
-
- return inputValue;
- }
-
- private String depthToString(int depth) {
- switch (depth) {
- case 0:
- return "single item";
- case 1:
- return "list";
- case 2:
- return "list of lists";
- default:
- return "list of depth " + depth;
- }
- }
-
- private int getObjectDepth(Object o) {
- int result = 0;
- if (o instanceof Iterable) {
- result++;
- Iterator i = ((Iterable) o).iterator();
-
- if (i.hasNext()) {
- Object child = i.next();
- result = result + getObjectDepth(child);
- }
- }
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/SaveResultsHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/SaveResultsHandler.java b/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/SaveResultsHandler.java
deleted file mode 100644
index 301feef..0000000
--- a/taverna-commandline-common/src/main/java/net/sf/taverna/t2/commandline/data/SaveResultsHandler.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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.commandline.data;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.List;
-
-import org.apache.taverna.databundle.DataBundles;
-
-/**
- * Handles all recording of results as they are received by the {@link CommandLineResultListener} or
- * when the workflow enactment has completed.
- * This includes saving as a Baclava Document, or storing individual results.
- *
- * @author Stuart Owen
- * @see BaclavaHandler
- * @see CommandLineResultListener
- */
-public class SaveResultsHandler {
-
- private final File outputDirectory;
-
- public SaveResultsHandler(File rootOutputDir) {
- this.outputDirectory = rootOutputDir;
- }
-
- /**
- * Given the Data on an output port, saves the data on a disk in the
- * output directory.
- *
- * @param portName
- * @param data
- * @throws IOException
- */
- public void saveResultsForPort(String portName, Path data) throws IOException {
- if (DataBundles.isList(data)) {
- Path outputPath = outputDirectory.toPath().resolve(portName);
- Files.createDirectories(outputPath);
- saveList(DataBundles.getList(data), outputPath);
- } else if (DataBundles.isError(data)) {
- Files.copy(data, outputDirectory.toPath().resolve(portName + ".error"));
- } else {
- Files.copy(data, outputDirectory.toPath().resolve(portName));
- }
- }
-
- private void saveList(List<Path> list, Path destination) throws IOException {
- int index = 1;
- for (Path data : list) {
- if (data != null) {
- if (DataBundles.isList(data)) {
- Path outputPath = destination.resolve(String.valueOf(index));
- Files.createDirectories(outputPath);
- saveList(DataBundles.getList(data), outputPath);
- } else if (DataBundles.isError(data)) {
- Files.copy(data, destination.resolve(String.valueOf(index) + ".error"));
- } else {
- Files.copy(data, destination.resolve(String.valueOf(index)));
- }
- }
- index++;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineMasterPasswordProvider.java b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineMasterPasswordProvider.java
new file mode 100644
index 0000000..ae19b8f
--- /dev/null
+++ b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineMasterPasswordProvider.java
@@ -0,0 +1,183 @@
+/*
+* 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.taverna.commandline;
+
+import java.io.BufferedReader;
+import java.io.Console;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.taverna.commandline.exceptions.CommandLineMasterPasswordException;
+import org.apache.taverna.commandline.options.CommandLineOptions;
+import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
+
+import org.apache.log4j.Logger;
+
+/**
+ * An implementation of {@link MasterPasswordProvider} that reads Credential Manager's
+ * master password from stdin (pipe or terminal) is -cmpassword option is present in command
+ * line arguments. Otherwise it tries to read it from a special file password.txt in a special
+ * directory specified by -cmdir option, if present.
+ *
+ * @author Alex Nenadic
+ */
+public class CommandLineMasterPasswordProvider implements MasterPasswordProvider {
+
+ private static final String CREDENTIAL_MANAGER_MASTER_PASSWORD_OPTION = "cmpassword";
+ private static final String CREDENTIAL_MANAGER_DIRECTORY_OPTION = "cmdir";
+
+ private static Logger logger = Logger.getLogger(CommandLineMasterPasswordProvider.class);
+
+ private String masterPassword = null;
+ private int priority = 200;
+
+ private boolean finishedReadingPassword = false;
+ private final CommandLineOptions commandLineOptions;
+
+ public CommandLineMasterPasswordProvider(CommandLineOptions commandLineOptions) {
+ this.commandLineOptions = commandLineOptions;
+ }
+
+ @Override
+ public String getMasterPassword(boolean firstTime) {
+ if (!finishedReadingPassword) {
+ // -cmpassword option was present in the command line arguments
+ if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_MASTER_PASSWORD_OPTION)) {
+ // Try to read the password from stdin (terminal or pipe)
+ try {
+ masterPassword = getCredentialManagerPasswordFromStdin();
+ } catch (CommandLineMasterPasswordException e) {
+ masterPassword = null;
+ }
+ }
+ // -cmpassword option was not present in the command line arguments
+ // and -cmdir option was there - try to get the master password from
+ // the "special" password file password.txt inside the Cred. Manager directory.
+ else {
+ if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_DIRECTORY_OPTION)) {
+ // Try to read the password from a special file located in
+ // Credential Manager directory (if the dir was not null)
+ try {
+ masterPassword = getCredentialManagerPasswordFromFile();
+ } catch (CommandLineMasterPasswordException ex) {
+ masterPassword = null;
+ }
+ }
+ }
+ finishedReadingPassword = true; // we do not want to attempt to read from stdin several
+ // times
+ }
+ return masterPassword;
+ }
+
+ public void setMasterPassword(String masterPassword) {
+ this.masterPassword = masterPassword;
+ finishedReadingPassword = true;
+ }
+
+ @Override
+ public int getProviderPriority() {
+ return priority;
+ }
+
+ private String getCredentialManagerPasswordFromStdin()
+ throws CommandLineMasterPasswordException {
+
+ String password = null;
+
+ Console console = System.console();
+
+ if (console == null) { // password is being piped in, not entered in the terminal by user
+ BufferedReader buffReader = null;
+ try {
+ buffReader = new BufferedReader(new InputStreamReader(System.in));
+ password = buffReader.readLine();
+ } catch (IOException ex) {
+ // For some reason the error of the exception thrown
+ // does not get printed from the Launcher so print it here as
+ // well as it gives more clue as to what is going wrong.
+ logger.error(
+ "An error occured while trying to read Credential Manager's password that was piped in: "
+ + ex.getMessage(), ex);
+ throw new CommandLineMasterPasswordException(
+ "An error occured while trying to read Credential Manager's password that was piped in: "
+ + ex.getMessage(), ex);
+ } finally {
+ try {
+ buffReader.close();
+ } catch (Exception ioe1) {
+ // Ignore
+ }
+ }
+ } else { // read the password from the terminal as entered by the user
+ try {
+ // Block until user enters password
+ char passwordArray[] = console.readPassword("Password for Credential Manager: ");
+ if (passwordArray != null) { // user did not abort input
+ password = new String(passwordArray);
+ } // else password will be null
+
+ } catch (Exception ex) {
+ // For some reason the error of the exception thrown
+ // does not get printed from the Launcher so print it here as
+ // well as it gives more clue as to what is going wrong.
+ logger.error(
+ "An error occured while trying to read Credential Manager's password from the terminal: "
+ + ex.getMessage(), ex);
+ throw new CommandLineMasterPasswordException(
+ "An error occured while trying to read Credential Manager's password from the terminal: "
+ + ex.getMessage(), ex);
+ }
+ }
+ return password;
+ }
+
+ private String getCredentialManagerPasswordFromFile() throws CommandLineMasterPasswordException {
+ String password = null;
+ if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_DIRECTORY_OPTION)) {
+ String cmDir = commandLineOptions.getCredentialManagerDir();
+
+ File passwordFile = new File(cmDir, "password.txt");
+ BufferedReader buffReader = null;
+ try {
+ buffReader = new BufferedReader(new FileReader(passwordFile));
+ password = buffReader.readLine();
+ } catch (IOException ioe) {
+ // For some reason the error of the exception thrown
+ // does not get printed from the Launcher so print it here as
+ // well as it gives more clue as to what is going wrong.
+ logger.error("There was an error reading the Credential Manager password from "
+ + passwordFile.toString() + ": " + ioe.getMessage(), ioe);
+ throw new CommandLineMasterPasswordException(
+ "There was an error reading the Credential Manager password from "
+ + passwordFile.toString() + ": " + ioe.getMessage(), ioe);
+ } finally {
+ try {
+ buffReader.close();
+ } catch (Exception ioe1) {
+ // Ignore
+ }
+ }
+ }
+ return password;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineTool.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineTool.java b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineTool.java
new file mode 100644
index 0000000..92f6990
--- /dev/null
+++ b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineTool.java
@@ -0,0 +1,436 @@
+/*
+* 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.taverna.commandline;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.NamingException;
+
+import org.apache.taverna.commandline.data.DatabaseConfigurationHandler;
+import org.apache.taverna.commandline.data.InputsHandler;
+import org.apache.taverna.commandline.data.SaveResultsHandler;
+import org.apache.taverna.commandline.exceptions.DatabaseConfigurationException;
+import org.apache.taverna.commandline.exceptions.InputMismatchException;
+import org.apache.taverna.commandline.exceptions.InvalidOptionException;
+import org.apache.taverna.commandline.exceptions.OpenDataflowException;
+import org.apache.taverna.commandline.exceptions.ReadInputException;
+import org.apache.taverna.commandline.options.CommandLineOptions;
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.RollingFileAppender;
+import org.apache.taverna.databundle.DataBundles;
+import org.apache.taverna.robundle.Bundle;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.validation.ValidationException;
+import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
+import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
+import org.apache.taverna.scufl2.validation.structural.ReportStructuralValidationListener;
+import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
+
+import org.apache.taverna.configuration.database.DatabaseConfiguration;
+import org.apache.taverna.configuration.database.DatabaseManager;
+import org.apache.taverna.platform.execution.api.ExecutionEnvironment;
+import org.apache.taverna.platform.execution.api.InvalidExecutionIdException;
+import org.apache.taverna.platform.execution.api.InvalidWorkflowException;
+import org.apache.taverna.platform.report.State;
+import org.apache.taverna.platform.report.WorkflowReport;
+import org.apache.taverna.platform.run.api.InvalidRunIdException;
+import org.apache.taverna.platform.run.api.RunProfile;
+import org.apache.taverna.platform.run.api.RunProfileException;
+import org.apache.taverna.platform.run.api.RunService;
+import org.apache.taverna.platform.run.api.RunStateException;
+
+/**
+ * A utility class that wraps the process of executing a workflow, allowing workflows to be easily
+ * executed independently of the GUI.
+ *
+ * @author Stuart Owen
+ * @author Alex Nenadic
+ */
+public class CommandLineTool {
+ private static boolean BOOTSTRAP_LOGGING = false;
+ private static Logger logger = Logger.getLogger(CommandLineTool.class);
+
+ private RunService runService;
+ private CredentialManager credentialManager;
+ private CommandLineOptions commandLineOptions;
+ private WorkflowBundle workflowBundle;
+ private WorkflowBundleIO workflowBundleIO;
+ private DatabaseConfiguration databaseConfiguration;
+ private DatabaseManager databaseManager;
+
+ public void run() {
+ try {
+ if (BOOTSTRAP_LOGGING)
+ initialiseLogging();
+ int result = setupAndExecute();
+ System.exit(result);
+ } catch (InvalidOptionException | IOException | ReadInputException
+ | InvalidRunIdException | RunStateException
+ | InvalidExecutionIdException | OpenDataflowException
+ | RunProfileException e) {
+ error(e.getMessage());
+ } catch (CMException e) {
+ error("There was an error initializing Taverna's SSLSocketFactory from Credential Manager. "
+ + e.getMessage());
+ } catch (ReaderException e) {
+ error("There was an error reading the workflow: " + e.getMessage());
+ } catch (ValidationException e) {
+ error("There was an error validating the workflow: " + e.getMessage());
+ } catch (InvalidWorkflowException e) {
+ error("There was an error validating the workflow: " + e.getMessage());
+ } catch (DatabaseConfigurationException e) {
+ error("There was an error configuring the database: " + e.getMessage());
+ }
+ System.exit(1);
+ }
+
+ private void initialiseLogging() {
+ LogManager.resetConfiguration();
+
+ if (System.getProperty("log4j.configuration") == null) {
+ try {
+ PropertyConfigurator.configure(CommandLineTool.class.getClassLoader()
+ .getResource("cl-log4j.properties").toURI().toURL());
+ } catch (MalformedURLException e) {
+ logger.error("There was a serious error reading the default logging configuration",
+ e);
+ } catch (URISyntaxException e) {
+ logger.error("There was a serious error reading the default logging configuration",
+ e);
+ }
+
+ } else {
+ PropertyConfigurator.configure(System.getProperty("log4j.configuration"));
+ }
+
+ if (commandLineOptions.hasLogFile()) {
+ RollingFileAppender appender;
+ try {
+
+ PatternLayout layout = new PatternLayout("%-5p %d{ISO8601} (%c:%L) - %m%n");
+ appender = new RollingFileAppender(layout, commandLineOptions.getLogFile());
+ appender.setMaxFileSize("1MB");
+ appender.setEncoding("UTF-8");
+ appender.setMaxBackupIndex(4);
+ // Let root logger decide level
+ appender.setThreshold(Level.ALL);
+ LogManager.getRootLogger().addAppender(appender);
+ } catch (IOException e) {
+ System.err.println("Could not log to " + commandLineOptions.getLogFile());
+ }
+ }
+ }
+
+ public int setupAndExecute() throws InputMismatchException, InvalidOptionException,
+ CMException, OpenDataflowException, ReaderException, IOException, ValidationException,
+ ReadInputException, InvalidWorkflowException, RunProfileException,
+ InvalidRunIdException, RunStateException, InvalidExecutionIdException, DatabaseConfigurationException {
+
+ if (!commandLineOptions.askedForHelp()) {
+ setupDatabase(commandLineOptions);
+
+ if (commandLineOptions.getWorkflow() != null) {
+
+ /* Set context class loader to us,
+ * so that things such as JSON-LD caching of
+ * robundle works.
+ */
+
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+
+ /*
+ * Initialise Credential Manager and SSL stuff quite early as
+ * parsing and validating the workflow may require it
+ */
+ String credentialManagerDirPath = commandLineOptions.getCredentialManagerDir();
+
+ /*
+ * If credentialManagerDirPath is null, the Credential Manager
+ * will be initialized from the default location in
+ * <TAVERNA_HOME>/security somewhere inside user's home
+ * directory. This should not be used when running command line
+ * tool on a server and the Credential Manager dir path should
+ * always be passed in as we do not want to store the security
+ * files in user's home directory on the server (we do not even
+ * know which user the command line tool will be running as).
+ */
+ if (credentialManagerDirPath != null) {
+ credentialManager.setConfigurationDirectoryPath(new File(
+ credentialManagerDirPath));
+ }
+
+ // Initialise the SSL stuff - set the SSLSocketFactory
+ // to use Taverna's Keystore and Truststore.
+ credentialManager.initializeSSL();
+
+ URL workflowURL = readWorkflowURL(commandLineOptions.getWorkflow());
+
+ workflowBundle = workflowBundleIO.readBundle(workflowURL, null);
+
+ logger.debug("Read the wf bundle");
+
+ validateWorkflowBundle(workflowBundle);
+ logger.debug("Validated the wf bundle");
+
+
+ Set<ExecutionEnvironment> executionEnvironments = runService
+ .getExecutionEnvironments();
+
+ ExecutionEnvironment executionEnvironment = null;
+
+ /*
+ * Find the right execution environment, e.g. local execution
+ * with the correct reference service based on command line
+ * options
+ */
+ while (executionEnvironments.iterator().hasNext()) {
+ // TODO Choose the right one
+ // take the fist one for now
+ executionEnvironment = executionEnvironments.iterator().next();
+ break;
+ }
+
+ logger.debug("Got the execution environment");
+
+ InputsHandler inputsHandler = new InputsHandler();
+ Map<String, InputWorkflowPort> portMap = new HashMap<String, InputWorkflowPort>();
+
+ Workflow workflow = workflowBundle.getMainWorkflow();
+
+ for (InputWorkflowPort port : workflow.getInputPorts()) {
+ portMap.put(port.getName(), port);
+ }
+ inputsHandler.checkProvidedInputs(portMap, commandLineOptions);
+ logger.debug("Checked inputs");
+
+ Bundle inputs = inputsHandler.registerInputs(portMap, commandLineOptions, null);
+ logger.debug("Registered inputs");
+
+ RunProfile runProfile = new RunProfile(executionEnvironment, workflowBundle, inputs);
+
+ String runId = runService.createRun(runProfile);
+
+ runService.start(runId);
+ logger.debug("Started wf run");
+
+ WorkflowReport report = runService.getWorkflowReport(runId);
+
+ while (!workflowFinished(report)) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ System.err.println("Interrupted while waiting for workflow to finish");
+ return 1;
+ }
+ }
+
+ NamedSet<OutputWorkflowPort> workflowOutputPorts = workflow.getOutputPorts();
+ if (!workflowOutputPorts.isEmpty()) {
+ File outputDir = null;
+
+ if (commandLineOptions.saveResultsToDirectory()) {
+ outputDir = determineOutputDir(commandLineOptions, workflowBundle.getName());
+ outputDir.mkdirs();
+ }
+
+ Path outputs = DataBundles.getOutputs(runService.getDataBundle(runId));
+
+ if (outputDir != null) {
+ SaveResultsHandler saveResultsHandler = new SaveResultsHandler(outputDir);
+
+ for (OutputWorkflowPort outputWorkflowPort : workflowOutputPorts) {
+ String workflowOutputPortName = outputWorkflowPort.getName();
+ Path output = DataBundles.getPort(outputs, workflowOutputPortName);
+ if (!DataBundles.isMissing(output)) {
+ saveResultsHandler.saveResultsForPort(workflowOutputPortName, output);
+ }
+ }
+ }
+ }
+ if (commandLineOptions.saveResultsToBundle() != null) {
+ Path bundlePath = Paths.get(commandLineOptions.saveResultsToBundle());
+ DataBundles.closeAndSaveBundle(runService.getDataBundle(runId), bundlePath);
+ System.out.println("Workflow Run Bundle saved to: " + bundlePath.toAbsolutePath());
+ } else {
+ System.out.println("Workflow Run Bundle: " + runService.getDataBundle(runId).getSource());
+ // For debugging we'll leave it in /tmp for now
+ runService.getDataBundle(runId).setDeleteOnClose(false);
+ DataBundles.closeBundle(runService.getDataBundle(runId));
+ }
+
+ if (report.getState().equals(State.FAILED)) {
+ System.out.println("Workflow failed - see report below.");
+ System.out.println(report);
+ } else if (report.getState().equals(State.COMPLETED)) {
+ System.out.println("Workflow completed.");
+ }
+
+ }
+ } else {
+ commandLineOptions.displayHelp();
+ }
+
+ // wait until user hits CTRL-C before exiting
+ if (commandLineOptions.getStartDatabaseOnly()) {
+ // FIXME: need to do this more gracefully.
+ while (true) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ return 0;
+ }
+ }
+ }
+
+ return 0;
+ }
+
+ private boolean workflowFinished(WorkflowReport report) {
+ State state = report.getState();
+ if (state == State.CANCELLED || state == State.COMPLETED || state == State.FAILED) {
+ return true;
+ }
+ return false;
+ }
+
+ protected void validateWorkflowBundle(WorkflowBundle workflowBundle) throws ValidationException {
+ CorrectnessValidator cv = new CorrectnessValidator();
+ ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
+ cv.checkCorrectness(workflowBundle, true, rcvl);
+ if (rcvl.detectedProblems()) {
+ throw rcvl.getException();
+ }
+
+ StructuralValidator sv = new StructuralValidator();
+ ReportStructuralValidationListener rsvl = new ReportStructuralValidationListener();
+ sv.checkStructure(workflowBundle, rsvl);
+ if (rsvl.detectedProblems()) {
+ throw rcvl.getException();
+ }
+ }
+
+ private void setupDatabase(CommandLineOptions options)
+ throws DatabaseConfigurationException {
+ DatabaseConfigurationHandler dbHandler = new DatabaseConfigurationHandler(
+ options, databaseConfiguration, databaseManager);
+ dbHandler.configureDatabase();
+ try {
+ if (!options.isInMemory())
+ dbHandler.testDatabaseConnection();
+ } catch (NamingException e) {
+ throw new DatabaseConfigurationException(
+ "There was an error trying to setup the database datasource: "
+ + e.getMessage(), e);
+ } catch (SQLException e) {
+ if (options.isClientServer())
+ throw new DatabaseConfigurationException(
+ "There was an error whilst making a test database connection. If running with -clientserver you should check that a server is running (check -startdb or -dbproperties)",
+ e);
+ if (options.isEmbedded())
+ throw new DatabaseConfigurationException(
+ "There was an error whilst making a test database connection. If running with -embedded you should make sure that another process isn't using the database, or a server running through -startdb",
+ e);
+ }
+ }
+
+ private File determineOutputDir(CommandLineOptions options, String dataflowName) {
+ File result = new File(dataflowName + "_output");
+ int x = 1;
+ while (result.exists()) {
+ result = new File(dataflowName + "_output_" + x);
+ x++;
+ }
+ System.out.println("Outputs will be saved to the directory: "
+ + result.getAbsolutePath());
+ return result;
+ }
+
+ protected void error(String msg) {
+ System.err.println(msg);
+ }
+
+ private URL readWorkflowURL(String workflowOption) throws OpenDataflowException {
+ try {
+ return new URL(new URL("file:"), workflowOption);
+ } catch (MalformedURLException e) {
+ throw new OpenDataflowException("The was an error processing the URL to the workflow: "
+ + e.getMessage(), e);
+ }
+ }
+
+ public void setCommandLineOptions(CommandLineOptions commandLineOptions){
+ this.commandLineOptions = commandLineOptions;
+ }
+
+ public void setRunService(RunService runService) {
+ this.runService = runService;
+ }
+
+ public void setCredentialManager(CredentialManager credentialManager) {
+ this.credentialManager = credentialManager;
+ }
+
+ public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) {
+ this.workflowBundleIO = workflowBundleIO;
+ }
+
+ /**
+ * Sets the databaseConfiguration.
+ *
+ * @param databaseConfiguration the new value of databaseConfiguration
+ */
+ public void setDatabaseConfiguration(DatabaseConfiguration databaseConfiguration) {
+ this.databaseConfiguration = databaseConfiguration;
+ }
+
+ /**
+ * Sets the databaseManager.
+ *
+ * @param databaseManager the new value of databaseManager
+ */
+ public void setDatabaseManager(DatabaseManager databaseManager) {
+ this.databaseManager = databaseManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/DatabaseConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/DatabaseConfigurationHandler.java b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/DatabaseConfigurationHandler.java
new file mode 100644
index 0000000..49b628e
--- /dev/null
+++ b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/DatabaseConfigurationHandler.java
@@ -0,0 +1,153 @@
+/*
+* 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.taverna.commandline.data;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import javax.naming.NamingException;
+
+import org.apache.taverna.commandline.exceptions.DatabaseConfigurationException;
+import org.apache.taverna.commandline.options.CommandLineOptions;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.configuration.database.DatabaseConfiguration;
+import org.apache.taverna.configuration.database.DatabaseManager;
+
+/**
+ * Handles the initialisation and configuration of the data source according to
+ * the command line arguments, or a properties file.
+ * This also handles starting a network based instance of a Derby server, if requested.
+ *
+ * @author Stuart Owen
+ *
+ */
+public class DatabaseConfigurationHandler {
+
+ private static Logger logger = Logger.getLogger(DatabaseConfigurationHandler.class);
+ private final CommandLineOptions options;
+ private final DatabaseConfiguration dbConfig;
+ private final DatabaseManager databaseManager;
+
+ public DatabaseConfigurationHandler(CommandLineOptions options, DatabaseConfiguration databaseConfiguration, DatabaseManager databaseManager) {
+ this.options = options;
+ this.dbConfig = databaseConfiguration;
+ this.databaseManager = databaseManager;
+ databaseConfiguration.disableAutoSave();
+ }
+
+ public void configureDatabase() throws DatabaseConfigurationException {
+ overrideDefaults();
+ useOptions();
+ if (dbConfig.getStartInternalDerbyServer()) {
+ databaseManager.startDerbyNetworkServer();
+ System.out.println("Started Derby Server on Port: "
+ + dbConfig.getCurrentPort());
+ }
+ }
+
+ public DatabaseConfiguration getDBConfig() {
+ return dbConfig;
+ }
+
+ private void importConfigurationFromStream(InputStream inStr)
+ throws IOException {
+ Properties p = new Properties();
+ p.load(inStr);
+ for (Object key : p.keySet()) {
+ dbConfig.setProperty((String)key, p.getProperty((String)key).trim());
+ }
+ }
+
+ protected void overrideDefaults() throws DatabaseConfigurationException {
+
+ InputStream inStr = DatabaseConfigurationHandler.class.getClassLoader().getResourceAsStream("database-defaults.properties");
+ try {
+ importConfigurationFromStream(inStr);
+ } catch (IOException e) {
+ throw new DatabaseConfigurationException("There was an error reading the default database configuration settings: "+e.getMessage(),e);
+ }
+ }
+
+ protected void readConfigirationFromFile(String filename) throws IOException {
+ FileInputStream fileInputStream = new FileInputStream(filename);
+ importConfigurationFromStream(fileInputStream);
+ fileInputStream.close();
+ }
+
+ public void testDatabaseConnection()
+ throws DatabaseConfigurationException, NamingException, SQLException {
+ //try and get a connection
+ Connection con = null;
+ try {
+ con = databaseManager.getConnection();
+ } finally {
+ if (con!=null)
+ try {
+ con.close();
+ } catch (SQLException e) {
+ logger.warn("There was an SQL error whilst closing the test connection: "+e.getMessage(),e);
+ }
+ }
+ }
+
+ public void useOptions() throws DatabaseConfigurationException {
+
+ if (options.hasOption("port")) {
+ dbConfig.setPort(options.getDatabasePort());
+ }
+
+ if (options.hasOption("startdb")) {
+ dbConfig.setStartInternalDerbyServer(true);
+ }
+
+ if (options.hasOption("inmemory")) {
+ dbConfig.setInMemory(true);
+ }
+
+ if (options.hasOption("embedded")) {
+ dbConfig.setInMemory(false);
+ dbConfig.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
+ }
+
+ if (options.isProvenanceEnabled()) {
+ dbConfig.setProvenanceEnabled(true);
+ }
+
+ if (options.hasOption("clientserver")) {
+ dbConfig.setInMemory(false);
+ dbConfig.setDriverClassName("org.apache.derby.jdbc.ClientDriver");
+ dbConfig.setJDBCUri("jdbc:derby://localhost:" + dbConfig.getPort() + "/t2-database;create=true;upgrade=true");
+ }
+
+ if (options.hasOption("dbproperties")) {
+ try {
+ readConfigirationFromFile(options.getDatabaseProperties());
+ } catch (IOException e) {
+ throw new DatabaseConfigurationException("There was an error reading the database configuration options at "+options.getDatabaseProperties()+" : "+e.getMessage(),e);
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/ErrorValueHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/ErrorValueHandler.java b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/ErrorValueHandler.java
new file mode 100644
index 0000000..6a4b579
--- /dev/null
+++ b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/ErrorValueHandler.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.taverna.commandline.data;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.List;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.apache.taverna.databundle.DataBundles;
+import org.apache.taverna.databundle.ErrorDocument;
+
+/**
+ * Handles ErrorValues and transforming them into String representations
+ * that can be stored as a file, or within a Baclava document.
+ *
+ * @author Stuart Owen
+ * @author David Withers
+ */
+public class ErrorValueHandler {
+
+ /**
+ * Creates a string representation of the ErrorValue.
+ * @throws IOException
+ */
+ public static String buildErrorValueString(ErrorDocument errorValue) throws IOException {
+
+ String errDocumentString = errorValue.getMessage() + "\n";
+
+ String exceptionMessage = errorValue.getMessage();
+ if (exceptionMessage != null && !exceptionMessage.equals("")) {
+ DefaultMutableTreeNode exceptionMessageNode = new DefaultMutableTreeNode(
+ exceptionMessage);
+ errDocumentString += exceptionMessageNode + "\n";
+ errDocumentString += errorValue.getTrace();
+ }
+
+ List<Path> errorReferences = errorValue.getCausedBy();
+ if (!errorReferences.isEmpty()) {
+ errDocumentString += "Set of cause errors to follow." + "\n";
+ }
+ int errorCounter = 1;
+ for (Path cause : errorReferences) {
+ if (DataBundles.isError(cause)) {
+ errDocumentString += "ErrorValue " + (errorCounter++) + "\n";
+ errDocumentString += buildErrorValueString(DataBundles.getError(cause)) + "\n";
+ }
+ }
+
+ return errDocumentString;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java
new file mode 100644
index 0000000..a0da481
--- /dev/null
+++ b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java
@@ -0,0 +1,276 @@
+/*
+* 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.taverna.commandline.data;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.taverna.commandline.exceptions.InputMismatchException;
+import org.apache.taverna.commandline.exceptions.InvalidOptionException;
+import org.apache.taverna.commandline.exceptions.ReadInputException;
+import org.apache.taverna.commandline.options.CommandLineOptions;
+import org.apache.taverna.invocation.InvocationContext;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import org.apache.taverna.databundle.DataBundles;
+import org.apache.taverna.robundle.Bundle;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+
+/**
+ * Handles the reading, or processing, or input values according to arguments provided to the
+ * commandline.
+ * The may be either as direct values, from a file, or from a Baclava document.
+ * Also handles registering the input values with the Data Service, ready to initiate
+ * the workflow run.
+ *
+ * @author Stuart Owen
+ */
+public class InputsHandler {
+
+ private static Logger logger = Logger.getLogger(InputsHandler.class);
+
+ public void checkProvidedInputs(Map<String, InputWorkflowPort> portMap,
+ CommandLineOptions options) throws InputMismatchException {
+ // we dont check for the document
+ Set<String> providedInputNames = new HashSet<String>();
+ for (int i = 0; i < options.getInputFiles().length; i += 2) {
+ // If it already contains a value for the input port, e.g
+ // two inputs are provided for the same port
+ if (providedInputNames.contains(options.getInputFiles()[i])) {
+ throw new InputMismatchException(
+ "Two input values were provided for the same input port "
+ + options.getInputFiles()[i] + ".", null, null);
+ }
+ providedInputNames.add(options.getInputFiles()[i]);
+ }
+
+ for (int i = 0; i < options.getInputValues().length; i += 2) {
+ // If it already contains a value for the input port, e.g
+ // two inputs are provided for the same port
+ if (providedInputNames.contains(options.getInputValues()[i])) {
+ throw new InputMismatchException(
+ "Two input values were provided for the same input port "
+ + options.getInputValues()[i] + ".", null, null);
+ }
+ providedInputNames.add(options.getInputValues()[i]);
+ }
+
+ if (portMap.size() * 2 != (options.getInputFiles().length + options.getInputValues().length)) {
+ throw new InputMismatchException(
+ "The number of inputs provided does not match the number of input ports.",
+ portMap.keySet(), providedInputNames);
+ }
+
+ for (String portName : portMap.keySet()) {
+ if (!providedInputNames.contains(portName)) {
+ throw new InputMismatchException(
+ "The provided inputs does not contain an input for the port '"
+ + portName + "'", portMap.keySet(), providedInputNames);
+ }
+ }
+ }
+
+ public Bundle registerInputs(Map<String, InputWorkflowPort> portMap,
+ CommandLineOptions options, InvocationContext context) throws InvalidOptionException,
+ ReadInputException, IOException {
+ Bundle inputDataBundle;
+ inputDataBundle = DataBundles.createBundle();
+ inputDataBundle.setDeleteOnClose(false);
+ System.out.println("Bundle: " + inputDataBundle.getSource());
+
+ Path inputs = DataBundles.getInputs(inputDataBundle);
+
+ URL url;
+ try {
+ url = new URL("file:");
+ } catch (MalformedURLException e1) {
+ // Should never happen, but just in case:
+ throw new ReadInputException(
+ "The was an internal error setting up the URL to open the inputs. You should contact Taverna support.",
+ e1);
+ }
+
+ if (options.hasInputFiles()) {
+ regesterInputsFromFiles(portMap, options, inputs, url);
+ }
+
+ if (options.hasInputValues()) {
+ registerInputsFromValues(portMap, options, inputs);
+
+ }
+
+ return inputDataBundle;
+ }
+
+ private void registerInputsFromValues(Map<String, InputWorkflowPort> portMap,
+ CommandLineOptions options, Path inputs) throws InvalidOptionException {
+ String[] inputParams = options.getInputValues();
+ for (int i = 0; i < inputParams.length; i = i + 2) {
+ String inputName = inputParams[i];
+ try {
+ String inputValue = inputParams[i + 1];
+ InputWorkflowPort port = portMap.get(inputName);
+
+ if (port == null) {
+ throw new InvalidOptionException("Cannot find an input port named '"
+ + inputName + "'");
+ }
+
+ Path portPath = DataBundles.getPort(inputs, inputName);
+ if (options.hasDelimiterFor(inputName)) {
+ String delimiter = options.inputDelimiter(inputName);
+ Object value = checkForDepthMismatch(1, port.getDepth(), inputName,
+ inputValue.split(delimiter));
+ setValue(portPath, value);
+ } else {
+ Object value = checkForDepthMismatch(0, port.getDepth(), inputName, inputValue);
+ setValue(portPath, value);
+ }
+
+ } catch (IndexOutOfBoundsException e) {
+ throw new InvalidOptionException("Missing input value for input " + inputName);
+ } catch (IOException e) {
+ throw new InvalidOptionException("Error creating value for input " + inputName);
+ }
+ }
+ }
+
+ private void regesterInputsFromFiles(Map<String, InputWorkflowPort> portMap,
+ CommandLineOptions options, Path inputs, URL url) throws InvalidOptionException {
+ String[] inputParams = options.getInputFiles();
+ for (int i = 0; i < inputParams.length; i = i + 2) {
+ String inputName = inputParams[i];
+ try {
+ URL inputURL = new URL(url, inputParams[i + 1]);
+ InputWorkflowPort port = portMap.get(inputName);
+
+ if (port == null) {
+ throw new InvalidOptionException("Cannot find an input port named '"
+ + inputName + "'");
+ }
+
+ Path portPath = DataBundles.getPort(inputs, inputName);
+ if (options.hasDelimiterFor(inputName)) {
+ String delimiter = options.inputDelimiter(inputName);
+ Object value = IOUtils.toString(inputURL.openStream()).split(delimiter);
+ value = checkForDepthMismatch(1, port.getDepth(), inputName, value);
+ setValue(portPath, value);
+ } else {
+ Object value = IOUtils.toByteArray(inputURL.openStream());
+ value = checkForDepthMismatch(0, port.getDepth(), inputName, value);
+ setValue(portPath, value);
+ }
+ } catch (IndexOutOfBoundsException e) {
+ throw new InvalidOptionException("Missing input filename for input " + inputName);
+ } catch (IOException e) {
+ throw new InvalidOptionException("Could not read input " + inputName + ": "
+ + e.getMessage());
+ }
+ }
+ }
+
+ private void setValue(Path port, Object userInput) throws IOException {
+ if (userInput instanceof File) {
+ DataBundles.setReference(port, ((File) userInput).toURI());
+ } else if (userInput instanceof URL) {
+ try {
+ DataBundles.setReference(port, ((URL) userInput).toURI());
+ } catch (URISyntaxException e) {
+ logger.warn(String.format("Error converting %1$s to URI", userInput), e);
+ }
+ } else if (userInput instanceof String) {
+ DataBundles.setStringValue(port, (String) userInput);
+ } else if (userInput instanceof byte[]) {
+ Files.write(port, (byte[]) userInput, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
+ } else if (userInput instanceof List<?>) {
+ DataBundles.createList(port);
+ List<?> list = (List<?>) userInput;
+ for (Object object : list) {
+ setValue(DataBundles.newListItem(port), object);
+ }
+ } else {
+ logger.warn("Unknown input type : " + userInput.getClass().getName());
+ }
+ }
+
+ private Object checkForDepthMismatch(int inputDepth, int portDepth, String inputName,
+ Object inputValue) throws InvalidOptionException {
+ if (inputDepth != portDepth) {
+ if (inputDepth < portDepth) {
+ logger.warn("Wrapping input for '" + inputName + "' from a depth of " + inputDepth
+ + " to the required depth of " + portDepth);
+ while (inputDepth < portDepth) {
+ List<Object> l = new ArrayList<Object>();
+ l.add(inputValue);
+ inputValue = l;
+ inputDepth++;
+ }
+ } else {
+ String msg = "There is a mismatch between depth of the list for the input port '"
+ + inputName + "' and the data presented. The input port requires a "
+ + depthToString(portDepth) + " and the data presented is a "
+ + depthToString(inputDepth);
+ throw new InvalidOptionException(msg);
+ }
+ }
+
+ return inputValue;
+ }
+
+ private String depthToString(int depth) {
+ switch (depth) {
+ case 0:
+ return "single item";
+ case 1:
+ return "list";
+ case 2:
+ return "list of lists";
+ default:
+ return "list of depth " + depth;
+ }
+ }
+
+ private int getObjectDepth(Object o) {
+ int result = 0;
+ if (o instanceof Iterable) {
+ result++;
+ Iterator i = ((Iterable) o).iterator();
+
+ if (i.hasNext()) {
+ Object child = i.next();
+ result = result + getObjectDepth(child);
+ }
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/SaveResultsHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/SaveResultsHandler.java b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/SaveResultsHandler.java
new file mode 100644
index 0000000..1555b5a
--- /dev/null
+++ b/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/SaveResultsHandler.java
@@ -0,0 +1,85 @@
+/*
+* 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.taverna.commandline.data;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+
+import org.apache.taverna.databundle.DataBundles;
+
+/**
+ * Handles all recording of results as they are received by the {@link CommandLineResultListener} or
+ * when the workflow enactment has completed.
+ * This includes saving as a Baclava Document, or storing individual results.
+ *
+ * @author Stuart Owen
+ * @see BaclavaHandler
+ * @see CommandLineResultListener
+ */
+public class SaveResultsHandler {
+
+ private final File outputDirectory;
+
+ public SaveResultsHandler(File rootOutputDir) {
+ this.outputDirectory = rootOutputDir;
+ }
+
+ /**
+ * Given the Data on an output port, saves the data on a disk in the
+ * output directory.
+ *
+ * @param portName
+ * @param data
+ * @throws IOException
+ */
+ public void saveResultsForPort(String portName, Path data) throws IOException {
+ if (DataBundles.isList(data)) {
+ Path outputPath = outputDirectory.toPath().resolve(portName);
+ Files.createDirectories(outputPath);
+ saveList(DataBundles.getList(data), outputPath);
+ } else if (DataBundles.isError(data)) {
+ Files.copy(data, outputDirectory.toPath().resolve(portName + ".error"));
+ } else {
+ Files.copy(data, outputDirectory.toPath().resolve(portName));
+ }
+ }
+
+ private void saveList(List<Path> list, Path destination) throws IOException {
+ int index = 1;
+ for (Path data : list) {
+ if (data != null) {
+ if (DataBundles.isList(data)) {
+ Path outputPath = destination.resolve(String.valueOf(index));
+ Files.createDirectories(outputPath);
+ saveList(DataBundles.getList(data), outputPath);
+ } else if (DataBundles.isError(data)) {
+ Files.copy(data, destination.resolve(String.valueOf(index) + ".error"));
+ } else {
+ Files.copy(data, destination.resolve(String.valueOf(index)));
+ }
+ }
+ index++;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context-osgi.xml b/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context-osgi.xml
index 18b5426..048bd64 100644
--- a/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context-osgi.xml
+++ b/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context-osgi.xml
@@ -7,16 +7,16 @@
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <service ref="commandLineMasterPasswordProvider" interface="net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider" />
+ <service ref="commandLineMasterPasswordProvider" interface="org.apache.taverna.security.credentialmanager.MasterPasswordProvider" />
- <reference id="commandLineOptions" interface="net.sf.taverna.t2.commandline.options.CommandLineOptions"/>
- <reference id="runService" interface="uk.org.taverna.platform.run.api.RunService"/>
+ <reference id="commandLineOptions" interface="org.apache.taverna.commandline.options.CommandLineOptions"/>
+ <reference id="runService" interface="org.apache.taverna.platform.run.api.RunService"/>
<reference id="credentialManager" interface="org.apache.taverna.security.credentialmanager.CredentialManager" />
- <reference id="databaseConfiguration" interface="uk.org.taverna.configuration.database.DatabaseConfiguration" />
- <reference id="databaseManager" interface="uk.org.taverna.configuration.database.DatabaseManager" />
+ <reference id="databaseConfiguration" interface="org.apache.taverna.configuration.database.DatabaseConfiguration" />
+ <reference id="databaseManager" interface="org.apache.taverna.configuration.database.DatabaseManager" />
- <reference id="workflowBundleIO" interface="uk.org.taverna.scufl2.api.io.WorkflowBundleIO" />
- <reference id="t2flowWorkflowBundleReader" interface="uk.org.taverna.scufl2.api.io.WorkflowBundleReader" filter="(mediaType=application/vnd.taverna.t2flow+xml)"/>
- <reference id="rdfXMLWorkflowBundleReader" interface="uk.org.taverna.scufl2.api.io.WorkflowBundleReader" filter="(org.springframework.osgi.bean.name=rdfXMLReader)"/>
+ <reference id="workflowBundleIO" interface="org.apache.taverna.scufl2.api.io.WorkflowBundleIO" />
+ <reference id="t2flowWorkflowBundleReader" interface="org.apache.taverna.scufl2.api.io.WorkflowBundleReader" filter="(mediaType=application/vnd.taverna.t2flow+xml)"/>
+ <reference id="rdfXMLWorkflowBundleReader" interface="org.apache.taverna.scufl2.api.io.WorkflowBundleReader" filter="(org.springframework.osgi.bean.name=rdfXMLReader)"/>
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context.xml b/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context.xml
index 52c0f29..082c9d0 100644
--- a/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context.xml
+++ b/taverna-commandline-common/src/main/resources/META-INF/spring/taverna-commandline-common-context.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="commandLineTool" class="net.sf.taverna.t2.commandline.CommandLineTool" init-method="run">
+ <bean id="commandLineTool" class="org.apache.taverna.commandline.CommandLineTool" init-method="run">
<property name="commandLineOptions" ref="commandLineOptions" />
<property name="runService" ref="runService" />
<property name="credentialManager" ref="credentialManager" />
@@ -14,7 +14,7 @@
</bean>
<bean id="commandLineMasterPasswordProvider"
- class="net.sf.taverna.t2.commandline.CommandLineMasterPasswordProvider">
+ class="org.apache.taverna.commandline.CommandLineMasterPasswordProvider">
<constructor-arg name="commandLineOptions"
ref="commandLineOptions" />
</bean>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/test/java/net/sf/taverna/t2/commandline/TestDatabaseConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/test/java/net/sf/taverna/t2/commandline/TestDatabaseConfigurationHandler.java b/taverna-commandline-common/src/test/java/net/sf/taverna/t2/commandline/TestDatabaseConfigurationHandler.java
deleted file mode 100644
index c8cbb9d..0000000
--- a/taverna-commandline-common/src/test/java/net/sf/taverna/t2/commandline/TestDatabaseConfigurationHandler.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package net.sf.taverna.t2.commandline;
-
-//import net.sf.taverna.t2.workbench.reference.config.DataManagementConfiguration;
-
-public class TestDatabaseConfigurationHandler {
-
-// @Test
-// public void testDefaults() throws Exception {
-// CommandLineOptions opts = new CommandLineOptions(new String[]{"myworkflow.t2flow"});
-// DatabaseConfigurationHandler handler = new DatabaseConfigurationHandler(opts);
-// handler.configureDatabase();
-// assertEquals("org.apache.derby.jdbc.EmbeddedDriver", DataManagementConfiguration.getInstance().getDriverClassName());
-// assertEquals(false, DataManagementConfiguration.getInstance().getStartInternalDerbyServer());
-// }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-common/src/test/java/org/apache/taverna/commandline/TestDatabaseConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-common/src/test/java/org/apache/taverna/commandline/TestDatabaseConfigurationHandler.java b/taverna-commandline-common/src/test/java/org/apache/taverna/commandline/TestDatabaseConfigurationHandler.java
new file mode 100644
index 0000000..a93436e
--- /dev/null
+++ b/taverna-commandline-common/src/test/java/org/apache/taverna/commandline/TestDatabaseConfigurationHandler.java
@@ -0,0 +1,33 @@
+/*
+* 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.taverna.commandline;
+
+
+public class TestDatabaseConfigurationHandler {
+
+// @Test
+// public void testDefaults() throws Exception {
+// CommandLineOptions opts = new CommandLineOptions(new String[]{"myworkflow.t2flow"});
+// DatabaseConfigurationHandler handler = new DatabaseConfigurationHandler(opts);
+// handler.configureDatabase();
+// assertEquals("org.apache.derby.jdbc.EmbeddedDriver", DataManagementConfiguration.getInstance().getDriverClassName());
+// assertEquals(false, DataManagementConfiguration.getInstance().getStartInternalDerbyServer());
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-launcher/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-commandline-launcher/pom.xml b/taverna-commandline-launcher/pom.xml
index 42208e3..e88bd66 100644
--- a/taverna-commandline-launcher/pom.xml
+++ b/taverna-commandline-launcher/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.apache.taverna.commandline</groupId>
<artifactId>taverna-commandline</artifactId>
- <version>3.1.0.incubating-SNAPSHOT</version>
+ <version>3.1.0-incubating-SNAPSHOT</version>
</parent>
<artifactId>taverna-commandline-launcher</artifactId>
<name>Apache Taverna Commandline Launcher</name>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-commandline/blob/9965dffe/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/CommandLineOptionsImpl.java
----------------------------------------------------------------------
diff --git a/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/CommandLineOptionsImpl.java b/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/CommandLineOptionsImpl.java
new file mode 100644
index 0000000..78c1863
--- /dev/null
+++ b/taverna-commandline-launcher/src/main/java/org/apache/taverna/commandline/CommandLineOptionsImpl.java
@@ -0,0 +1,444 @@
+/*
+* 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.taverna.commandline;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.taverna.commandline.exceptions.ArgumentsParsingException;
+import org.apache.taverna.commandline.exceptions.InvalidOptionException;
+import org.apache.taverna.commandline.options.CommandLineOptions;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+
+/**
+ * Handles the processing of command line arguments for enacting a workflow.
+ * This class encapsulates all command line options, and exposes them through higher-level
+ * accessors. Upon creation it checks the validity of the command line options and raises an
+ * {@link InvalidOptionException} if they are invalid.
+ *
+ * @author Stuart Owen
+ * @author David Withers
+ */
+public class CommandLineOptionsImpl implements CommandLineOptions {
+
+ private static final String OUTPUTDIR = "outputdir";
+ private static final String BUNDLE = "bundle";
+ private static final Logger logger = Logger.getLogger(CommandLineOptionsImpl.class);
+ private Options options;
+ private CommandLine commandLine;
+
+ public CommandLineOptionsImpl(String[] args) throws ArgumentsParsingException, InvalidOptionException {
+ this.options = intitialiseOptions();
+ this.commandLine = processArgs(args);
+ checkForInvalid();
+ }
+
+ @Override
+ public boolean askedForHelp() {
+ return hasOption("help") || (getArgs().length==0 && getOptions().length==0);
+ }
+
+ @Override
+ public boolean isProvenanceEnabled() {
+ return hasOption("provenance");
+ }
+
+ protected void checkForInvalid() throws InvalidOptionException {
+ if (askedForHelp()) return;
+ if (isProvenanceEnabled()
+ && !(hasOption("embedded") || hasOption("clientserver") || hasOption("dbproperties")))
+ throw new InvalidOptionException(
+ "You should be running with a database to use provenance");
+ if (isProvenanceEnabled() && hasOption("inmemory"))
+ throw new InvalidOptionException(
+ "You should be running with a database to use provenance");
+ if ((hasOption("inputfile") || hasOption("inputvalue"))
+ && hasOption("inputdoc"))
+ throw new InvalidOptionException(
+ "You can't provide both -input and -inputdoc arguments");
+
+ if (hasOption("inputdelimiter") && hasOption("inputdoc"))
+ throw new InvalidOptionException("You cannot combine the -inputdelimiter and -inputdoc arguments");
+
+ if (getArgs().length == 0
+ && !(hasOption("help") || hasOption("startdb")))
+ throw new InvalidOptionException("You must specify a workflow");
+
+ if (hasOption("inmemory") && hasOption("embedded"))
+ throw new InvalidOptionException(
+ "The options -embedded, -clientserver and -inmemory cannot be used together");
+ if (hasOption("inmemory") && hasOption("clientserver"))
+ throw new InvalidOptionException(
+ "The options -embedded, -clientserver and -inmemory cannot be used together");
+ if (hasOption("embedded") && hasOption("clientserver"))
+ throw new InvalidOptionException(
+ "The options -embedded, -clientserver and -inmemory cannot be used together");
+ }
+
+ @Override
+ public void displayHelp() {
+ boolean full = false;
+ if (hasOption("help")) full=true;
+ displayHelp(full);
+ }
+
+ @Override
+ public void displayHelp(boolean showFullText) {
+
+ HelpFormatter formatter = new HelpFormatter();
+ try {
+ formatter
+ .printHelp("executeworkflow [options] [workflow]", options);
+ if (showFullText) {
+ InputStream helpStream = CommandLineOptionsImpl.class
+ .getClassLoader().getResourceAsStream("help.txt");
+ String helpText = IOUtils.toString(helpStream);
+ System.out.println(helpText);
+ }
+
+ } catch (IOException e) {
+ logger.error("Failed to load the help document", e);
+ System.out.println("Failed to load the help document");
+ //System.exit(-1);
+ }
+ }
+
+ @Override
+ public String[] getArgs() {
+ return commandLine.getArgs();
+ }
+
+ /**
+ *
+ * @return the port that the database should run on
+ */
+ @Override
+ public String getDatabasePort() {
+ return getOptionValue("port");
+ }
+
+ /**
+ *
+ * @return a path to a properties file that contains database configuration
+ * settings
+ */
+ @Override
+ public String getDatabaseProperties() {
+ return getOptionValue("dbproperties");
+ }
+
+ /**
+ * Returns an array that alternates between a portname and path to a file
+ * containing the input values. Therefore the array will always contain an
+ * even number of elements
+ *
+ * @return an array of portname and path to files containing individual
+ * inputs.
+ */
+ @Override
+ public String[] getInputFiles() {
+ if (hasInputFiles()) {
+ return getOptionValues("inputfile");
+ } else {
+ return new String[] {};
+ }
+ }
+
+ @Override
+ public String[] getInputValues() {
+ if (hasInputValues()) {
+ return getOptionValues("inputvalue");
+ } else {
+ return new String[] {};
+ }
+ }
+
+ @Override
+ public String getLogFile() {
+ return getOptionValue("logfile");
+ }
+
+ public Option [] getOptions() {
+ return commandLine.getOptions();
+ }
+
+ private String getOptionValue(String opt) {
+ return commandLine.getOptionValue(opt);
+ }
+
+ private String[] getOptionValues(String arg0) {
+ return commandLine.getOptionValues(arg0);
+ }
+
+ /**
+ *
+ * @return the directory to write the results to
+ */
+ @Override
+ public String getOutputDirectory() {
+ return getOptionValue(OUTPUTDIR);
+ }
+
+ @Override
+ public boolean getStartDatabase() {
+ return hasOption("startdb");
+ }
+
+ /**
+ * @return the directory with Credential Manager's files
+ */
+ @Override
+ public String getCredentialManagerDir() {
+ return getOptionValue(CREDENTIAL_MANAGER_DIR_OPTION);
+ }
+
+ @Override
+ public boolean getStartDatabaseOnly() throws InvalidOptionException {
+ return (getStartDatabase() && (getWorkflow() == null));
+ }
+
+ @Override
+ public String getWorkflow() throws InvalidOptionException {
+ if (getArgs().length == 0) {
+ return null;
+ } else if (getArgs().length != 1) {
+ throw new InvalidOptionException(
+ "You should only specify one workflow file");
+ } else {
+ return getArgs()[0];
+ }
+ }
+
+ @Override
+ public boolean hasDelimiterFor(String inputName) {
+ boolean result = false;
+ if (hasOption("inputdelimiter")) {
+ String [] values = getOptionValues("inputdelimiter");
+ for (int i=0;i<values.length;i+=2) {
+ if (values[i].equals(inputName))
+ {
+ result=true;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public boolean hasInputFiles() {
+ return hasOption("inputfile");
+ }
+
+ @Override
+ public boolean hasInputValues() {
+ return hasOption("inputvalue");
+ }
+
+ @Override
+ public boolean hasLogFile() {
+ return hasOption("logfile");
+ }
+
+ @Override
+ public boolean hasOption(String option) {
+ return commandLine.hasOption(option);
+ }
+
+ @Override
+ public String inputDelimiter(String inputName) {
+ String result = null;
+ if (hasOption("inputdelimiter")) {
+ String [] values = getOptionValues("inputdelimiter");
+ for (int i=0;i<values.length;i+=2) {
+ if (values[i].equals(inputName))
+ {
+ result=values[i+1];
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ @SuppressWarnings("static-access")
+ private Options intitialiseOptions() {
+ Option helpOption = new Option("help", "Display comprehensive help information.");
+
+ Option outputOption = OptionBuilder
+ .withArgName("directory")
+ .hasArg()
+ .withDescription(
+ "Save outputs as files in directory, default "
+ + "is to make a new directory workflowName_output.")
+ .create(OUTPUTDIR);
+
+ Option bundleOption = OptionBuilder.withArgName(BUNDLE).hasArg()
+ .withDescription("Save outputs to a new Workflow Run Bundle (zip).")
+ .create(BUNDLE);
+
+ Option logFileOption = OptionBuilder
+ .withArgName("filename")
+ .hasArg()
+ .withDescription(
+ "The logfile to which more verbose logging will be written to.")
+ .create("logfile");
+
+ Option inputdocOption = OptionBuilder.withArgName("document").hasArg()
+ .withDescription("Load inputs from a Baclava document.").create(
+ "inputdoc");
+
+ Option inputFileOption = OptionBuilder
+ .withArgName("inputname filename").hasArgs(2)
+ .withValueSeparator(' ').withDescription(
+ "Load the named input from file or URL.").create(
+ "inputfile");
+
+ Option inputValueOption = OptionBuilder.withArgName("inputname value")
+ .hasArgs(2).withValueSeparator(' ').withDescription(
+ "Directly use the value for the named input.").create(
+ "inputvalue");
+
+ Option inputDelimiterOption = OptionBuilder
+ .withArgName("inputname delimiter")
+ .hasArgs(2)
+ .withValueSeparator(' ')
+ .withDescription(
+ "Cause an inputvalue or inputfile to be split into a list according to the delimiter. The associated workflow input must be expected to receive a list.")
+ .create("inputdelimiter");
+
+ Option dbProperties = OptionBuilder.withArgName("filename").hasArg()
+ .withDescription(
+ "Load a properties file to configure the database.")
+ .create("dbproperties");
+
+ Option port = OptionBuilder
+ .withArgName("portnumber")
+ .hasArg()
+ .withDescription(
+ "The port that the database is running on. If set requested to start its own internal server, this is the start port that will be used.")
+ .create("port");
+
+ Option embedded = new Option("embedded",
+ "Connect to an embedded Derby database. This can prevent mulitple invocations.");
+ Option clientserver = new Option("clientserver",
+ "Connect as a client to a derby server instance.");
+ Option inMemOption = new Option(
+ "inmemory",
+ "Run the workflow with data stored in-memory rather than in a database (this is the default option). This can give performance inprovements, at the cost of overall memory usage.");
+ Option startDB = new Option("startdb",
+ "Automatically start an internal Derby database server.");
+ Option provenance = new Option("provenance",
+ "Generate provenance information and store it in the database.");
+
+
+ Option credentialManagerDirectory = OptionBuilder.withArgName("directory path").
+ hasArg().withDescription(
+ "Absolute path to a directory where Credential Manager's files (keystore and truststore) are located.")
+ .create(CREDENTIAL_MANAGER_DIR_OPTION);
+ Option credentialManagerPassword = new Option(CREDENTIAL_MANAGER_PASSWORD_OPTION, "Indicate that the master password for Credential Manager will be provided on standard input."); // optional password option, to be read from standard input
+
+ Options options = new Options();
+ options.addOption(helpOption);
+ options.addOption(inputFileOption);
+ options.addOption(inputValueOption);
+ options.addOption(inputDelimiterOption);
+ options.addOption(inputdocOption);
+ options.addOption(outputOption);
+ options.addOption(bundleOption);
+ options.addOption(inMemOption);
+ options.addOption(embedded);
+ options.addOption(clientserver);
+ options.addOption(dbProperties);
+ options.addOption(port);
+ options.addOption(startDB);
+ options.addOption(provenance);
+ options.addOption(logFileOption);
+ options.addOption(credentialManagerDirectory);
+ options.addOption(credentialManagerPassword);
+
+ return options;
+ }
+
+ @Override
+ public boolean isClientServer() {
+ return hasOption("clientserver");
+ }
+
+ @Override
+ public boolean isEmbedded() {
+ return hasOption("embedded");
+ }
+
+ @Override
+ public boolean isInMemory() {
+ return hasOption("inmemory");
+ }
+
+ private CommandLine processArgs(String[] args) throws ArgumentsParsingException {
+ CommandLineParser parser = new GnuParser();
+ CommandLine line = null;
+ try {
+ // parse the command line arguments
+ line = parser.parse(options, args);
+ } catch (ParseException exp) {
+ // oops, something went wrong
+// System.err.println("Taverna command line arguments' parsing failed. Reason: " + exp.getMessage());
+// System.exit(1);
+ throw new ArgumentsParsingException("Taverna command line arguments' parsing failed. Reason: " + exp.getMessage(), exp);
+ }
+ return line;
+ }
+
+ /**
+ * Save the results to a directory if -outputdir has been explicitly defined,
+ * or if -outputdoc has not been defined.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean saveResultsToDirectory() {
+ return (options.hasOption(OUTPUTDIR) || !hasSaveResultsToBundle());
+ }
+
+ @Override
+ public String saveResultsToBundle() {
+ if (! hasSaveResultsToBundle()) {
+ return null;
+ }
+ return getOptionValue(BUNDLE);
+ }
+
+ @Override
+ public boolean hasSaveResultsToBundle() {
+ return hasOption(BUNDLE);
+ }
+
+}