edu.northwestern.at.utils

## Class FileBatchProcessor

- java.lang.Object
- - edu.northwestern.at.utils.FileBatchProcessor

-     public abstract class FileBatchProcessor
      extends java.lang.Object

  Process batch of files.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `currentFileNumber` Current document.
    `protected java.lang.String[]` | `fileNames` Input file names.
    `protected int` | `filesToProcess` Number of documents to process.
    `protected int` | `initParams` # params before input file specs.
    `protected java.lang.String` | `outputDirectoryName` Output directory name.
    `protected java.io.PrintStream` | `printStream` Wrapper for printStream to allow utf-8 output.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileBatchProcessor()` Create file batch processor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCurrentFileNumber()` Get index of file currently being processed.
    `int` | `getNumberOfFilesToProcess()` Get number of files to process.
    `java.lang.String` | `getOutputDirectoryName()` Get output directory name.
    `java.io.PrintStream` | `getPrintStream()` Get print stream.
    `void` | `incrementCurrentFileNumber()` Increment index of file currently being processed.
    `boolean` | `initialize()` Initialize.
    `int` | `processFiles()` Process files.
    `abstract void` | `processOneFile(java.lang.String inputFileName)` Process one input file.
    `void` | `run()` Run file batch processor.
    `void` | `setCurrentFileNumber(int currentFileNumber)` Set index of file currently being processed.
    `void` | `setInputFileNames(java.lang.String[] inputFileNames, int startIndex)` Set input file names.
    `void` | `setOutputDirectoryName(java.lang.String outputDirectoryName)` Set output directory name.
    `void` | `terminate(int filesProcessed, long processingTime)` Terminate.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### initParams

          protected int initParams

      # params before input file specs.

    - #### filesToProcess

          protected int filesToProcess

      Number of documents to process.

    - #### currentFileNumber

          protected int currentFileNumber

      Current document.

    - #### outputDirectoryName

          protected java.lang.String outputDirectoryName

      Output directory name.

    - #### fileNames

          protected java.lang.String[] fileNames

      Input file names. May contain wildcards.

    - #### printStream

          protected java.io.PrintStream printStream

      Wrapper for printStream to allow utf-8 output.

  - ### Constructor Detail

    - #### FileBatchProcessor

          public FileBatchProcessor()
                             throws java.lang.Exception

      Create file batch processor.
      Throws:
        `java.lang.Exception`

  - ### Method Detail

    - #### run

          public void run()

      Run file batch processor.

    - #### initialize

          public boolean initialize()
                             throws java.lang.Exception

      Initialize.
      Throws:
        `java.lang.Exception`

    - #### processOneFile

          public abstract void processOneFile(java.lang.String inputFileName)
                                       throws java.lang.Exception

      Process one input file.
      Parameters:
        `inputFileName` - Input file name.
      Throws:
        `java.lang.Exception`

    - #### processFiles

          public int processFiles()
                           throws java.lang.Exception

      Process files.
      Throws:
        `java.lang.Exception`

    - #### terminate

          public void terminate(int filesProcessed,
                       long processingTime)

      Terminate.
      Parameters:
        `filesProcessed` - Number of files processed.
        `processingTime` - Processing time in seconds.

    - #### setOutputDirectoryName

          public void setOutputDirectoryName(java.lang.String outputDirectoryName)

      Set output directory name.
      Parameters:
        `outputDirectoryName` - Output directory name.

    - #### getOutputDirectoryName

          public java.lang.String getOutputDirectoryName()

      Get output directory name.
      Returns:
        Output directory name.

    - #### setInputFileNames

          public void setInputFileNames(java.lang.String[] inputFileNames,
                               int startIndex)

      Set input file names.
      Parameters:
        `inputFileNames` - String array of input file names. May contain wildcards.
        `startIndex` - Position in inputFileNames at which file names start.

    - #### getNumberOfFilesToProcess

          public int getNumberOfFilesToProcess()

      Get number of files to process.
      Returns:
        Number of files to process.

    - #### getCurrentFileNumber

          public int getCurrentFileNumber()

      Get index of file currently being processed.
      Returns:
        Index of file currently being processed.

    - #### setCurrentFileNumber

          public void setCurrentFileNumber(int currentFileNumber)

      Set index of file currently being processed.
      Parameters:
        `currentFileNumber` - Index of file currently being processed.

    - #### incrementCurrentFileNumber

          public void incrementCurrentFileNumber()

      Increment index of file currently being processed.

    - #### getPrintStream

          public java.io.PrintStream getPrintStream()

      Get print stream.
      Returns:
        Print stream.