org.oddjob.jobs.structural
Class SequentialJob

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.BasePrimary
          extended by org.oddjob.framework.StructuralJob<Object>
              extended by org.oddjob.jobs.structural.SequentialJob
All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful, Stoppable, Structural

public class SequentialJob
extends StructuralJob<Object>
implements Structural, Stoppable

Description

Executes it's children in a sequence. The sequence will only continue to be executed if each child completes. If a child is incomplete, or flags an exception then execution will terminate and this job's state will reflect that of the failed child.

If the failed job is later run manually and completes this Job will reflect the new state. As such it is useful as a trigger point for the completion of a sequence of jobs.

Example

A simple sequence of two jobs.
<oddjob>
    <job>
        <sequential name="A sequence of two jobs">
            <jobs>
                <echo>This runs first.</echo>
                <echo>This runs after.</echo>
            </jobs>
        </sequential>
    </job>
</oddjob>
See Also:
Serialized Form
Author:
Rob Gordon

Field Summary
 
Fields inherited from class org.oddjob.framework.StructuralJob
childHelper, childStateReflector, stateHandler, stop, structuralState
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
SequentialJob()
           
 
Method Summary
 void execute()
          Execute this job.
protected  StateOperator getStateOp()
           
 boolean isIndependent()
           
 void setIndependent(boolean independent)
          Set whether children are considered dependent (false, default) or independent (true).
 void setJobs(int index, Object child)
          Add a child.
 
Methods inherited from class org.oddjob.framework.StructuralJob
addStructuralListener, fireDestroyedState, force, getStateChanger, hardReset, onDestroy, onReset, onStop, removeStructuralListener, run, softReset, startChildStateReflector, stateHandler, stop
 
Methods inherited from class org.oddjob.framework.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toString
 
Methods inherited from class org.oddjob.framework.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Structural
addStructuralListener, removeStructuralListener
 
Methods inherited from interface org.oddjob.Stoppable
stop
 
Methods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Constructor Detail

SequentialJob

public SequentialJob()
Method Detail

getStateOp

protected StateOperator getStateOp()
Specified by:
getStateOp in class StructuralJob<Object>

setJobs

public void setJobs(int index,
                    Object child)
Add a child.

Property: jobs

Description: The child jobs.

Required: No, but pointless if missing.

Parameters:
child - A child

execute

public void execute()
             throws Exception
Description copied from class: StructuralJob
Execute this job.

Specified by:
execute in class StructuralJob<Object>
Throws:
Exception - If the unexpected occurs.

isIndependent

public boolean isIndependent()

setIndependent

public void setIndependent(boolean independent)
Set whether children are considered dependent (false, default) or independent (true).

Property: independent

Description: Whether the child jobs are independent or not.

Required: Default is dependent child jobs.

Parameters:
independent - flag value to set