Enum WorkFiles

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<WorkFiles>

    public enum WorkFiles
    extends java.lang.Enum<WorkFiles>
    This class encapsulates access to the files used in bitpreservation.

    The following files are encapsulated:

    "unsorted.txt": Unsorted list of files in a bitarchive "sorted.txt": Sorted list of files in a bitarchive

    "missingba.txt": Files that are missing in a bitarchive "missingadmindata.txt"; Files that are missing from admin data "wrongfiles.txt": Files with wrong checksum??? "referenceba.txt"; File list from reference ba?

    "wrongstates.txt"; Files that are in wrong state "insertinadmin.txt"; Files to insert into admin data "deletefromadmin.txt"; Files to delete from admin data "uploadtoba.txt"; Files to upload to the bitarchive "deletefromba.txt"; Files to delete from the bitarchive

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.File getFile​(Replica rep, WorkFiles fileType)
      Method for retrieving a working file.
      static java.util.Date getLastUpdate​(Replica rep, WorkFiles fileType)
      Method for retrieving the last modified date of a working file for a specific replica.
      static java.util.List<java.lang.String> getLines​(Replica replica, WorkFiles fileType)
      Method for retrieving the lines of a working file for a specific replica.
      protected static java.io.File getPreservationDir​(Replica replica)
      Get the base dir for all files related to bitpreservation for a given bitarchive.
      protected static java.io.File getSortedFile​(java.io.File unsortedFile)
      Get a sorted file from an unsorted one, updating if necessary.
      static WorkFiles valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static WorkFiles[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      static void write​(Replica replica, WorkFiles fileType, java.util.Set<java.lang.String> files)
      Method for writing the list of files to a work file.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static WorkFiles[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (WorkFiles c : WorkFiles.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static WorkFiles valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getPreservationDir

        protected static java.io.File getPreservationDir​(Replica replica)
        Get the base dir for all files related to bitpreservation for a given bitarchive.
        Parameters:
        replica - The name of a bitarchive.
        Returns:
        The directory to place bitpreservation for the archive under.
      • getSortedFile

        protected static java.io.File getSortedFile​(java.io.File unsortedFile)
                                             throws IOFailure
        Get a sorted file from an unsorted one, updating if necessary.
        Parameters:
        unsortedFile - An unsorted file
        Returns:
        A file that contains the same lines as unsortedFile, but sorted. The file will be placed in the same directory as the input file, but have the name Constants.SORTED_OUTPUT_FILE defines.
        Throws:
        IOFailure - If the file does not exist.
      • write

        public static void write​(Replica replica,
                                 WorkFiles fileType,
                                 java.util.Set<java.lang.String> files)
        Method for writing the list of files to a work file.
        Parameters:
        replica - The replica for the working file.
        fileType - The type of working file.
        files - The list of filenames (?) to write to the working file.
      • getFile

        public static java.io.File getFile​(Replica rep,
                                           WorkFiles fileType)
        Method for retrieving a working file. Note: it is not tested, whether the file exists.
        Parameters:
        rep - The replica to whom the file corresponds.
        fileType - The type of working file.
        Returns:
        The requested working file.
      • getLastUpdate

        public static java.util.Date getLastUpdate​(Replica rep,
                                                   WorkFiles fileType)
        Method for retrieving the last modified date of a working file for a specific replica.

        FIXME this might throw odd exceptions if the file does not exist.

        Parameters:
        rep - The replica for the working file.
        fileType - The type of working file.
        Returns:
        The last modified date for the working file.
      • getLines

        public static java.util.List<java.lang.String> getLines​(Replica replica,
                                                                WorkFiles fileType)
        Method for retrieving the lines of a working file for a specific replica.
        Parameters:
        replica - The replica of the working file.
        fileType - The type of workfile.
        Returns:
        A list containing the lines of the file.