dk.netarkivet.archive.arcrepository.bitpreservation
Enum WorkFiles

java.lang.Object
  extended by java.lang.Enum<WorkFiles>
      extended by dk.netarkivet.archive.arcrepository.bitpreservation.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


Enum Constant Summary
CHECKSUMS_ON_BA
          CHECKSUMS_ON_BA.
DELETE_FROM_ADMIN
          DELETE_FROM_ADMIN.
DELETE_FROM_BA
          DELETE_FROM_BA.
FILES_ON_BA
          FILES_ON_BA.
FILES_ON_REFERENCE_BA
          FILES_ON_REFERENCE_BA.
INSERT_IN_ADMIN
          INSERT_IN_ADMIN.
MISSING_FILES_ADMINDATA
          The MISSING_FILES_ADMINDATA is the workfile for the list of missing files for the admin data.
MISSING_FILES_BA
          The MISSING_FILES_BA is the workfile for the list of missing files for a bitarchive.
UPLOAD_TO_BA
          UPLOAD_TO_BA.
WRONG_FILES
          WRONG_FILES.
WRONG_STATES
          WRONG_STATES.
 
Method Summary
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
 

Enum Constant Detail

MISSING_FILES_BA

public static final WorkFiles MISSING_FILES_BA
The MISSING_FILES_BA is the workfile for the list of missing files for a bitarchive.


MISSING_FILES_ADMINDATA

public static final WorkFiles MISSING_FILES_ADMINDATA
The MISSING_FILES_ADMINDATA is the workfile for the list of missing files for the admin data.


WRONG_FILES

public static final WorkFiles WRONG_FILES
WRONG_FILES. Files with wrong checksum??? .


FILES_ON_REFERENCE_BA

public static final WorkFiles FILES_ON_REFERENCE_BA
FILES_ON_REFERENCE_BA. File list from reference ba?.


INSERT_IN_ADMIN

public static final WorkFiles INSERT_IN_ADMIN
INSERT_IN_ADMIN. Files to insert into admin data .


DELETE_FROM_ADMIN

public static final WorkFiles DELETE_FROM_ADMIN
DELETE_FROM_ADMIN. Files to delete from admin data .


UPLOAD_TO_BA

public static final WorkFiles UPLOAD_TO_BA
UPLOAD_TO_BA. Files to upload to the bitarchive .


DELETE_FROM_BA

public static final WorkFiles DELETE_FROM_BA
DELETE_FROM_BA. Files to delete from the bitarchive .


WRONG_STATES

public static final WorkFiles WRONG_STATES
WRONG_STATES. Files that are in wrong state .


FILES_ON_BA

public static final WorkFiles FILES_ON_BA
FILES_ON_BA. Unsorted list of files in a bitarchive .


CHECKSUMS_ON_BA

public static final WorkFiles CHECKSUMS_ON_BA
CHECKSUMS_ON_BA. Unsorted list of files in a bitarchive .

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.