dk.netarkivet.archive.arcrepository.bitpreservation
Interface ActiveBitPreservation

All Known Implementing Classes:
FileBasedActiveBitPreservation

public interface ActiveBitPreservation

All bitpreservation implementations are assumed to have access to admin data and bitarchives. Operations may request information from the bitarchive by sending batch jobs, reading admin data directly, or reading from cached information from either.


Method Summary
 void addMissingFilesToAdminData(java.lang.String... filenames)
          Add files unknown in admin.data to admin.data.
 void changeStateForAdminData(java.lang.String filename)
          Reestablish admin data to match bitarchive states for file.
 void findChangedFiles(Replica replica)
          Update the list of checksums in a given replica.
 void findMissingFiles(Replica replica)
          Update the list of files in a given bitarchive.
 java.lang.Iterable<java.lang.String> getChangedFiles(Replica replica)
          Return a list of files with changed checksums on this replica.
 java.lang.Iterable<java.lang.String> getChangedFilesForAdminData()
          Return a list of files with wrong checksum or state in admin data.
 java.util.Date getDateForChangedFiles(Replica replica)
          Return the date for last check of changed files for replica.
 java.util.Date getDateForMissingFiles(Replica replica)
          Return the date for last check of missing files for replica.
 FilePreservationState getFilePreservationState(java.lang.String filename)
          Get the details of the state of the given file in the bitarchives and admin data.
 java.util.Map<java.lang.String,FilePreservationState> getFilePreservationStateMap(java.lang.String... filenames)
          Get details of the state of one or more files in the bitarchives and admin data.
 java.lang.Iterable<java.lang.String> getMissingFiles(Replica replica)
          Return a list of files marked as missing on this replica.
 java.lang.Iterable<java.lang.String> getMissingFilesForAdminData()
          Return a list of files represented in replica but missing in AdminData.
 long getNumberOfChangedFiles(Replica replica)
          Return the number of changed files for replica.
 long getNumberOfFiles(Replica replica)
          Return the total number of files for replica.
 long getNumberOfMissingFiles(Replica replica)
          Return the number of missing files for replica.
 void replaceChangedFile(Replica replica, java.lang.String filename, java.lang.String credentials, java.lang.String checksum)
          Check that the checksum of the file is indeed different to the value in admin data and reference replica.
 void uploadMissingFiles(Replica replica, java.lang.String... filenames)
          Check that files are indeed missing on the given replica, and present in admin data and reference replica.
 

Method Detail

getFilePreservationStateMap

java.util.Map<java.lang.String,FilePreservationState> getFilePreservationStateMap(java.lang.String... filenames)
Get details of the state of one or more files in the bitarchives and admin data.

Parameters:
filenames - the list of filenames to investigate
Returns:
a map ([filename]-> [FilePreservationState]) with the preservationstate of all files in the list. The preservationstates in the map will be null for all filenames, that are not found in admin data.

getFilePreservationState

FilePreservationState getFilePreservationState(java.lang.String filename)
Get the details of the state of the given file in the bitarchives and admin data.

Parameters:
filename - A given file
Returns:
the FilePreservationState for the given file. This will be null, if the filename is not found in admin data.

getMissingFiles

java.lang.Iterable<java.lang.String> getMissingFiles(Replica replica)
Return a list of files marked as missing on this replica. A file is considered missing if it exists in admin data, but is not known in the bit archives. Guaranteed not to recheck the archive, simply returns the list generated by the last test.

Parameters:
replica - The replica to get missing files from.
Returns:
A list of missing files.
Throws:
IOFailure - if the list cannot be generated.

getChangedFiles

java.lang.Iterable<java.lang.String> getChangedFiles(Replica replica)
Return a list of files with changed checksums on this replica. A file is considered changed if checksum does not compare to admin data. Guaranteed not to recheck the archive, simply returns the list generated by the last test.

Parameters:
replica - The replica to get a list of changed files from.
Returns:
A list of files with changed checksums.
Throws:
IOFailure - if the list cannot be generated.

findMissingFiles

void findMissingFiles(Replica replica)
Update the list of files in a given bitarchive. This will be used for the next call to getMissingFiles.

Parameters:
replica - The replica to update list of files for.

findChangedFiles

void findChangedFiles(Replica replica)
Update the list of checksums in a given replica. This will be used for the next call to getChangedFiles.

Parameters:
replica - The replica to update list of files for.

getNumberOfMissingFiles

long getNumberOfMissingFiles(Replica replica)
Return the number of missing files for replica. Guaranteed not to recheck the archive, simply returns the number generated by the last test.

Parameters:
replica - The replica to get the number of missing files from.
Returns:
The number of missing files.

getNumberOfChangedFiles

long getNumberOfChangedFiles(Replica replica)
Return the number of changed files for replica. Guaranteed not to recheck the archive, simply returns the number generated by the last test.

Parameters:
replica - The replica to get the number of changed files from.
Returns:
The number of changed files.

getNumberOfFiles

long getNumberOfFiles(Replica replica)
Return the total number of files for replica. Guaranteed not to recheck the archive, simply returns the number generated by the last update.

Parameters:
replica - The replica to get the number of files from.
Returns:
The number of files.

getDateForMissingFiles

java.util.Date getDateForMissingFiles(Replica replica)
Return the date for last check of missing files for replica. Guaranteed not to recheck the archive, simply returns the date for the last test.

Parameters:
replica - The replica to get date for changed files from.
Returns:
The date for last check of missing files.

getDateForChangedFiles

java.util.Date getDateForChangedFiles(Replica replica)
Return the date for last check of changed files for replica. Guaranteed not to recheck the archive, simply returns the date for the last test.

Parameters:
replica - The replica to get date for changed files from.
Returns:
The date for last check of changed files.

uploadMissingFiles

void uploadMissingFiles(Replica replica,
                        java.lang.String... filenames)
Check that files are indeed missing on the given replica, and present in admin data and reference replica. If so, upload missing files from reference replica to this replica.

Parameters:
replica - The replica to restore files to
filenames - The names of the files.
Throws:
IOFailure - if any file cannot be reestablished, or if any file is not in correct state. The process will be attempted for all files, even if one causes this exception.

replaceChangedFile

void replaceChangedFile(Replica replica,
                        java.lang.String filename,
                        java.lang.String credentials,
                        java.lang.String checksum)
Check that the checksum of the file is indeed different to the value in admin data and reference replica. If so, remove missing file and upload it from reference replica to this replica.

Parameters:
replica - The replica to restore file to
filename - The name of the file
credentials - The credentials used to perform this replace operation
checksum - The known bad checksum. Only a file with this bad checksum is attempted repaired.
Throws:
IOFailure - if the file cannot be reestablished
PermissionDenied - if the file is not in correct state

getMissingFilesForAdminData

java.lang.Iterable<java.lang.String> getMissingFilesForAdminData()
Return a list of files represented in replica but missing in AdminData.

Returns:
A list of missing files.
Throws:
IOFailure - if the list cannot be generated.

getChangedFilesForAdminData

java.lang.Iterable<java.lang.String> getChangedFilesForAdminData()
Return a list of files with wrong checksum or state in admin data.

Returns:
A list of files with wrong checksum or state.
Throws:
IOFailure - if the list cannot be generated.

addMissingFilesToAdminData

void addMissingFilesToAdminData(java.lang.String... filenames)
Add files unknown in admin.data to admin.data.

Parameters:
filenames - The files to add.
Throws:
PermissionDenied - if the file is not in correct state

changeStateForAdminData

void changeStateForAdminData(java.lang.String filename)
Reestablish admin data to match bitarchive states for file.

Parameters:
filename - The file to reestablish state for.
Throws:
PermissionDenied - if the file is not in correct state