org.apache.oozie.workflow
Interface WorkflowInstance

All Known Implementing Classes:
LiteWorkflowInstance

public interface WorkflowInstance

A workflow instance is an executable instance of a WorkflowApp.


Nested Class Summary
static class WorkflowInstance.Status
          Defines the possible stati of a WorkflowInstance.
 
Field Summary
static String NODE_VAR_SEPARATOR
          Separator to qualify variables belonging to a node.
 
Method Summary
 void fail(String nodeName)
          Fail the instance.
 Map<String,String> getAllVars()
          Return a map with all the variables in the context of the instance.
 WorkflowApp getApp()
          Return the workflow application that defines the instance.
 org.apache.hadoop.conf.Configuration getConf()
          Return the configuration of the instance.
 String getId()
          Return the ID of the instance.
 NodeDef getNodeDef(String executionPath)
          Get NodeDef from workflow instance
 WorkflowInstance.Status getStatus()
          Return the current status of the instance.
 Object getTransientVar(String name)
          Return a transient variable from the context of the instance.
 String getTransition(String node)
          Return the transition a node did.
 String getVar(String name)
          Return a variable from the context of the instance.
 void kill()
          Kill the instance.
 void resume()
          Resume the instance.
 void setAllVars(Map<String,String> varMap)
          Add a set of variables in the context of the instance.
 void setTransientVar(String name, Object value)
          Set a transient variable in the context of the instance.
 void setVar(String name, String value)
          Set a variable in the context of the instance.
 boolean signal(String path, String signaValue)
          Signal the instance that a node has completed.
 boolean start()
          Start the instance.
 void suspend()
          Suspend the instance.
 

Field Detail

NODE_VAR_SEPARATOR

static final String NODE_VAR_SEPARATOR
Separator to qualify variables belonging to a node.

Variables names should be compossed as nodeName + NODE_VAR_SEPARATOR + varName.

See Also:
Constant Field Values
Method Detail

getConf

org.apache.hadoop.conf.Configuration getConf()
Return the configuration of the instance.

Returns:
the configuration of the instance.

getId

String getId()
Return the ID of the instance.

Returns:
the ID of the instance.

getApp

WorkflowApp getApp()
Return the workflow application that defines the instance.

Returns:
the workflow application that defines the instance.

start

boolean start()
              throws WorkflowException
Start the instance.

Throws:
WorkflowException - thrown if the instance could not be started.

signal

boolean signal(String path,
               String signaValue)
               throws WorkflowException
Signal the instance that a node has completed.

Parameters:
path - execution path of the node that has completed.
signaValue - signal value for the node.
Returns:
true if the instance has completed its execution, false otherwise.
Throws:
WorkflowException

fail

void fail(String nodeName)
          throws WorkflowException
Fail the instance.

All executing nodes will be be signaled for fail.

Parameters:
nodeName - the name of the node to be failed.
Throws:
WorkflowException - thrown if the instance could not be failed.

kill

void kill()
          throws WorkflowException
Kill the instance.

All executing nodes will be be signaled for kill.

Throws:
WorkflowException - thrown if the instance could not be killed.

suspend

void suspend()
             throws WorkflowException
Suspend the instance.

Throws:
WorkflowException - thrown if the instance could not be suspended.

resume

void resume()
            throws WorkflowException
Resume the instance.

Throws:
WorkflowException - thrown if the instance could not be resume.

getStatus

WorkflowInstance.Status getStatus()
Return the current status of the instance.

Returns:
the current status of the instance.

setVar

void setVar(String name,
            String value)
Set a variable in the context of the instance.

Variables are persisted with the instance.

Parameters:
name - variable name.
value - variable value, setting a null value removes the variable.

getVar

String getVar(String name)
Return a variable from the context of the instance.

Parameters:
name - name of the variable.
Returns:
variable value, null if the variable is not in the context.

getAllVars

Map<String,String> getAllVars()
Return a map with all the variables in the context of the instance.

Returns:
a map with all the variables in the context of the instance.

setAllVars

void setAllVars(Map<String,String> varMap)
Add a set of variables in the context of the instance.

Variables are persisted with the instance.

Parameters:
varMap - map with the variables to add.

setTransientVar

void setTransientVar(String name,
                     Object value)
Set a transient variable in the context of the instance.

Transient variables are not persisted with the instance.

Parameters:
name - transient variable name.
value - transient variable value, setting a null value removes the variable.

getTransientVar

Object getTransientVar(String name)
Return a transient variable from the context of the instance.

Parameters:
name - name of the transient variable.
Returns:
transient variable value, null if the variable is not in the context.

getTransition

String getTransition(String node)
Return the transition a node did.

This is meaninful only for action and decision nodes.

Parameters:
node - the node name.
Returns:
the transition the node did, null if the node didn't execute yet.

getNodeDef

NodeDef getNodeDef(String executionPath)
Get NodeDef from workflow instance

Parameters:
executionPath - execution path
Returns:
node def


Copyright © 2012 Apache Software Foundation. All Rights Reserved.