org.apache.oozie.workflow.lite
Class LiteWorkflowInstance

java.lang.Object
  extended by org.apache.oozie.workflow.lite.LiteWorkflowInstance
All Implemented Interfaces:
org.apache.hadoop.io.Writable, WorkflowInstance

public class LiteWorkflowInstance
extends Object
implements org.apache.hadoop.io.Writable, WorkflowInstance


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.oozie.workflow.WorkflowInstance
WorkflowInstance.Status
 
Field Summary
 
Fields inherited from interface org.apache.oozie.workflow.WorkflowInstance
NODE_VAR_SEPARATOR
 
Constructor Summary
protected LiteWorkflowInstance()
           
  LiteWorkflowInstance(LiteWorkflowApp def, org.apache.hadoop.conf.Configuration conf, String instanceId)
           
 
Method Summary
 boolean equals(Object o)
           
 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
 LiteWorkflowApp getProcessDefinition()
           
 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.
 boolean hasEnded()
           
 int hashCode()
           
 boolean hasTransientVar(String name)
           
 boolean isSuspended()
           
 void kill()
          Kill the instance.
 void readFields(DataInput dIn)
           
 void resume()
          Resume the instance.
 void setAllVars(Map<String,String> varMap)
          Add a set of variables in the context of the instance.
 void setStatus(WorkflowInstance.Status status)
           
 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 executionPath, String signalValue)
          Signal the instance that a node has completed.
 boolean start()
          Start the instance.
 void suspend()
          Suspend the instance.
 void write(DataOutput dOut)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiteWorkflowInstance

protected LiteWorkflowInstance()

LiteWorkflowInstance

public LiteWorkflowInstance(LiteWorkflowApp def,
                            org.apache.hadoop.conf.Configuration conf,
                            String instanceId)
Method Detail

start

public boolean start()
              throws WorkflowException
Description copied from interface: WorkflowInstance
Start the instance.

Specified by:
start in interface WorkflowInstance
Throws:
WorkflowException - thrown if the instance could not be started.

signal

public boolean signal(String executionPath,
                      String signalValue)
               throws WorkflowException
Description copied from interface: WorkflowInstance
Signal the instance that a node has completed.

Specified by:
signal in interface WorkflowInstance
Parameters:
executionPath - execution path of the node that has completed.
signalValue - signal value for the node.
Returns:
true if the instance has completed its execution, false otherwise.
Throws:
WorkflowException

getNodeDef

public NodeDef getNodeDef(String executionPath)
Get NodeDef from workflow instance

Specified by:
getNodeDef in interface WorkflowInstance
Parameters:
executionPath - execution path
Returns:
node def

fail

public void fail(String nodeName)
          throws WorkflowException
Description copied from interface: WorkflowInstance
Fail the instance.

All executing nodes will be be signaled for fail.

Specified by:
fail in interface WorkflowInstance
Parameters:
nodeName - the name of the node to be failed.
Throws:
WorkflowException - thrown if the instance could not be failed.

kill

public void kill()
          throws WorkflowException
Description copied from interface: WorkflowInstance
Kill the instance.

All executing nodes will be be signaled for kill.

Specified by:
kill in interface WorkflowInstance
Throws:
WorkflowException - thrown if the instance could not be killed.

suspend

public void suspend()
             throws WorkflowException
Description copied from interface: WorkflowInstance
Suspend the instance.

Specified by:
suspend in interface WorkflowInstance
Throws:
WorkflowException - thrown if the instance could not be suspended.

isSuspended

public boolean isSuspended()

resume

public void resume()
            throws WorkflowException
Description copied from interface: WorkflowInstance
Resume the instance.

Specified by:
resume in interface WorkflowInstance
Throws:
WorkflowException - thrown if the instance could not be resume.

setVar

public void setVar(String name,
                   String value)
Description copied from interface: WorkflowInstance
Set a variable in the context of the instance.

Variables are persisted with the instance.

Specified by:
setVar in interface WorkflowInstance
Parameters:
name - variable name.
value - variable value, setting a null value removes the variable.

getAllVars

public Map<String,String> getAllVars()
Description copied from interface: WorkflowInstance
Return a map with all the variables in the context of the instance.

Specified by:
getAllVars in interface WorkflowInstance
Returns:
a map with all the variables in the context of the instance.

setAllVars

public void setAllVars(Map<String,String> varMap)
Description copied from interface: WorkflowInstance
Add a set of variables in the context of the instance.

Variables are persisted with the instance.

Specified by:
setAllVars in interface WorkflowInstance
Parameters:
varMap - map with the variables to add.

getVar

public String getVar(String name)
Description copied from interface: WorkflowInstance
Return a variable from the context of the instance.

Specified by:
getVar in interface WorkflowInstance
Parameters:
name - name of the variable.
Returns:
variable value, null if the variable is not in the context.

setTransientVar

public void setTransientVar(String name,
                            Object value)
Description copied from interface: WorkflowInstance
Set a transient variable in the context of the instance.

Transient variables are not persisted with the instance.

Specified by:
setTransientVar in interface WorkflowInstance
Parameters:
name - transient variable name.
value - transient variable value, setting a null value removes the variable.

hasTransientVar

public boolean hasTransientVar(String name)

getTransientVar

public Object getTransientVar(String name)
Description copied from interface: WorkflowInstance
Return a transient variable from the context of the instance.

Specified by:
getTransientVar in interface WorkflowInstance
Parameters:
name - name of the transient variable.
Returns:
transient variable value, null if the variable is not in the context.

hasEnded

public boolean hasEnded()

getProcessDefinition

public LiteWorkflowApp getProcessDefinition()

getStatus

public WorkflowInstance.Status getStatus()
Description copied from interface: WorkflowInstance
Return the current status of the instance.

Specified by:
getStatus in interface WorkflowInstance
Returns:
the current status of the instance.

setStatus

public void setStatus(WorkflowInstance.Status status)

write

public void write(DataOutput dOut)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput dIn)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

getConf

public org.apache.hadoop.conf.Configuration getConf()
Description copied from interface: WorkflowInstance
Return the configuration of the instance.

Specified by:
getConf in interface WorkflowInstance
Returns:
the configuration of the instance.

getApp

public WorkflowApp getApp()
Description copied from interface: WorkflowInstance
Return the workflow application that defines the instance.

Specified by:
getApp in interface WorkflowInstance
Returns:
the workflow application that defines the instance.

getId

public String getId()
Description copied from interface: WorkflowInstance
Return the ID of the instance.

Specified by:
getId in interface WorkflowInstance
Returns:
the ID of the instance.

getTransition

public String getTransition(String node)
Description copied from interface: WorkflowInstance
Return the transition a node did.

This is meaninful only for action and decision nodes.

Specified by:
getTransition in interface WorkflowInstance
Parameters:
node - the node name.
Returns:
the transition the node did, null if the node didn't execute yet.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012 Apache Software Foundation. All Rights Reserved.