org.oddjob.framework
Class SimpleJob

java.lang.Object
  extended byorg.oddjob.framework.BaseComponent
      extended byorg.oddjob.framework.BasePrimary
          extended byorg.oddjob.framework.SimpleJob
All Implemented Interfaces:
Iconic, Resetable, java.lang.Runnable, Stateful
Direct Known Subclasses:
AntJob, ChooseFile, DependsJob, ExecJob, OddjobDesigner, ResetJob, RMIRegistryJob, RunJob, ScheduleJob, ScriptJob, SerializableJob, SetJob, StopJob, UnscheduleJob, VariablesJob, WaitJob

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

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

Author:
Rob Gordon

Field Summary
 
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
SimpleJob()
           
 
Method Summary
protected abstract  int execute()
          Execute this job.
 void hardReset()
          Perform a hard reset on the job.
protected  boolean independant()
           
 void onStop()
           
 void run()
          Implement the main execute method for a job.
 void softReset()
          Perform a soft reset on the job.
 void stop()
          Allow subclasses to indicate they are stopping.
 
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, onDestroy, 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
 

Constructor Detail

SimpleJob

public SimpleJob()
Method Detail

independant

protected boolean independant()
Overrides:
independant in class BasePrimary

execute

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

Returns:
0 if the job is complete, anything else otherwise.
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 final void stop()
Allow subclasses to indicate they are stopping. The subclass must still implement Stoppable.


onStop

public void onStop()

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