JIU 0.14.3

net.sourceforge.jiu.ops
Class BatchProcessorOperation

java.lang.Object
  extended by net.sourceforge.jiu.ops.Operation
      extended by net.sourceforge.jiu.ops.BatchProcessorOperation
Direct Known Subclasses:
ColorIndexer, ImageLoadTester

public abstract class BatchProcessorOperation
extends Operation

Abstract base class to do batch processing on files and complete directory trees. For a non-abstract extension of this operation, you must implement processFile(java.lang.String, java.lang.String, java.lang.String).

Since:
0.11.0
Author:
Marco Schmidt

Constructor Summary
BatchProcessorOperation()
           
 
Method Summary
 void addDirectoryTree(String rootDirectoryName)
          Adds the argument to the list of directories to be completely processed.
 void addDirectoryTree(String rootDirectoryName, String outputRootDirectoryName)
          Adds the first argument to the list of directories to be completely processed, writes all output files to the directory tree specified by the second argument.
 void addInputFileName(String fileName)
          Adds a single name to the list of file names to be processed.
 void addInputFileNames(Vector fileNameList)
          Adds a number of file names to the internal list of file names to be processed.
 Vector getErrorMessages()
          Returns a list of error messages collected during the execution of process().
 boolean getOverwrite()
          Returns the current overwrite setting.
 void process()
          Processes all directory trees and files given to this operation, calling processFile(java.lang.String, java.lang.String, java.lang.String) on each file name.
abstract  void processFile(String inputDirectory, String inputFileName, String outputDirectory)
          Method to be called on each file given to this operation.
 void setCollectErrorMessages(boolean collectErrorMessages)
          Specifies whether error messages are supposed to be collected during the execution of process().
 void setOutputDirectory(String outputDirectoryName)
          Specifies the output directory for all single files.
 void setOverwrite(boolean newValue)
          Specify whether existing files are to be overwritten.
 
Methods inherited from class net.sourceforge.jiu.ops.Operation
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchProcessorOperation

public BatchProcessorOperation()
Method Detail

addDirectoryTree

public void addDirectoryTree(String rootDirectoryName)
Adds the argument to the list of directories to be completely processed.

Parameters:
rootDirectoryName - name of the root of the directory tree, can be any valid directory name

addDirectoryTree

public void addDirectoryTree(String rootDirectoryName,
                             String outputRootDirectoryName)
Adds the first argument to the list of directories to be completely processed, writes all output files to the directory tree specified by the second argument.

Parameters:
rootDirectoryName - name of the root of the directory tree, can be any valid directory name
outputRootDirectoryName - name of the root of the directory tree, can be any valid directory name

addInputFileName

public void addInputFileName(String fileName)
Adds a single name to the list of file names to be processed.

Parameters:
fileName - name to be added to list

addInputFileNames

public void addInputFileNames(Vector fileNameList)
Adds a number of file names to the internal list of file names to be processed.

Parameters:
fileNameList - list of file names, each object in the list must be a String

getErrorMessages

public Vector getErrorMessages()
Returns a list of error messages collected during the execution of process().

Returns:
list of error messages, each object is a String

getOverwrite

public boolean getOverwrite()
Returns the current overwrite setting.

Returns:
whether existing files are to be overwritten

process

public void process()
Processes all directory trees and files given to this operation, calling processFile(java.lang.String, java.lang.String, java.lang.String) on each file name.

Overrides:
process in class Operation

processFile

public abstract void processFile(String inputDirectory,
                                 String inputFileName,
                                 String outputDirectory)
Method to be called on each file given to this operation. Non-abstract heirs of this class must implement this method to add functionality.

Parameters:
inputDirectory - name of directory where the file to be processed resides
inputFileName - name of file to be processed
outputDirectory - output directory for that file, need not necessarily be used

setCollectErrorMessages

public void setCollectErrorMessages(boolean collectErrorMessages)
Specifies whether error messages are supposed to be collected during the execution of process().

Parameters:
collectErrorMessages - if true, error messages will be collected, otherwise not
See Also:
getErrorMessages()

setOutputDirectory

public void setOutputDirectory(String outputDirectoryName)
Specifies the output directory for all single files. Note that you can specify different output directories when dealing with directory trees.

Parameters:
outputDirectoryName - name of output directory

setOverwrite

public void setOverwrite(boolean newValue)
Specify whether existing files are to be overwritten.

Parameters:
newValue - if true, files are overwritten, otherwise not
See Also:
getOverwrite()

JIU 0.14.3

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Marco Schmidt