Class BatchProcessorOperation

    • Field Detail

      • collectErrors

        private boolean collectErrors
      • directoryTrees

        private Vector directoryTrees
      • errorMessages

        private Vector errorMessages
      • inputFileNames

        private Vector inputFileNames
      • outputDirectory

        private String outputDirectory
      • overwrite

        private boolean overwrite
    • 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
      • processDirectoryTree

        private void processDirectoryTree​(String fromDir,
                                          String toDir)
      • 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()