Class FilePersister

java.lang.Object
org.oddjob.persist.PersisterBase
org.oddjob.persist.FilePersister
All Implemented Interfaces:
OddjobPersister

public class FilePersister extends PersisterBase
Author:
Rob Gordon.

Description

Persist and load jobs from and to a file. The file the job is persisted to is the jobs id with a .ser extension.

A new sub directory is created for each nested Oddjob with an id. The job of the nested Oddjob are persisted to the sub directory. Thus the directory structure mirrors the structure of the Oddjobs.

Example

Using a file persister with Oddjob. The persist directory is passed in as an argument from the command line. The state of child jobs will be saved in a child directory relative to the given directory of the name 'important-jobs'.
<oddjob id="this">

    <job>

        <oddjob id="important-jobs" file="${this.dir}/FilePersisterExampleInner.xml">

            <persister>

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

            </persister>

        </oddjob>

    </job>

</oddjob>