|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gridsystems.nextgrid.api.pom.PemHelper
com.gridsystems.nextgrid.api.pom.ProcessImpl
public abstract class ProcessImpl
Base implementation for Processes.
To enact a process, the programmer should invoke the following operation:
EnactorContext context = ...; Process p = ...; try { p.enact(context); } catch (Exception e) { ... }
Nested Class Summary | |
---|---|
protected static class |
ProcessImpl.ValidationType
Validation types. |
Field Summary | |
---|---|
static int |
DFA_INITIAL_STATE
Initial state of the internal DFA. |
protected static org.apache.commons.logging.Log |
ENACTOR_LOG
Enaction logger. |
Constructor Summary | |
---|---|
protected |
ProcessImpl()
Creates a new instance with a default empty model. |
Method Summary | |
---|---|
protected void |
attachListeners(nextgrid.api.env.ProcessEnvironment env)
Attaches listeners configured in the environment to this process. |
nextgrid.api.pom.Process |
copy()
|
abstract void |
doEvaluate(nextgrid.api.env.ProcessEnvironment env)
Performs the actual actions needed for evaluating this process instance. |
protected abstract void |
doReset()
Performs specific reset actions in each subclass. |
protected abstract void |
doValidate(ProcessImpl.ValidationType type)
Performs any validation action needed for the process implementation. |
nextgrid.api.pom.ProcessController |
enact(nextgrid.api.env.ProcessEnvironment env)
|
void |
evaluate(nextgrid.api.env.ProcessEnvironment env)
|
void |
evaluate(nextgrid.api.env.ProcessEnvironment env,
boolean force)
Evaluates this process. |
nextgrid.api.pom.Process |
findRoot()
Searches up through the process hierarchy to find the root process of the workflow this process is defined in. |
java.lang.String |
getAttribute(javax.xml.namespace.QName name)
|
java.lang.String |
getAttribute(java.lang.String name)
|
java.lang.String |
getAttribute(java.lang.String ns,
java.lang.String local)
|
java.util.Map<javax.xml.namespace.QName,java.lang.String> |
getAttributes()
|
java.lang.String |
getDescription()
Gets a human-readable description of this process. |
java.net.URI |
getId()
Gets the id of this process instance. |
nextgrid.api.pom.Reference<?> |
getInput(java.lang.String key)
Gets an input parameter by its name. |
java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> |
getInputs()
Gets the map of references to input parameters. |
protected void |
getInputs(java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> map)
Gets all inputs of this process, including inherited ones into the specified map. |
java.lang.Class<?> |
getInputType(java.lang.String name)
|
java.lang.String |
getName()
Gets the name of this process. |
nextgrid.api.pom.Reference<?> |
getOutput(java.lang.String key)
Gets an output parameter by its name. |
java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> |
getOutputs()
Gets the map of references to output parameters. |
protected void |
getOutputs(java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> map)
Gets all outputs of this process, including inherited ones into the specified map. |
java.lang.Class<?> |
getOutputType(java.lang.String name)
|
nextgrid.api.pom.Process |
getParent()
Gets the parent process, or null if there is no parent. |
int |
getState()
Gets the internal DFA state of this process. |
java.lang.String[] |
getUsedInputNames()
|
java.lang.String[] |
getUsedOutputNames()
|
void |
invalidate()
|
boolean |
isEvaluated()
|
boolean |
isLazy()
|
boolean |
isValidated()
|
protected java.util.PriorityQueue<nextgrid.api.pom.Process> |
prioritise(nextgrid.api.env.ProcessEnvironment env)
Shortcut for the interface method prioritise. |
void |
putInput(java.lang.String key,
nextgrid.api.pom.Reference<?> input)
Puts a reference into the map of input parameters for this process. |
void |
putOutput(java.lang.String key,
nextgrid.api.pom.Reference<?> output)
Puts a reference into the map of output parameters for this process. |
void |
removeInput(java.lang.String key)
Removes a reference from the input map. |
void |
removeOutput(java.lang.String key)
Removes a reference from the output map. |
void |
reset()
|
protected abstract void |
resetChildren()
Resets any child process. |
void |
setAttribute(javax.xml.namespace.QName name,
java.lang.String value)
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
|
void |
setDescription(java.lang.String description)
Sets the description of this process. |
protected void |
setEvaluated(boolean evaluated)
Sets the evaluation flag value. |
void |
setId(java.net.URI id)
Sets the id of this process instance. |
void |
setLazy(boolean lazy)
|
void |
setName(java.lang.String name)
Sets this process name. |
void |
setParent(nextgrid.api.pom.Process parent)
Sets the parent process instance. |
protected void |
setState(int state)
Sets the internal DFA state of this process. |
void |
unuseInput(java.lang.String... names)
|
void |
unuseOutput(java.lang.String... names)
|
void |
useInput(java.lang.String name,
java.lang.Class<?> type)
|
void |
useOutput(java.lang.String name,
java.lang.Class<?> type)
|
void |
validate()
|
protected void |
waitForInputs()
Waits until all input parameters are available for reading. |
Methods inherited from class com.gridsystems.nextgrid.api.pom.PemHelper |
---|
addListener, fireDiscovererSelected, fireDiscoveryFailed, fireDiscoveryFinished, fireDiscoveryStarting, fireEvent, fireProcessEvaluated, fireProcessFailed, fireProcessFailed, fireProcessFinished, fireProcessFinished, fireProcessSelected, fireProcessStarted, removeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.gridsystems.nextgrid.api.pom.Enactable |
---|
run |
Methods inherited from interface nextgrid.api.pom.Process |
---|
discover, findProcessById, prioritise |
Field Detail |
---|
protected static final org.apache.commons.logging.Log ENACTOR_LOG
public static final int DFA_INITIAL_STATE
Constructor Detail |
---|
protected ProcessImpl()
Method Detail |
---|
public final java.util.Map<javax.xml.namespace.QName,java.lang.String> getAttributes()
getAttributes
in interface nextgrid.api.pom.Process
public final java.lang.String getAttribute(javax.xml.namespace.QName name)
getAttribute
in interface nextgrid.api.pom.Process
public final java.lang.String getAttribute(java.lang.String name)
getAttribute
in interface nextgrid.api.pom.Process
public final java.lang.String getAttribute(java.lang.String ns, java.lang.String local)
getAttribute
in interface nextgrid.api.pom.Process
public final void setAttribute(javax.xml.namespace.QName name, java.lang.String value)
setAttribute
in interface nextgrid.api.pom.Process
public final void setAttribute(java.lang.String name, java.lang.String value)
setAttribute
in interface nextgrid.api.pom.Process
public final java.net.URI getId()
getId
in interface Enactable
getId
in interface nextgrid.api.pom.Process
public final java.lang.String getName()
getName
in interface nextgrid.api.pom.Process
public final java.lang.String getDescription()
getDescription
in interface nextgrid.api.pom.Process
public final nextgrid.api.pom.Process getParent()
getParent
in interface nextgrid.api.pom.Process
public final int getState()
protected final void setState(int state)
state
- The internal DFA statepublic final nextgrid.api.pom.Process findRoot()
findRoot
in interface nextgrid.api.pom.Process
public final void setId(java.net.URI id)
setId
in interface nextgrid.api.pom.Process
id
- A unique identifier
java.lang.NullPointerException
- If id is nullpublic final void setName(java.lang.String name)
setName
in interface nextgrid.api.pom.Process
name
- The process namepublic final void setDescription(java.lang.String description)
setDescription
in interface nextgrid.api.pom.Process
description
- A textual descriptionpublic final void setParent(nextgrid.api.pom.Process parent)
setParent
in interface nextgrid.api.pom.Process
parent
- The parent processpublic final void validate() throws nextgrid.api.pom.ProcessException
validate
in interface nextgrid.api.pom.Process
nextgrid.api.pom.ProcessException
public final void invalidate()
invalidate
in interface nextgrid.api.pom.Process
public final boolean isLazy()
isLazy
in interface nextgrid.api.pom.Process
public final void setLazy(boolean lazy)
setLazy
in interface nextgrid.api.pom.Process
public final boolean isValidated()
isValidated
in interface nextgrid.api.pom.Process
public final boolean isEvaluated()
isEvaluated
in interface nextgrid.api.pom.Process
protected final void setEvaluated(boolean evaluated)
evaluated
- The new valueprotected final java.util.PriorityQueue<nextgrid.api.pom.Process> prioritise(nextgrid.api.env.ProcessEnvironment env) throws nextgrid.api.pom.ProcessException
env
- The process environment to use
nextgrid.api.pom.ProcessException
- If an error occursprotected abstract void doValidate(ProcessImpl.ValidationType type) throws nextgrid.api.pom.ProcessException
type
- Specifies when this validation is being invoked
nextgrid.api.pom.ProcessException
- If the validation failspublic final void evaluate(nextgrid.api.env.ProcessEnvironment env) throws nextgrid.api.pom.ProcessException
evaluate
in interface nextgrid.api.pom.Process
nextgrid.api.pom.ProcessException
public final void evaluate(nextgrid.api.env.ProcessEnvironment env, boolean force) throws nextgrid.api.pom.ProcessException
env
- The environment to useforce
- Whether to force the evaluation or not
nextgrid.api.pom.ProcessException
- If an error occurspublic abstract void doEvaluate(nextgrid.api.env.ProcessEnvironment env) throws nextgrid.api.pom.ProcessException
env
- The process environment
nextgrid.api.pom.ProcessException
- If an error occurspublic final nextgrid.api.pom.ProcessController enact(nextgrid.api.env.ProcessEnvironment env) throws nextgrid.api.pom.ProcessException
enact
in interface nextgrid.api.pom.Process
nextgrid.api.pom.ProcessException
protected abstract void doReset()
protected abstract void resetChildren()
public final void reset()
reset
in interface nextgrid.api.pom.Process
protected final void attachListeners(nextgrid.api.env.ProcessEnvironment env)
env
- The environmentpublic final java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> getInputs()
getInputs
in interface nextgrid.api.pom.Process
protected final void getInputs(java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> map)
map
- The map to fillpublic final java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> getOutputs()
getOutputs
in interface nextgrid.api.pom.Process
protected final void getOutputs(java.util.Map<java.lang.String,nextgrid.api.pom.Reference<?>> map)
map
- The map to fillpublic final nextgrid.api.pom.Reference<?> getInput(java.lang.String key)
Parameters are inheritable, so if a local parameter is not found, the search will be continued on the parent process.
getInput
in interface nextgrid.api.pom.Process
key
- The parameter name
public final nextgrid.api.pom.Reference<?> getOutput(java.lang.String key)
Parameters are inheritable, so if a local parameter is not found, the search will be continued on the parent process.
getOutput
in interface nextgrid.api.pom.Process
key
- The parameter name
public final void putInput(java.lang.String key, nextgrid.api.pom.Reference<?> input)
putInput
in interface nextgrid.api.pom.Process
key
- The parameter nameinput
- The parameterpublic final void putOutput(java.lang.String key, nextgrid.api.pom.Reference<?> output)
putOutput
in interface nextgrid.api.pom.Process
key
- The parameter nameoutput
- The parameterpublic final void removeInput(java.lang.String key)
removeInput
in interface nextgrid.api.pom.Process
key
- The name of the reference to removepublic final void removeOutput(java.lang.String key)
removeOutput
in interface nextgrid.api.pom.Process
key
- The name of the reference to removepublic final void useInput(java.lang.String name, java.lang.Class<?> type)
useInput
in interface nextgrid.api.pom.Process
public final void useOutput(java.lang.String name, java.lang.Class<?> type)
useOutput
in interface nextgrid.api.pom.Process
public final void unuseInput(java.lang.String... names)
unuseInput
in interface nextgrid.api.pom.Process
public final void unuseOutput(java.lang.String... names)
unuseOutput
in interface nextgrid.api.pom.Process
public final java.lang.String[] getUsedInputNames()
getUsedInputNames
in interface nextgrid.api.pom.Process
public final java.lang.String[] getUsedOutputNames()
getUsedOutputNames
in interface nextgrid.api.pom.Process
public final java.lang.Class<?> getInputType(java.lang.String name)
getInputType
in interface nextgrid.api.pom.Process
public final java.lang.Class<?> getOutputType(java.lang.String name)
getOutputType
in interface nextgrid.api.pom.Process
protected void waitForInputs() throws java.lang.InterruptedException
java.lang.InterruptedException
- If the thread is interruptedpublic nextgrid.api.pom.Process copy()
copy
in interface nextgrid.api.pom.Process
copy
in class PemHelper
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |