Class ResetJob

All Implemented Interfaces:
Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resettable, Stateful

public class ResetJob extends SimpleJob
Author:
Rob Gordon

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.

As of version 1.4 of Oddjob, this job can now also be used to force jobs that are Forceable by specify 'force' as level.

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.Force a job to complete.

<oddjob>

    <job>

        <sequential>

            <jobs>

                <reset job="${echo}" level="force"/>

                <echo id="echo">You will never see this!</echo>

            </jobs>

        </sequential>

    </job>

</oddjob>
  • Constructor Details

    • ResetJob

      public ResetJob()
  • Method Details

    • setJob

      public void setJob(Object node)
      Set the stop node directly.
      Parameters:
      node - The node to stop.
    • getJob

      public Object 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 ResetAction getLevel()
      Returns:
      Returns the level.
    • setLevel

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