org.oddjob.jobs.job
Class ResetJob

java.lang.Object
  extended by org.oddjob.framework.BaseComponent
      extended by org.oddjob.framework.BasePrimary
          extended by org.oddjob.framework.SimpleJob
              extended by org.oddjob.jobs.job.ResetJob
All Implemented Interfaces:
Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resetable, Stateful

public class ResetJob
extends SimpleJob

Description

A job which resets another job. This job is useful to reset jobs or services that have been persisted, and loaded back in their previous COMPLETE states. The reset can be used to set them back to READY.

A reset might also be needed before running a job elsewhere such as on a remote server.

This job is not Serializable and so won't be persisted itself.

See also the Resets job.

Example

Using reset in explorer.xml.

Look at the explorer.xml file in Oddjob's home directory. This file is loaded by the default oddjob.xml file when Oddjob first runs. The explorer.xml configuration is run with a FilePersister persister that persists the Explorers state when it completes. When Oddjob is run again the Explorer will be loaded with it's previous COMPLETE state and so won't run. The reset is necessary to set it back to READY.

Author:
Rob Gordon

Field Summary
 
Fields inherited from class org.oddjob.framework.SimpleJob
stateHandler, stop
 
Fields inherited from class org.oddjob.framework.BaseComponent
iconHelper
 
Constructor Summary
ResetJob()
           
 
Method Summary
protected  int execute()
          Execute this job.
 Resetable getJob()
          Get the node to stop.
 String getLevel()
           
 void setJob(Resetable node)
          Set the stop node directly.
 void setLevel(String level)
           
 
Methods inherited from class org.oddjob.framework.SimpleJob
fireDestroyedState, force, getStateChanger, hardReset, onDestroy, onReset, onStop, run, sleep, softReset, 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.Stateful
addStateListener, lastStateEvent, removeStateListener
 

Constructor Detail

ResetJob

public ResetJob()
Method Detail

setJob

public void setJob(Resetable node)
Set the stop node directly.

Parameters:
node - The node to stop.

getJob

public Resetable getJob()
Get the node to stop.

Returns:
The node.

execute

protected int execute()
               throws Exception
Description copied from class: SimpleJob
Execute this job.

Specified by:
execute in class SimpleJob
Returns:
0 if the job is complete, anything else otherwise.
Throws:
Exception - If the unexpected occurs.

getLevel

public String getLevel()
Returns:
Returns the level.

setLevel

public void setLevel(String level)
Parameters:
level - The level to set.