Class BatchGUI


  • public final class BatchGUI
    extends Object
    Utility class for creating the web page content for the batchjob pages.
    • Field Detail

      • log

        protected static final org.slf4j.Logger log
        The log.
    • Method Detail

      • getBatchOverviewPage

        public static void getBatchOverviewPage​(javax.servlet.jsp.PageContext context)
                                         throws ArgumentNotValid,
                                                IOException
        Method for creating the batchjob overview page. Creates both the heading and the table for the batchjobs defined in settings.
        Parameters:
        context - The context of the page. Contains the locale for the language package.
        Throws:
        ArgumentNotValid - If the PageContext is null.
        IOException - If it is not possible to write to the JspWriter.
      • getPageForClass

        public static void getPageForClass​(javax.servlet.jsp.PageContext context)
                                    throws UnknownID,
                                           ArgumentNotValid,
                                           IllegalState,
                                           ForwardedToErrorPage,
                                           IOFailure
        Method for creating the page for a batchjob. It contains the following informations:


        - Creates a line with the name of the batchjob.
        - Write the description if the batchjob has a metadata resource annotation description of the batchjob class.
        - The last run information, date and size of the error and output files.
        - The arguments of the batchjob, with information if they have been defined in the resource annotations of the class.
        - Radio buttons for choosing the replica.
        - Input box for regular expression for filenames to match.
        - Execution button.

        Parameters:
        context - The context of the page. Must contains a class name of the batchjob.
        Throws:
        UnknownID - If the class cannot be found.
        ArgumentNotValid - If the context is null.
        IllegalState - If the class is not an instance of FileBatchJob.
        ForwardedToErrorPage - If the context does not contain the required information.
        IOFailure - If there is problems with the JspWriter.
      • execute

        public static void execute​(javax.servlet.jsp.PageContext context)
        Method for executing a batchjob.
        Parameters:
        context - The page context containing the needed information for executing the batchjob.
      • getJobName

        public static String getJobName​(String classPath)
                                 throws ArgumentNotValid
        Method for extracting the name of the batchjob from the batchjob path. E.g. the batchjob: dk.netarkivet.archive.arcrepository.bitpreservation.ChecksumJob would become ChecksumJob.
        Parameters:
        classPath - The complete path for class (retrieve by class.getName()).
        Returns:
        The batchjob name of the class.
        Throws:
        ArgumentNotValid - If the classPath is either null or empty.
      • getBatchDir

        public static File getBatchDir()
        Retrieves the directory for the batchDir (defined in settings).
        Returns:
        The directory containing all the batchjob results.
      • getJarFile

        public static File getJarFile​(String classPath)
                               throws ArgumentNotValid,
                                      IOFailure
        Method for retrieving and validating the arc-file for a given DOOM!
        Parameters:
        classPath - The path to the file.
        Returns:
        The arc-file at the given path, or if the path is null or the empty string, then a null is returned.
        Throws:
        ArgumentNotValid - If the classPath argument is null or the empty string.
        IOFailure - If the file does not exist, or it is not a valid file.