|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.common.utils.arc.FileBatchJob
public abstract class FileBatchJob
Interface defining a batch job to run on a set of files. The job is initialized by calling initialize(), executed on a file by calling processFile() and any cleanup is handled by finish().
Field Summary | |
---|---|
protected java.util.Set<java.io.File> |
filesFailed
A Set of files which generated errors. |
protected int |
noOfFilesProcessed
The total number of files processed (including any that generated errors). |
Constructor Summary | |
---|---|
FileBatchJob()
|
Method Summary | |
---|---|
abstract void |
finish(java.io.OutputStream os)
Finish up the job. |
java.util.regex.Pattern |
getFilenamePattern()
Get the pattern for files that should be processed. |
java.util.Collection<java.io.File> |
getFilesFailed()
Return the list of names of ARC-files where processing (of one or more ARC records) failed or an empty list if none failed. |
int |
getNoOfFilesProcessed()
Return the number of ARC-files processed in this job (at this bit archive application). |
abstract void |
initialize(java.io.OutputStream os)
Initialize the job before runnning. |
abstract boolean |
processFile(java.io.File file,
java.io.OutputStream os)
Process one file stored in the bit archive. |
void |
processOnlyFileNamed(java.lang.String specifiedFilename)
Helper method for only processing one file. |
void |
processOnlyFilesMatching(java.util.List<java.lang.String> specifiedPatterns)
Set this job to match only a certain set of patterns. |
void |
processOnlyFilesMatching(java.lang.String specifiedPattern)
Set this job to match only a certain pattern. |
void |
processOnlyFilesNamed(java.util.List<java.lang.String> specifiedFilenames)
Mark the job to process only the specified files. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int noOfFilesProcessed
protected java.util.Set<java.io.File> filesFailed
Constructor Detail |
---|
public FileBatchJob()
Method Detail |
---|
public abstract void initialize(java.io.OutputStream os)
os
- the OutputStream to which output should be writtenpublic abstract boolean processFile(java.io.File file, java.io.OutputStream os)
file
- the file to be processed.os
- the OutputStream to which output should be written
public abstract void finish(java.io.OutputStream os)
os
- the OutputStream to which output should be writtenpublic void processOnlyFilesNamed(java.util.List<java.lang.String> specifiedFilenames)
specifiedFilenames
- A list of filenamess to process (without
paths). If null, all files will be processed.public void processOnlyFileNamed(java.lang.String specifiedFilename)
specifiedFilename
- The name of the single file that should
be processed. Should not include any path information.public void processOnlyFilesMatching(java.util.List<java.lang.String> specifiedPatterns)
specifiedPatterns
- The patterns of file names that this job
will operate on. These should not include any path information, but
should match the entire filename (e.g. .*foo.* for any file with foo in
the name).public void processOnlyFilesMatching(java.lang.String specifiedPattern)
specifiedPattern
- Regular expression of file names that this job
will operate on. This should not include any path information, but should
match the entire filename (e.g. .*foo.* for any file with foo in the
name).public java.util.regex.Pattern getFilenamePattern()
public int getNoOfFilesProcessed()
public java.util.Collection<java.io.File> getFilesFailed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |