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, setPath
public 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
PersisterBase
persist
in class PersisterBase
path
- The path as a string. Never null.id
- The id. Never Null.o
- The component or it's proxy.ComponentPersistException
protected void remove(Path path, java.lang.String id) throws ComponentPersistException
PersisterBase
remove
in class PersisterBase
path
- The path.id
- The id.ComponentPersistException
protected java.lang.Object restore(Path path, java.lang.String id, java.lang.ClassLoader classLoader) throws ComponentPersistException
PersisterBase
restore
in class PersisterBase
path
- The path. Never Null.id
- The id. Never Null.classLoader
- The classLoader.ComponentPersistException
protected java.lang.String[] list(Path path) throws ComponentPersistException
list
in class PersisterBase
ComponentPersistException
protected void clear(Path path)
PersisterBase
clear
in class PersisterBase
path
- The path.public java.lang.String toString()
toString
in class java.lang.Object