dk.netarkivet.common.utils.batch
Class LoadableFileBatchJob

java.lang.Object
  extended by dk.netarkivet.common.utils.batch.FileBatchJob
      extended by dk.netarkivet.common.utils.batch.LoadableFileBatchJob
All Implemented Interfaces:
java.io.Serializable

public class LoadableFileBatchJob
extends FileBatchJob

This implementation of FileBatchJob is a bridge to a class file given as a File object. The given class will be loaded and used to perform the actions of the FileBatchJob class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class dk.netarkivet.common.utils.batch.FileBatchJob
FileBatchJob.ExceptionOccurrence
 
Field Summary
(package private)  byte[] fileContents
          The binary contents of the file before they are turned into a class.
(package private)  java.lang.String fileName
          The name of the file before they are turned into a class.
(package private)  FileBatchJob loadedJob
          The job loaded from file.
(package private)  org.apache.commons.logging.Log log
          The class logger.
 
Fields inherited from class dk.netarkivet.common.utils.batch.FileBatchJob
batchJobTimeout, exceptions, filesFailed, noOfFilesProcessed
 
Constructor Summary
LoadableFileBatchJob(java.io.File classFile)
          Create a new batch job that runs the loaded class.
 
Method Summary
 void finish(java.io.OutputStream os)
          Finish up the job.
 void initialize(java.io.OutputStream os)
          Initialize the job before runnning.
 boolean processFile(java.io.File file, java.io.OutputStream os)
          Process one file stored in the bit archive.
 java.lang.String toString()
          Override of the default toString to include name of loaded class.
 
Methods inherited from class dk.netarkivet.common.utils.batch.FileBatchJob
addException, addFinishException, addInitializeException, getBatchJobTimeout, getExceptions, getFilenamePattern, getFilesFailed, getNoOfFilesProcessed, maxExceptionsReached, processOnlyFileNamed, processOnlyFilesMatching, processOnlyFilesMatching, processOnlyFilesNamed, setBatchJobTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

transient org.apache.commons.logging.Log log
The class logger.


loadedJob

transient FileBatchJob loadedJob
The job loaded from file.


fileContents

byte[] fileContents
The binary contents of the file before they are turned into a class.


fileName

java.lang.String fileName
The name of the file before they are turned into a class.

Constructor Detail

LoadableFileBatchJob

public LoadableFileBatchJob(java.io.File classFile)
Create a new batch job that runs the loaded class.

Parameters:
classFile - the classfile for the batch job we want to run.
Method Detail

toString

public java.lang.String toString()
Override of the default toString to include name of loaded class.

Overrides:
toString in class java.lang.Object
Returns:
string representation of this class.

initialize

public void initialize(java.io.OutputStream os)
Initialize the job before runnning. This is called before the processFile() calls.

Specified by:
initialize in class FileBatchJob
Parameters:
os - the OutputStream to which output should be written

processFile

public boolean processFile(java.io.File file,
                           java.io.OutputStream os)
Process one file stored in the bit archive.

Specified by:
processFile in class FileBatchJob
Parameters:
file - the file to be processed.
os - the OutputStream to which output should be written
Returns:
true if the file was successfully processed, false otherwise

finish

public void finish(java.io.OutputStream os)
Finish up the job. This is called after the last process() call.

Specified by:
finish in class FileBatchJob
Parameters:
os - the OutputStream to which output should be written