org.openemcee.microflow.tasks
Class CallSubflowTask

java.lang.Object
  extended byorg.openemcee.microflow.tasks.CallSubflowTask
All Implemented Interfaces:
MicroflowTask

public class CallSubflowTask
extends java.lang.Object
implements MicroflowTask

This task is called to execute a Microflow from another Microflow. Only flows launched using an org.openemcee.microflow.frontend.MicroflowRunner created by an org.openemcee.microflow.frontend.MicroflowFactory can use this task. Please see this example task config:

 
  <task name="SubflowTask"
        jclass="org.openemcee.microflow.tasks.CallSubflowTask">
        <outcome name="terminate"
                 nextTask="MainTask"/>
        <outcome name="fail2"
                 nextTask="MainTask"/>
        <outcome name="default"
                 terminal="true"
                 failure="true"/>
        <params>
           <param>
              <name>subflow_name</name>
              <value>test_basicflow</value>
           </param>
           <param>
              <name>exposed_data</name>
              <value>comps, num_tasks</value>
           </param>
        </params>
  </task>
 
 
"subflow_name" is required to determine which flow to execute. The Microflow XML is assumed to be relative to the URL which was used to create the MicroflowRunner which launched the parent flow. A comma separated list of MicroflowData names is required to pass information between Microflows. All data is considered "in-out". If the Microflow executes successfully, the last outcome of the last task is assumed to be the outcome of this class. If the microflow fails, the following will be the outcome.
 |--------------------------|-------------------------------------------
 | OUTCOME_NAME             | REASON
 |--------------------------|-------------------------------------------
 | illegal_sys_state        | Microflow internal state was invalid
 | microflow_not_found      | Microflow XML was not found
 | data_integrity_exception | Subflow terminated with a data integrity exception.
 | microflow_failure        | The Microflow failed due to config problems, or unchecked exceptions.
 | ANYTHING ELSE            | The last task terminated with this outcome.
 |--------------------------|--------------------------------------------
 
If any of the above errors occur, the source exception chain will be available in the Microflow data under "org.openemcee.microflow.impl.MicroflowExecutor.SUBFLOW_EXCEPTION_KEY"

Author:
Scott Schenkein

Field Summary
 
Fields inherited from interface org.openemcee.microflow.usercore.MicroflowTask
VCS_ID
 
Constructor Summary
CallSubflowTask()
          Creates a new instance of CallSubflowTask
 
Method Summary
 MicroflowTaskOutcome executeTask(MicroflowData data)
          See class description.
 boolean init(MicroflowParameters params)
          This method is called once, and only once, prior to calling execute task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallSubflowTask

public CallSubflowTask()
Creates a new instance of CallSubflowTask

Method Detail

executeTask

public MicroflowTaskOutcome executeTask(MicroflowData data)
See class description.

Specified by:
executeTask in interface MicroflowTask
Parameters:
data - This parameter provides access to the data associated with the current Microflow.
Returns:
This method returns a MicroflowTask explaining the outcome, perhaps "success", "failure", "communication_error", etc...

init

public boolean init(MicroflowParameters params)
Description copied from interface: MicroflowTask
This method is called once, and only once, prior to calling execute task. It provides access to the parameters specified in the task definition in the Microflow job defintion XML document. If the initialization fails, the executeTask will not be called, and the calling Microflow will fail.

Specified by:
init in interface MicroflowTask
Parameters:
params - A MicroflowParameters object which contains any parameters specified in the microflow XML.
Returns:
True on successful initialization, false on failure.


OpenEmcee Microflow Engine for Java: All software and content contained herein is subject to the Mozilla public license v1.1.
SourceForge.net Logo