Also remember that this would be global across all runs - to reset you
would need to restart Taverna (or unset the property from a beanshell
script). You would also have to make sure you don't run two instances
of the workflow at the same time. Also this would probably never work
reliably on a Taverna server.


On Fri, Oct 30, 2009 at 15:56, Alan Williams <[email protected]> wrote:
> Anja Le Blanc wrote:
>>
>> Hi All,
>
> Hello,
>
>> Sorry to pick up an old thread again. But is there a workaround to have a
>> global variable in the current version of Taverna (2.1 Beta 2)?
>>
>> I want to have a Beanshell which runs iteratively and always does one
>> thing, but the first time the inputs come in some configuration it should
>> also do something else (only the first time) - so I need to remember a
>> previous state somewhere.
>
> Yes there is quite an easy workaround.  You can use System.setProperty and
> System.getProperty in your beanshell.
>
> As an example, here is a workflow that uses two beanshells, one to set and
> one to get a property.  The one to get the property is configured to run
> after the property setter.  It is able to read the property that has been
> set.
>
> Please note that this is not the best way to pass data between services.
>  Because it is done "behind the scenes" it will not be kept in any
> provenance databases.
>
>> Best regards,
>> Anja
>
> Alan
>
>
>
> <workflow xmlns="http://taverna.sf.net/2008/xml/t2flow"; version="1"
> producedBy="taverna-2.1-beta-2"><dataflow
> id="a41a45d2-cbb9-4c64-b817-5b7767995e63"
> role="top"><name>Workflow61</name><inputPorts><port><name>input</name><depth>0</depth><granularDepth>0</granularDepth><annotations
> /></port></inputPorts><outputPorts><port><name>result</name></port></outputPorts><processors><processor><name>propertySetter</name><inputPorts><port><name>in</name><depth>0</depth></port></inputPorts><outputPorts
> /><annotations
> /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>beanshell-activity</artifact><version>0.8</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</class><inputMap><map
> from="in" to="in" /></inputMap><outputMap /><configBean
> encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean
> xmlns="">
>  <script>System.setProperty("anja", in);</script>
>  <dependencies />
>  <classLoaderSharing>workflow</classLoaderSharing>
>  <localDependencies />
>  <artifactDependencies />
>  <inputs>
>
>  <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
>      <handledReferenceSchemes />
>      <translatedElementType>java.lang.String</translatedElementType>
>      <allowsLiteralValues>true</allowsLiteralValues>
>      <name>in</name>
>      <depth>0</depth>
>      <mimeTypes>
>        <string>text/plain</string>
>      </mimeTypes>
>
>  </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
>  </inputs>
>  <outputs />
> </net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean><annotations
> /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>0.8</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="">
>  <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>0.8</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>0.8</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>0.8</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="">
>  <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>0.8</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="in" depth="0"
> /></cross></strategy></iteration></iterationStrategyStack></processor><processor><name>propertyGetter</name><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>beanshell-activity</artifact><version>0.8</version></raven><class>net.sf.taverna.t2.activities.beanshell.BeanshellActivity</class><inputMap
> /><outputMap><map from="out" to="out" /></outputMap><configBean
> encoding="xstream"><net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean
> xmlns="">
>  <script>out = System.getProperty("anja");</script>
>  <dependencies />
>  <classLoaderSharing>workflow</classLoaderSharing>
>  <localDependencies />
>  <artifactDependencies />
>  <inputs />
>  <outputs>
>
>  <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
>      <granularDepth>0</granularDepth>
>      <name>out</name>
>      <depth>0</depth>
>      <mimeTypes>
>        <string>text/plain</string>
>      </mimeTypes>
>
>  </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
>  </outputs>
> </net.sf.taverna.t2.activities.beanshell.BeanshellActivityConfigurationBean></configBean><annotations
> /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>0.8</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="">
>  <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>0.8</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>0.8</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>0.8</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="">
>  <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>0.8</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><condition
> control="propertySetter" target="propertyGetter"
> /></conditions><datalinks><datalink><sink
> type="processor"><processor>propertySetter</processor><port>in</port></sink><source
> type="dataflow"><port>input</port></source></datalink><datalink><sink
> type="dataflow"><port>result</port></sink><source
> type="processor"><processor>propertyGetter</processor><port>out</port></source></datalink></datalinks><annotations
> /></dataflow></workflow>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> taverna-users mailing list
> [email protected]
> [email protected]
> Web site: http://www.taverna.org.uk
> Mailing lists: http://www.taverna.org.uk/taverna-mailing-lists/
>
>



-- 
Stian Soiland-Reyes, myGrid team
School of Computer Science
The University of Manchester

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
taverna-users mailing list
[email protected]
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/taverna-mailing-lists/

Reply via email to