org.oddjob.framework
Class StructuralJob

java.lang.Object
  extended byorg.oddjob.framework.BaseComponent
      extended byorg.oddjob.framework.BasePrimary
          extended byorg.oddjob.framework.StructuralJob
All Implemented Interfaces:
Iconic, Resetable, java.lang.Runnable, Stateful, Structural
Direct Known Subclasses:
ForEachJob, Oddjob, ParallelJob, RepeatJob, SequentialJob

public abstract class StructuralJob
extends BasePrimary
implements java.lang.Runnable, Resetable, Stateful, Structural

An abstract implementation of a job which provides commen functionality to concrete sub classes.

Author:
Rob Gordon

Field Summary
protected  StatefulChildHelper childHelper
          Intended to be used by decendent classes to help implement Structural.
 
Fields inherited from class org.oddjob.framework.BasePrimary
stop
 
Fields inherited from class org.oddjob.framework.BaseComponent
changes, destroyed, iconHelper, location, lock, stateHandler
 
Constructor Summary
StructuralJob()
           
 
Method Summary
 void addStructuralListener(StructuralListener listener)
          Add a listener.
protected abstract  void execute()
          Execute this job.
 void hardReset()
          Perform a hard reset on the job.
protected  boolean independant()
           
 void onDestroy()
          Destroy this component.
 void removeStructuralListener(StructuralListener listener)
          Remove a listener.
 void run()
          Implement the main execute method for a job.
 void softReset()
          Perform a soft reset on the job.
 void stop()
          Implementation for a typical stop.
 
Methods inherited from class org.oddjob.framework.BasePrimary
configurationComplete, getLogger, getName, logger, setContext, setJobStateReady, setLogger, setName, sleep, toString
 
Methods inherited from class org.oddjob.framework.BaseComponent
addIconListener, addJobStateListener, addPropertyChangeListener, arooaRuntime, arooaRuntime, canHardReset, canSoftReset, configure, destroy, getLocation, iconForId, lastJobStateEvent, removeIconListener, removeJobStateListener, removePropertyChangeListener, setJobStateComplete, setJobStateException, setJobStateNotComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.oddjob.Stateful
addJobStateListener, removeJobStateListener
 

Field Detail

childHelper

protected StatefulChildHelper childHelper
Intended to be used by decendent classes to help implement Structural.

Constructor Detail

StructuralJob

public StructuralJob()
Method Detail

independant

protected boolean independant()
Overrides:
independant in class BasePrimary

execute

protected abstract void execute()
                         throws java.lang.Throwable
Execute this job.

Throws:
java.lang.Exception - If the unexpected occurs.
java.lang.Throwable

run

public final void run()
               throws OddjobLockedException
Implement the main execute method for a job. This surrounds the doExecute method of the sub class and sets state for the job.

Specified by:
run in interface java.lang.Runnable
Throws:
OddjobLockedException

stop

public void stop()
Implementation for a typical stop. Subclasses must implement Stoppable to take advantage of it.

This stop implementation doesn't check that the job is executing as stop messages must cascade down the hierarchy to manually started jobs.


softReset

public void softReset()
Perform a soft reset on the job.

Specified by:
softReset in interface Resetable

hardReset

public void hardReset()
Perform a hard reset on the job.

Specified by:
hardReset in interface Resetable

addStructuralListener

public void addStructuralListener(StructuralListener listener)
Add a listener. The listener will immediately recieve add notifications for all existing children.

Specified by:
addStructuralListener in interface Structural
Parameters:
listener - The listener.

removeStructuralListener

public void removeStructuralListener(StructuralListener listener)
Remove a listener.

Specified by:
removeStructuralListener in interface Structural
Parameters:
listener - The listner.

onDestroy

public void onDestroy()
Destroy this component.

Overrides:
onDestroy in class BaseComponent