Package org.oddjob.persist
Class ArchiveJob
java.lang.Object
org.oddjob.framework.extend.BaseComponent
org.oddjob.framework.extend.BasePrimary
org.oddjob.persist.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. AnArchiveBrowserJob
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStructuralListener(StructuralListener listener) Add a listener.protected voidexecute()protected voidInternal method to fire state.protected StateChanger<ParentState> booleanPerform a hard reset on the job.protected IconHelperSubclasses must provide aIconHelper.protected voidSubclasses override this method to clear up resources.voidremoveStructuralListener(StructuralListener listener) Remove a listener.final voidrun()Implement the main execute method for a job.voidsetArchiveIdentifier(Object archive) voidsetArchiveName(String path) voidsetArchiver(OddjobPersister archiver) voidbooleanPerform a soft reset on the job.protected ParentStateHandlerSubclasses must provide aStateHandler.voidstop()Implementation for a typical stop.Methods inherited from class org.oddjob.framework.extend.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toStringMethods inherited from class org.oddjob.framework.extend.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSessionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
-
Field Details
-
stop
protected transient volatile boolean stopStop flag.
-
-
Constructor Details
-
ArchiveJob
public ArchiveJob()Constructor.
-
-
Method Details
-
stateHandler
Description copied from class:BaseComponentSubclasses must provide aStateHandler.- Specified by:
stateHandlerin classBaseComponent- Returns:
- A State Handler. Never null.
-
iconHelper
Description copied from class:BaseComponentSubclasses must provide aIconHelper.- Specified by:
iconHelperin classBaseComponent- Returns:
- An Icon Helper. Never null.
-
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. -
execute
- Throws:
Throwable
-
stop
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:
stopin interfaceStoppable- Throws:
FailedToStopException
-
softReset
public boolean softReset()Perform a soft reset on the job.- Specified by:
softResetin interfaceResettable- Returns:
- true if successful.
-
hardReset
public boolean hardReset()Perform a hard reset on the job.- Specified by:
hardResetin interfaceResettable- Returns:
- true if successful.
-
getArchiveIdentifier
-
setArchiveIdentifier
-
getArchiveName
-
setArchiveName
-
getArchiver
-
setArchiver
-
addStructuralListener
Add a listener. The listener will immediately receive add notifications for all existing children.- Specified by:
addStructuralListenerin interfaceStructural- Parameters:
listener- The listener.
-
removeStructuralListener
Remove a listener.- Specified by:
removeStructuralListenerin interfaceStructural- Parameters:
listener- The listener.
-
setJob
- Parameters:
job-- Reference Property:
- job
- Required:
- No, but pointless if missing.
Description
The child job. -
onDestroy
protected void onDestroy()Description copied from class:BaseComponentSubclasses override this method to clear up resources. This is called by the framework before child elements have been destroyed.- Overrides:
onDestroyin classBaseComponent
-
fireDestroyedState
protected void fireDestroyedState()Internal method to fire state.- Specified by:
fireDestroyedStatein classBaseComponent
-