com.norconex.jef.progress
Class JobProgressPropertiesFileSerializer

java.lang.Object
  extended by com.norconex.jef.progress.JobProgressPropertiesFileSerializer
All Implemented Interfaces:
IJobProgressSerializer

public class JobProgressPropertiesFileSerializer
extends Object
implements IJobProgressSerializer

Serializer using a file to store job process information. The created file name matches the job id, plus the ".job" extension. The path where to locate the file depends on the constructor invoked.

Author:
Pascal Essiembre

Constructor Summary
JobProgressPropertiesFileSerializer(String jobDir)
          Creates a file-based job progress serializer storing files in the given job directory.
 
Method Summary
 void backup(String namespace, String jobId, Date backupDate)
          Backups job progress.
 JobProgress deserialize(String namespace, String jobId, IJobContext jobContext)
          Deserializes a job progress.
 void remove(String namespace, String jobId)
          Removes job progress.
 void serialize(String namespace, IJobStatus jobProgress)
          Serializes a job progress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobProgressPropertiesFileSerializer

public JobProgressPropertiesFileSerializer(String jobDir)
Creates a file-based job progress serializer storing files in the given job directory.

Parameters:
jobDir - the base directory where to serialize the job progress
Method Detail

serialize

public final void serialize(String namespace,
                            IJobStatus jobProgress)
                     throws IOException
Description copied from interface: IJobProgressSerializer
Serializes a job progress.

Specified by:
serialize in interface IJobProgressSerializer
Parameters:
namespace - name space given to the job progress
jobProgress - job progress
Throws:
IOException - problem serializing job progress

deserialize

public final JobProgress deserialize(String namespace,
                                     String jobId,
                                     IJobContext jobContext)
                              throws IOException
Description copied from interface: IJobProgressSerializer
Deserializes a job progress. Implementors are required to always return a job progress (null is not allowed).

Specified by:
deserialize in interface IJobProgressSerializer
Parameters:
namespace - name space given to the job progress
jobId - job unique identifier
jobContext - job context for which to obtain job progress
Returns:
job progress
Throws:
IOException - problem deserializing job progress

remove

public final void remove(String namespace,
                         String jobId)
                  throws IOException
Description copied from interface: IJobProgressSerializer
Removes job progress. A removed job progress can no longer be obtained using the IJobProgressSerializer.deserialize(String, String, IJobContext) method.

Specified by:
remove in interface IJobProgressSerializer
Parameters:
namespace - name space given to the job progress
jobId - unique identifier of job we want to remove status
Throws:
IOException - problem removing job progress

backup

public final void backup(String namespace,
                         String jobId,
                         Date backupDate)
                  throws IOException
Description copied from interface: IJobProgressSerializer
Backups job progress. A backed-up job progress can no longer be obtained using the IJobProgressSerializer.deserialize(String, String, IJobContext) method.

Specified by:
backup in interface IJobProgressSerializer
Parameters:
namespace - name space given to the job progress
jobId - unique identifier of job progress we want to backup
backupDate - date used to timestamp to backup
Throws:
IOException - problem backing-up job progress


Copyright © 2007-2013 Norconex Inc.. All Rights Reserved.