Class LoadableFileBatchJob

  • All Implemented Interfaces:
    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
    • Constructor Detail

      • LoadableFileBatchJob

        public LoadableFileBatchJob​(File classFile,
                                    List<String> arguments)
                             throws ArgumentNotValid
        Create a new batch job that runs the loaded class.
        Parameters:
        classFile - the classfile for the batch job we want to run.
        arguments - The arguments for the batchjobs. This can be null.
        Throws:
        ArgumentNotValid - If the classfile is null.
    • Method Detail

      • toString

        public String toString()
        Override of the default toString to include name of loaded class.
        Overrides:
        toString in class Object
        Returns:
        string representation of this class.
      • initialize

        public void initialize​(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
      • loadBatchJob

        protected void loadBatchJob()
                             throws IOFailure
        Method for initializing the loaded batchjob.
        Throws:
        IOFailure - If the batchjob cannot be loaded.
      • processFile

        public boolean processFile​(File file,
                                   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​(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
      • postProcess

        public boolean postProcess​(InputStream input,
                                   OutputStream output)
        Description copied from class: FileBatchJob
        Processes the concatenated result files. This is intended to be overridden by batchjobs, who they wants a different post-processing process than concatenation.
        Overrides:
        postProcess in class FileBatchJob
        Parameters:
        input - The inputstream to the file containing the concatenated results.
        output - The outputstream where the resulting data should be written.
        Returns:
        Whether it actually does any post processing. If false is returned then the default concatenated result file is returned.