Keel 2.1RC2

org.keel.models.util.workflow
Class KeelWorkflow

java.lang.Object
  extended byorg.keel.services.model.StandardModel
      extended byorg.keel.services.model.StandardLogEnabledModel
          extended byorg.keel.models.util.workflow.KeelWorkflow
All Implemented Interfaces:
Configurable, LogEnabled, Model

public class KeelWorkflow
extends StandardLogEnabledModel

Author:
Jeffrey E. Richley

Field Summary
private  java.lang.String filePath
           
private static java.lang.String INDEX_CONST
           
private static java.lang.String MEMORY_CONTEXT_KEY
           
private  java.lang.String modelName
           
static PersistentFactory pf
           
private  java.lang.String processName
           
private  boolean subworkflow
           
private static java.lang.String VALIDATION_ERROR_PARM
           
static java.lang.String WORKFLOW_PARAMETER
           
private  java.lang.String workflowId
           
private  java.lang.String workflowName
           
 
Fields inherited from class org.keel.services.model.StandardLogEnabledModel
log
 
Fields inherited from class org.keel.services.model.StandardModel
configuration
 
Fields inherited from interface org.keel.services.model.Model
ROLE
 
Constructor Summary
KeelWorkflow()
           
 
Method Summary
private  void addBackRefreshInfo(ModelRequest request, ModelResponse response)
           
private  void addToConfiguration(java.io.InputStream is, Configuration configuration, java.lang.String processName)
           
private  void addToMemoryHistory(ModelRequest request)
           
private  boolean checkIfInput(ModelResponse response)
           
 void configure(Configuration configuration)
          Pass the Configuration to the Configurable class.
 ModelResponse execute(ModelRequest request)
           
private  ModelResponse executeWorkflow(ModelRequest request)
           
protected  Configuration getConfig()
           
private  java.util.Map getContext(ModelRequest request)
          This function returns the workflow context for this workflow.
private  RedEngine getEngine()
           
private  java.lang.Object getFromContext(ModelRequest request, java.lang.Object key)
          Get a parameter from thje workflow context
private  java.io.InputStream getInputStreamFromPath(java.lang.String name, java.io.InputStream is)
           
private  RedMemory getMemory(RedEngine engine)
           
protected  java.lang.String getModelName(ModelRequest request)
           
protected  Configuration getNextSequence(ModelRequest request, boolean advance)
           
private  java.io.InputStream getWorkflowInputStream(java.lang.String name)
           
private  boolean isFirstModel()
           
private  void putInContext(ModelRequest request, java.lang.Object key, java.lang.Object value)
          Store a key/value pair in the workflow context
private  void removeMemory()
           
private  void rollBackWorkflow(ModelRequest request, int numToRollBack)
           
private  void setParameters(RedMemory memory, ModelRequest request)
           
private  void storeBackRefreshIndex(ModelRequest request)
           
private  int wasBackOrRefresh(ModelRequest request)
           
 
Methods inherited from class org.keel.services.model.StandardLogEnabledModel
enableLogging
 
Methods inherited from class org.keel.services.model.StandardModel
getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_ERROR_PARM

private static final java.lang.String VALIDATION_ERROR_PARM
See Also:
Constant Field Values

INDEX_CONST

private static java.lang.String INDEX_CONST

WORKFLOW_PARAMETER

public static java.lang.String WORKFLOW_PARAMETER

MEMORY_CONTEXT_KEY

private static java.lang.String MEMORY_CONTEXT_KEY

pf

public static PersistentFactory pf

processName

private java.lang.String processName

modelName

private java.lang.String modelName

workflowName

private java.lang.String workflowName

filePath

private java.lang.String filePath

workflowId

private java.lang.String workflowId

subworkflow

private boolean subworkflow
Constructor Detail

KeelWorkflow

public KeelWorkflow()
Method Detail

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Description copied from interface: Configurable
Pass the Configuration to the Configurable class.

Specified by:
configure in interface Configurable
Overrides:
configure in class StandardModel
Throws:
ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

getInputStreamFromPath

private java.io.InputStream getInputStreamFromPath(java.lang.String name,
                                                   java.io.InputStream is)

getWorkflowInputStream

private java.io.InputStream getWorkflowInputStream(java.lang.String name)

addToConfiguration

private void addToConfiguration(java.io.InputStream is,
                                Configuration configuration,
                                java.lang.String processName)
                         throws ConfigurationException
Parameters:
is -
configuration -
Throws:
ConfigurationException

getModelName

protected java.lang.String getModelName(ModelRequest request)
                                 throws ModelException
Throws:
ModelException

getMemory

private RedMemory getMemory(RedEngine engine)
                     throws ModelException
Throws:
ModelException

getEngine

private RedEngine getEngine()
Returns:

getNextSequence

protected Configuration getNextSequence(ModelRequest request,
                                        boolean advance)
                                 throws ModelException
Throws:
ModelException

setParameters

private void setParameters(RedMemory memory,
                           ModelRequest request)
Parameters:
memory -
request -

rollBackWorkflow

private void rollBackWorkflow(ModelRequest request,
                              int numToRollBack)
                       throws ModelException
Parameters:
request -
Returns:
Throws:
ModelException

wasBackOrRefresh

private int wasBackOrRefresh(ModelRequest request)
Parameters:
request -

storeBackRefreshIndex

private void storeBackRefreshIndex(ModelRequest request)
                            throws ModelException
Throws:
ModelException

addBackRefreshInfo

private void addBackRefreshInfo(ModelRequest request,
                                ModelResponse response)
                         throws ModelException
Parameters:
response -
Throws:
ModelException

execute

public ModelResponse execute(ModelRequest request)
                      throws ModelException
Throws:
ModelException

executeWorkflow

private ModelResponse executeWorkflow(ModelRequest request)
                               throws ModelException
Throws:
ModelException

addToMemoryHistory

private void addToMemoryHistory(ModelRequest request)
                         throws ModelException
Parameters:
request -
Throws:
ModelException

checkIfInput

private boolean checkIfInput(ModelResponse response)
Parameters:
response -
Returns:

isFirstModel

private boolean isFirstModel()
                      throws ModelException
Returns:
Throws:
ModelException

removeMemory

private void removeMemory()
                   throws ModelException
Throws:
ModelException

getConfig

protected Configuration getConfig()
                           throws ModelException
Throws:
ModelException

putInContext

private void putInContext(ModelRequest request,
                          java.lang.Object key,
                          java.lang.Object value)
                   throws ModelException
Store a key/value pair in the workflow context

Parameters:
request - The request has the request context, which store the workflow context
key - The key to use to store value in workflow context
value - The value to store in the workflow context
Throws:
ModelException

getFromContext

private java.lang.Object getFromContext(ModelRequest request,
                                        java.lang.Object key)
                                 throws ModelException
Get a parameter from thje workflow context

Parameters:
request - The request has the request context, which store the workflow context
key - The key to lookup in the workflow context
Returns:
Throws:
ModelException

getContext

private java.util.Map getContext(ModelRequest request)
                          throws ModelException
This function returns the workflow context for this workflow. Not to be confused with the Keel request context,m which is actually used as a container for the workflow context. Each workflow gets it's own workflow context within the request context, identified by the workflow-id

Parameters:
request - The request has the request context, which store the workflow context
Throws:
ModelException

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.