Class ArchiveJob

All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, ArooaSessionAware, PropertyChangeNotifier, Iconic, LogEnabled, Resettable, Stateful, Stoppable, Structural

public class ArchiveJob extends BasePrimary implements Runnable, Serializable, Stoppable, Resettable, Stateful, Structural
Author:
rob
See Also:

Description

A Job that is capable of taking a snapshot of the state of it's child jobs. An ArchiveBrowserJob can be used to browse an archive created with this job.

Example

Create an archive after each scheduled run. The time of the schedule is used to identify the archive.

<oddjob id="this">

    <job>

        <sequential>

            <jobs>

                <scheduling:timer id="the-timer" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling">

                    <clock>

                      <value value="${clock}"/>

                    </clock>

                    <schedule>

                        <schedules:count count="3" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">

                        	<refinement>

                        		<schedules:interval interval="00:00:00.100"/>

                        	</refinement>

                        </schedules:count>

                    </schedule>

                    <job>

                    	<archive archiveName="Batch_01">

                    		<archiver>

                    			<file-persister dir="${this.args[0]}"/>

                    		</archiver>

                    	    <archiveIdentifier>

                    	    	<format date="${the-timer.current.fromDate}" format="mm_ss_SSS"/>

                    	    </archiveIdentifier>

                    		<job>

		                        <echo>Run at ${the-timer.current.fromDate}</echo>

                        	</job>

                        </archive>

                    </job>

                </scheduling:timer>

            </jobs>

        </sequential>

    </job>

</oddjob>
  • Field Details

    • stop

      protected transient volatile boolean stop
      Stop flag.
  • Constructor Details

    • ArchiveJob

      public ArchiveJob()
      Constructor.
  • Method Details

    • stateHandler

      protected ParentStateHandler stateHandler()
      Description copied from class: BaseComponent
      Subclasses must provide a StateHandler.
      Specified by:
      stateHandler in class BaseComponent
      Returns:
      A State Handler. Never null.
    • iconHelper

      protected IconHelper iconHelper()
      Description copied from class: BaseComponent
      Subclasses must provide a IconHelper.
      Specified by:
      iconHelper in class BaseComponent
      Returns:
      An Icon Helper. Never null.
    • getStateChanger

      protected StateChanger<ParentState> getStateChanger()
    • run

      public final void run()
      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 Runnable
    • execute

      protected void execute() throws Throwable
      Throws:
      Throwable
    • stop

      public void stop() throws FailedToStopException
      Implementation for a typical stop.

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

      Specified by:
      stop in interface Stoppable
      Throws:
      FailedToStopException
    • softReset

      public boolean softReset()
      Perform a soft reset on the job.
      Specified by:
      softReset in interface Resettable
      Returns:
      true if successful.
    • hardReset

      public boolean hardReset()
      Perform a hard reset on the job.
      Specified by:
      hardReset in interface Resettable
      Returns:
      true if successful.
    • getArchiveIdentifier

      public Object getArchiveIdentifier()
    • setArchiveIdentifier

      public void setArchiveIdentifier(Object archive)
    • getArchiveName

      public String getArchiveName()
    • setArchiveName

      public void setArchiveName(String path)
    • getArchiver

      public OddjobPersister getArchiver()
    • setArchiver

      public void setArchiver(OddjobPersister archiver)
    • addStructuralListener

      public void addStructuralListener(StructuralListener listener)
      Add a listener. The listener will immediately receive 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 listener.
    • setJob

      public void setJob(Runnable job)
      Parameters:
      job -
      Reference Property:
      job

      Description

      The child job.
      Required:
      No, but pointless if missing.
    • onDestroy

      protected void onDestroy()
      Description copied from class: BaseComponent
      Subclasses override this method to clear up resources. This is called by the framework before child elements have been destroyed.
      Overrides:
      onDestroy in class BaseComponent
    • fireDestroyedState

      protected void fireDestroyedState()
      Internal method to fire state.
      Specified by:
      fireDestroyedState in class BaseComponent