public class FilePersister extends PersisterBase
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.
<oddjob id="this">
<job>
<oddjob id="important-jobs" file="${this.dir}/FilePersisterExampleInner.xml">
<persister>
<file-persister dir="${this.args[0]}"/>
</persister>
</oddjob>
</job>
</oddjob>
| Constructor and Description |
|---|
FilePersister() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clear(Path path)
Remove a possibly previously persisted object.
|
java.io.File |
getDir()
Get the directory, files are being persisted in.
|
protected java.lang.String[] |
list(Path path) |
protected void |
persist(Path path,
java.lang.String id,
java.lang.Object o)
Provided by subclasses to do the persisting.
|
protected void |
remove(Path path,
java.lang.String id)
Remove a possibly previously persisted object.
|
protected java.lang.Object |
restore(Path path,
java.lang.String id,
java.lang.ClassLoader classLoader)
Restore a previously persisted Component or it's Proxy.
|
void |
setDir(java.io.File dir)
Set the directory to save files in.
|
java.lang.String |
toString() |
persisterFor, setPathpublic void setDir(java.io.File dir)
dir - The directory.public java.io.File getDir()
protected void persist(Path path, java.lang.String id, java.lang.Object o) throws ComponentPersistException
PersisterBasepersist in class PersisterBasepath - The path as a string. Never null.id - The id. Never Null.o - The component or it's proxy.ComponentPersistExceptionprotected void remove(Path path, java.lang.String id) throws ComponentPersistException
PersisterBaseremove in class PersisterBasepath - The path.id - The id.ComponentPersistExceptionprotected java.lang.Object restore(Path path, java.lang.String id, java.lang.ClassLoader classLoader) throws ComponentPersistException
PersisterBaserestore in class PersisterBasepath - The path. Never Null.id - The id. Never Null.classLoader - The classLoader.ComponentPersistExceptionprotected java.lang.String[] list(Path path) throws ComponentPersistException
list in class PersisterBaseComponentPersistExceptionprotected void clear(Path path)
PersisterBaseclear in class PersisterBasepath - The path.public java.lang.String toString()
toString in class java.lang.Object