public class TaskExecutionService extends SimpleService implements TaskExecutor, Structural
The task to be executed is defined by the nested jobs which may use the properties. which will be defined when executing the tasks.
This implementation only supports the single execution of a task at one time. If the task is running additional requests to execute the task will be ignored.
Future version will support multiple parallel executions of tasks.
TaskRequest
s call the
service with different names.
<oddjob> <job> <sequential> <jobs> <task-service id="hello-service"> <requests> <input-text prompt="Name" property="some.name"/> </requests> <job> <echo>Hello ${some.name}.</echo> </job> </task-service> <task-request taskExecutor="${hello-service}"> <properties> <properties> <values> <value key="some.name" value="Rod"/> </values> </properties> </properties> </task-request> <task-request taskExecutor="${hello-service}"> <properties> <properties> <values> <value key="some.name" value="Jane"/> </values> </properties> </properties> </task-request> <task-request taskExecutor="${hello-service}"> <properties> <properties> <values> <value key="some.name" value="Freddy"/> </values> </properties> </properties> </task-request> </jobs> </sequential> </job> </oddjob>
Modifier and Type | Field and Description |
---|---|
protected ChildHelper<java.lang.Object> |
childHelper
Track changes to children an notify listeners.
|
Constructor and Description |
---|
TaskExecutionService() |
Modifier and Type | Method and Description |
---|---|
void |
addStructuralListener(StructuralListener listener)
Add a listener.
|
TaskView |
execute(Task task)
Execute a task.
|
InputRequest[] |
getParameterInfo()
Provide the Parameter meta info for the task.
|
java.util.Properties |
getProperties() |
InputRequest |
getRequests(int index) |
ResetAction |
getReset() |
java.lang.String |
getResponse() |
protected void |
onStart() |
protected void |
onStop()
Allow sub classes to do something on stop.
|
void |
removeStructuralListener(StructuralListener listener)
Remove a listener.
|
void |
setArooaSession(ArooaSession session)
Here for the tests...
|
void |
setJob(java.lang.Object job) |
void |
setRequests(int index,
InputRequest request) |
void |
setReset(ResetAction resetAction) |
void |
setResponse(java.lang.String responseExpression) |
fireDestroyedState, getName, getStateChanger, hardReset, iconHelper, logger, loggerName, onDestroy, run, setName, softReset, stateHandler, stop, toString
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, save, setArooaContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addStateListener, lastStateEvent, removeStateListener
protected final ChildHelper<java.lang.Object> childHelper
public void setArooaSession(ArooaSession session)
BaseComponent
setArooaSession
in interface ArooaSessionAware
setArooaSession
in class BaseComponent
session
- The Arooa Session. Never null.public InputRequest getRequests(int index)
public void setRequests(int index, InputRequest request)
public InputRequest[] getParameterInfo()
TaskExecutor
getParameterInfo
in interface TaskExecutor
public TaskView execute(Task task) throws TaskException
TaskExecutor
execute
in interface TaskExecutor
TaskException
protected void onStart() throws java.lang.Throwable
onStart
in class SimpleService
java.lang.Exception
java.lang.Throwable
protected void onStop() throws FailedToStopException
SimpleService
onStop
in class SimpleService
FailedToStopException
public void addStructuralListener(StructuralListener listener)
addStructuralListener
in interface Structural
listener
- The listener.public void removeStructuralListener(StructuralListener listener)
removeStructuralListener
in interface Structural
listener
- The listener.public void setJob(java.lang.Object job)
Property: job
Description: The job to pass resets on to.
Required: Yes.
public ResetAction getReset()
public void setReset(ResetAction resetAction)
public java.util.Properties getProperties()
public java.lang.String getResponse()
public void setResponse(java.lang.String responseExpression)