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(Location bitarchive)
          Update the list of checksums in a given bitarchive.
 void findMissingFiles(Location bitarchive)
          Update the list of files in a given bitarchive.
 java.lang.Iterable<java.lang.String> getChangedFiles(Location location)
          Return a list of files with changed checksums on this location.
 java.lang.Iterable<java.lang.String> getChangedFilesForAdminData()
          Return a list of files with wrong checksum or state in admin data.
 java.util.Date getDateForChangedFiles(Location location)
          Return the date for last check of changed files for location.
 java.util.Date getDateForMissingFiles(Location location)
          Return the date for last check of missing files for location.
 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(Location location)
          Return a list of files marked as missing on this location.
 java.lang.Iterable<java.lang.String> getMissingFilesForAdminData()
          Return a list of files present in bitarchive but missing in AdminData.
 long getNumberOfChangedFiles(Location location)
          Return the number of changed files for location.
 long getNumberOfFiles(Location location)
          Return the total number of files for location.
 long getNumberOfMissingFiles(Location location)
          Return the number of missing files for location.
 void replaceChangedFile(Location location, 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 location.
 void uploadMissingFiles(Location location, java.lang.String... filenames)
          Check that files are indeed missing on the given location, and present in admin data and reference location.
 

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(Location location)
Return a list of files marked as missing on this location. 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:
location - The location 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(Location location)
Return a list of files with changed checksums on this location. 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:
location - The location 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(Location bitarchive)
Update the list of files in a given bitarchive. This will be used for the next call to getMissingFiles.

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

findChangedFiles

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

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

getNumberOfMissingFiles

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

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

getNumberOfChangedFiles

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

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

getNumberOfFiles

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

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

getDateForMissingFiles

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

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

getDateForChangedFiles

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

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

uploadMissingFiles

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

Parameters:
location - The location 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(Location location,
                        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 location. If so, remove missing file and upload it from reference location to this location.

Parameters:
location - The location 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 present in bitarchive 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