com.gridsystems.nextgrid.api.pom
Class AbstractProcessImpl

java.lang.Object
  extended by com.gridsystems.nextgrid.api.pom.PemHelper
      extended by com.gridsystems.nextgrid.api.pom.ProcessImpl
          extended by com.gridsystems.nextgrid.api.pom.AbstractProcessImpl
All Implemented Interfaces:
Enactable, java.io.Serializable, java.lang.Cloneable, nextgrid.api.pom.AbstractProcess, nextgrid.api.pom.Process

public final class AbstractProcessImpl
extends ProcessImpl
implements nextgrid.api.pom.AbstractProcess

A process with a semantic description, but no specific implementation binding details.

Such an abstract process must be fulfilled with binding information or "replaced" by a more specific, yet still abstract, process during enaction. This replacement is really implemented through a child containment structure to prevent losing original semantic data: In case of error, the enactor must be able to revert to the original abstract description and repeat the discovery phase to reach an alternative service provider.

The presence of instances of this class within a workflow representation as leaf nodes marks this workflow as abstract, meaning that it will require some extra process before being "executable".

In OWL-WS terms, an AbstractProcessImpl can be mapped to a service that only contains a profile, but no grounding; that is, it only states service constraints, but no capabilities.

Author:
Rodrigo Ruiz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gridsystems.nextgrid.api.pom.ProcessImpl
ProcessImpl.ValidationType
 
Field Summary
 
Fields inherited from class com.gridsystems.nextgrid.api.pom.ProcessImpl
DFA_INITIAL_STATE, ENACTOR_LOG
 
Fields inherited from interface nextgrid.api.pom.AbstractProcess
UNDEFINED_PRIORITY
 
Constructor Summary
AbstractProcessImpl()
          Creates an instance.
AbstractProcessImpl(nextgrid.api.pom.QueryProfile profile)
          Creates a new instance.
 
Method Summary
 nextgrid.api.pom.Process copy()
          
 void discover(nextgrid.api.env.ProcessEnvironment env)
          
 void doEvaluate(nextgrid.api.env.ProcessEnvironment env)
          Performs the actual actions needed for evaluating this process instance.
protected  void doReset()
          Performs specific reset actions in each subclass.
protected  void doValidate(ProcessImpl.ValidationType when)
          Performs any validation action needed for the process implementation.
 nextgrid.api.pom.Process findProcessById(java.net.URI id)
          
 java.util.List<nextgrid.api.pom.Process> getCandidates()
          
 int getPriority()
          Gets the priority (evaluation order) of this process.
 nextgrid.api.pom.QueryProfile getProfile()
          
 nextgrid.api.pom.Process getSelected()
          
 void prioritise(nextgrid.api.env.ProcessEnvironment env, java.util.PriorityQueue<nextgrid.api.pom.Process> queue)
          
protected  void resetChildren()
          Resets any child process.
 void run(ProcessContext ctx)
          Performs the actual enaction of a process.
 void setCandidates(java.util.Collection<nextgrid.api.pom.Process> candidates)
          
 void setPriority(int priority)
          Sets the priority (evaluation order) of this process.
 void setProfile(nextgrid.api.pom.QueryProfile profile)
          
 void setSelected(nextgrid.api.pom.Process selected)
          Sets the selected process.
 java.lang.String toString()
          
 
Methods inherited from class com.gridsystems.nextgrid.api.pom.ProcessImpl
attachListeners, enact, evaluate, evaluate, findRoot, getAttribute, getAttribute, getAttribute, getAttributes, getDescription, getId, getInput, getInputs, getInputs, getInputType, getName, getOutput, getOutputs, getOutputs, getOutputType, getParent, getState, getUsedInputNames, getUsedOutputNames, invalidate, isEvaluated, isLazy, isValidated, prioritise, putInput, putOutput, removeInput, removeOutput, reset, setAttribute, setAttribute, setDescription, setEvaluated, setId, setLazy, setName, setParent, setState, unuseInput, unuseOutput, useInput, useOutput, validate, waitForInputs
 
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, wait, wait, wait
 
Methods inherited from interface nextgrid.api.pom.Process
addListener, enact, evaluate, findRoot, getAttribute, getAttribute, getAttribute, getAttributes, getDescription, getId, getInput, getInputs, getInputType, getName, getOutput, getOutputs, getOutputType, getParent, getUsedInputNames, getUsedOutputNames, invalidate, isEvaluated, isLazy, isValidated, putInput, putOutput, removeInput, removeListener, removeOutput, reset, setAttribute, setAttribute, setDescription, setId, setLazy, setName, setParent, unuseInput, unuseOutput, useInput, useOutput, validate
 

Constructor Detail

AbstractProcessImpl

public AbstractProcessImpl()
Creates an instance.


AbstractProcessImpl

public AbstractProcessImpl(nextgrid.api.pom.QueryProfile profile)
Creates a new instance.

Parameters:
profile - The query profile that defines this process
Method Detail

getCandidates

public java.util.List<nextgrid.api.pom.Process> getCandidates()

Specified by:
getCandidates in interface nextgrid.api.pom.AbstractProcess

setCandidates

public void setCandidates(java.util.Collection<nextgrid.api.pom.Process> candidates)

Specified by:
setCandidates in interface nextgrid.api.pom.AbstractProcess

getSelected

public nextgrid.api.pom.Process getSelected()

Specified by:
getSelected in interface nextgrid.api.pom.AbstractProcess

setSelected

public void setSelected(nextgrid.api.pom.Process selected)
Sets the selected process.

Specified by:
setSelected in interface nextgrid.api.pom.AbstractProcess
Parameters:
selected - The new selected process

getPriority

public int getPriority()
Gets the priority (evaluation order) of this process.

Specified by:
getPriority in interface nextgrid.api.pom.AbstractProcess
Returns:
The priority

setPriority

public void setPriority(int priority)
Sets the priority (evaluation order) of this process.

Specified by:
setPriority in interface nextgrid.api.pom.AbstractProcess
Parameters:
priority - The new priority value

getProfile

public nextgrid.api.pom.QueryProfile getProfile()

Specified by:
getProfile in interface nextgrid.api.pom.AbstractProcess

setProfile

public void setProfile(nextgrid.api.pom.QueryProfile profile)

Specified by:
setProfile in interface nextgrid.api.pom.AbstractProcess

findProcessById

public nextgrid.api.pom.Process findProcessById(java.net.URI id)

Specified by:
findProcessById in interface nextgrid.api.pom.Process

doValidate

protected void doValidate(ProcessImpl.ValidationType when)
                   throws nextgrid.api.pom.ProcessException
Performs any validation action needed for the process implementation.

Specified by:
doValidate in class ProcessImpl
Parameters:
when - Specifies when this validation is being invoked
Throws:
nextgrid.api.pom.ProcessException - If the validation fails

doEvaluate

public void doEvaluate(nextgrid.api.env.ProcessEnvironment env)
                throws nextgrid.api.pom.ProcessException
Performs the actual actions needed for evaluating this process instance.

Specified by:
doEvaluate in class ProcessImpl
Parameters:
env - The process environment
Throws:
nextgrid.api.pom.ProcessException - If an error occurs

prioritise

public void prioritise(nextgrid.api.env.ProcessEnvironment env,
                       java.util.PriorityQueue<nextgrid.api.pom.Process> queue)
                throws nextgrid.api.pom.ProcessException

Specified by:
prioritise in interface nextgrid.api.pom.Process
Throws:
nextgrid.api.pom.ProcessException

discover

public void discover(nextgrid.api.env.ProcessEnvironment env)
              throws nextgrid.api.pom.ProcessException

Specified by:
discover in interface nextgrid.api.pom.Process
Throws:
nextgrid.api.pom.ProcessException

doReset

protected void doReset()
Performs specific reset actions in each subclass.

Specified by:
doReset in class ProcessImpl

resetChildren

protected void resetChildren()
Resets any child process.

Specified by:
resetChildren in class ProcessImpl

run

public void run(ProcessContext ctx)
         throws nextgrid.api.pom.ProcessException,
                java.lang.InterruptedException
Performs the actual enaction of a process.

The instance must take into account possible errors, like service unavailability, or execution errors. As long as there are more "valid" candidates for the process, errors should not be propagated to the parent, and the next candidate should be selected and enacted.

A ProcessException as a result of this call means that this process is unable to correctly finish its execution, and that the parent must do something to fix the problem.

Specified by:
run in interface Enactable
Parameters:
ctx - A process context
Throws:
nextgrid.api.pom.ProcessException - If an unrecoverable local error occurs
java.lang.InterruptedException - If the thread is interrupted

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

copy

public nextgrid.api.pom.Process copy()

Specified by:
copy in interface nextgrid.api.pom.Process
Overrides:
copy in class ProcessImpl


Copyright © 2006-2008 Grid Systems, S.A.. All Rights Reserved.