Package org.oddjob.jobs.tasks
Class TaskExecutionService
java.lang.Object
org.oddjob.framework.extend.BaseComponent
org.oddjob.framework.extend.SimpleService
org.oddjob.jobs.tasks.TaskExecutionService
- All Implemented Interfaces:
Runnable,ArooaContextAware,ArooaSessionAware,PropertyChangeNotifier,Iconic,TaskExecutor,LogEnabled,Resettable,Stateful,Stoppable,Structural
- Author:
- Rob Gordon
Description
Provide a very simple task execution service.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.
Example
A Task Service that greets people by name. ThreeTaskRequests 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>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChildHelper<Object> Track changes to children an notify listeners. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStructuralListener(StructuralListener listener) Add a listener.Execute a task.Provide the Parameter meta info for the task.getRequests(int index) getReset()protected voidonStart()protected voidonStop()Allow sub classes to do something on stop.voidremoveStructuralListener(StructuralListener listener) Remove a listener.voidsetArooaSession(ArooaSession session) Here for the tests...voidvoidsetRequests(int index, InputRequest request) voidsetReset(ResetAction resetAction) voidsetResponse(String responseExpression) Methods inherited from class org.oddjob.framework.extend.SimpleService
fireDestroyedState, getName, getStateChanger, hardReset, iconHelper, logger, loggerName, onDestroy, run, setName, softReset, stateHandler, stop, toStringMethods inherited from class org.oddjob.framework.extend.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, save, setArooaContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
-
Field Details
-
childHelper
Track changes to children an notify listeners.
-
-
Constructor Details
-
TaskExecutionService
public TaskExecutionService()
-
-
Method Details
-
setArooaSession
Description copied from class:BaseComponentHere for the tests...- Specified by:
setArooaSessionin interfaceArooaSessionAware- Overrides:
setArooaSessionin classBaseComponent- Parameters:
session-
-
getRequests
-
setRequests
-
getParameterInfo
Description copied from interface:TaskExecutorProvide the Parameter meta info for the task.- Specified by:
getParameterInfoin interfaceTaskExecutor- Returns:
-
execute
Description copied from interface:TaskExecutorExecute a task.- Specified by:
executein interfaceTaskExecutor- Parameters:
task-- Returns:
- Throws:
TaskException
-
onStart
- Specified by:
onStartin classSimpleService- Throws:
Throwable
-
onStop
Description copied from class:SimpleServiceAllow sub classes to do something on stop.- Overrides:
onStopin classSimpleService- Throws:
FailedToStopException
-
addStructuralListener
Add a listener. The listener will immediately receive add notifications for all existing children.- Specified by:
addStructuralListenerin interfaceStructural- Parameters:
listener- The listener.
-
removeStructuralListener
Remove a listener.- Specified by:
removeStructuralListenerin interfaceStructural- Parameters:
listener- The listener.
-
setJob
- Reference Property:
- job
- Required:
- Yes.
Description
The job to pass resets on to. -
getReset
-
setReset
-
getProperties
-
getResponse
-
setResponse
-