public class FileJobStatusStore extends Object implements IJobStatusStore
File-based status store. The created
file name matches the job id, plus the ".job" extension. If no
status directory is explicitly set, it defaults to:
<user.home>/Norconex/jef/workdir
<statusStore class="com.norconex.jef4.status.FileJobStatusStore"> <statusDir>(directory where to store status files)</statusDir> </statusStore>
The following example indicates status files should be stored in this
directory:
/tmp/jefstatuses
<statusStore class="com.norconex.jef4.status.FileJobStatusStore"> <statusDir>/tmp/jefstatuses</statusDir> </statusStore>
Constructor and Description |
---|
FileJobStatusStore() |
FileJobStatusStore(String statusDir)
Creates a file-based job status serializer storing files in the given
job directory.
|
Modifier and Type | Method and Description |
---|---|
void |
backup(String suiteName,
String jobId,
Date backupDate)
Backups job progress.
|
boolean |
equals(Object other) |
String |
getStatusDirectory() |
int |
hashCode() |
void |
loadFromXML(Reader in) |
IJobStatus |
read(String suiteName,
String jobId)
Reads a job progress.
|
void |
remove(String suiteName,
String jobId)
Removes job progress.
|
void |
saveToXML(Writer out) |
void |
setStatusDirectory(String statusDirectory) |
String |
toString() |
long |
touch(String suiteName,
String jobId)
Marks the status with the current date so it shows as being active.
|
void |
write(String suiteName,
IJobStatus jobStatus)
Writes a job progress.
|
public FileJobStatusStore()
public FileJobStatusStore(String statusDir)
statusDir
- the base directory where to serialize the job statuspublic String getStatusDirectory()
public void setStatusDirectory(String statusDirectory)
public final void write(String suiteName, IJobStatus jobStatus) throws IOException
IJobStatusStore
write
in interface IJobStatusStore
suiteName
- name space given to the job progressjobStatus
- job progressIOException
- problem serializing job progresspublic final IJobStatus read(String suiteName, String jobId) throws IOException
IJobStatusStore
null
is not allowed).read
in interface IJobStatusStore
suiteName
- name space given to the job progressjobId
- job unique identifierIOException
- problem deserializing job progresspublic final void remove(String suiteName, String jobId) throws IOException
IJobStatusStore
IJobStatusStore.read(String, String)
method.remove
in interface IJobStatusStore
suiteName
- name space given to the job progressjobId
- unique identifier of job we want to remove statusIOException
- problem removing job progresspublic final void backup(String suiteName, String jobId, Date backupDate) throws IOException
IJobStatusStore
IJobStatusStore.read(String, String)
method.backup
in interface IJobStatusStore
suiteName
- name space given to the job progressjobId
- unique identifier of job progress we want to backupbackupDate
- date used to timestamp to backupIOException
- problem backing-up job progresspublic long touch(String suiteName, String jobId) throws IOException
IJobStatusStore
touch
in interface IJobStatusStore
suiteName
- suite namejobId
- job nameIOException
- problem touching the filepublic void loadFromXML(Reader in) throws IOException
loadFromXML
in interface com.norconex.commons.lang.config.IXMLConfigurable
IOException
public void saveToXML(Writer out) throws IOException
saveToXML
in interface com.norconex.commons.lang.config.IXMLConfigurable
IOException
Copyright © 2007–2021 Norconex Inc.. All rights reserved.