@Deprecated public class FileBasedActiveBitPreservation extends Object implements ActiveBitPreservation, CleanupIF
This class must run on the same machine as the arcrepository, as it uses the same admin data file (read-only). However, it still talks JMS with the arcrepository.
Modifier | Constructor and Description |
---|---|
protected |
FileBasedActiveBitPreservation()
Deprecated.
Initializes a FileBasedActiveBitPreservation instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addMissingFilesToAdminData(String... filenames)
Deprecated.
Reestablish admin data to match bitarchive states for files.
|
void |
changeStateForAdminData(String filename)
Deprecated.
Reestablish admin data to match replica states for file.
|
void |
cleanup()
Deprecated.
Used to clean up a class from within a shutdown hook.
|
void |
close()
Deprecated.
Shut down cleanly.
|
void |
findChangedFiles(Replica replica)
Deprecated.
This method finds out which files in a given bitarchive are misrepresented in the admin data: Either having the
wrong checksum or not being marked as uploaded when it actually is.
|
void |
findMissingFiles(Replica replica)
Deprecated.
This method takes as input the name of a replica for which we wish to retrieve the list of files, either through
a FileListJob or a GetAllFilenamesMessage.
|
Iterable<String> |
getChangedFiles(Replica bitarchive)
Deprecated.
Get a list of corrupt files in a given bitarchive.
|
Iterable<String> |
getChangedFilesForAdminData()
Deprecated.
Return a list of files with wrong checksum or status in admin data.
|
Date |
getDateForChangedFiles(Replica replica)
Deprecated.
Get the date for last time the checksum information was updated for this replica.
|
Date |
getDateForMissingFiles(Replica replica)
Deprecated.
Get the date for last time the missing files information was updated for this replica.
|
static FileBasedActiveBitPreservation |
getInstance()
Deprecated.
Get singleton instance.
|
Iterable<String> |
getMissingFiles(Replica replica)
Deprecated.
Get a list of missing files in a given replica.
|
Iterable<String> |
getMissingFilesForAdminData()
Deprecated.
Return a list of files present in bitarchive but missing in AdminData.
|
long |
getNumberOfChangedFiles(Replica replica)
Deprecated.
Get the number of wrong files for a replica.
|
long |
getNumberOfFiles(Replica replica)
Deprecated.
Return the number of files found in the replica.
|
long |
getNumberOfMissingFiles(Replica replica)
Deprecated.
Get the number of missing files in a given replica.
|
PreservationState |
getPreservationState(String filename)
Deprecated.
Get the details of the state of the given file in the bitarchives and admin data.
|
Map<String,PreservationState> |
getPreservationStateMap(String... filenames)
Deprecated.
Retrieve the preservation status for the files with the given filenames.
|
void |
replaceChangedFile(Replica replica,
String filename,
String credentials,
String checksum)
Deprecated.
Check that file checksum is indeed different to admin data and reference replica.
|
void |
uploadMissingFiles(Replica replica,
String... filenames)
Deprecated.
Check that the files we want to restore are indeed missing on the replica, and present in admin data and the
reference bitarchive.
|
protected FileBasedActiveBitPreservation()
public static FileBasedActiveBitPreservation getInstance()
public Map<String,PreservationState> getPreservationStateMap(String... filenames) throws ArgumentNotValid
getPreservationStateMap
in interface ActiveBitPreservation
filenames
- List of filenamesArgumentNotValid
- If the list of filenames is null or contains a null.public PreservationState getPreservationState(String filename)
getPreservationState
in interface ActiveBitPreservation
filename
- A given filepublic Iterable<String> getMissingFiles(Replica replica) throws IllegalState, ArgumentNotValid
getMissingFiles
in interface ActiveBitPreservation
replica
- A given replica.IllegalState
- if the file with the list cannot be found.ArgumentNotValid
- If the replica is null.public void findMissingFiles(Replica replica) throws ArgumentNotValid, PermissionDenied
TODO The second file is never used on the current implementation.
FIXME: It is unclear if the decision if which files are missing isn't better suited to be in getMissingFiles, so this method only runs the batch job.
findMissingFiles
in interface ActiveBitPreservation
replica
- the replica to search for missing filesArgumentNotValid
- If the given directory does not contain a file filelistOutput/sorted.txt, or the
argument replica is null.PermissionDenied
- If the output directory cannot be created.public Iterable<String> getChangedFiles(Replica bitarchive) throws IllegalState
getChangedFiles
in interface ActiveBitPreservation
bitarchive
- a bitarchiveIllegalState
- if the file with the list cannot be found.public void findChangedFiles(Replica replica) throws IOFailure, PermissionDenied, ArgumentNotValid
It uses the admindata file from the DIRS_ARCREPOSITORY_ADMIN directory, as well as the files output by a runChecksumJob. The erroneous files are stored in files.
FIXME: It is unclear if the decision if which files are changed isn't better suited to be in getChangedFiles, so this method only runs the batch job.
findChangedFiles
in interface ActiveBitPreservation
replica
- the bitarchive replica the checksumjob came fromIOFailure
- On file or network trouble.PermissionDenied
- if the output directory cannot be createdArgumentNotValid
- if argument replica is nullpublic long getNumberOfFiles(Replica replica) throws ArgumentNotValid
getNumberOfFiles
in interface ActiveBitPreservation
replica
- the bitarchive to checkArgumentNotValid
- If the replica is null.public long getNumberOfMissingFiles(Replica replica) throws ArgumentNotValid
getNumberOfMissingFiles
in interface ActiveBitPreservation
replica
- a given replica.ArgumentNotValid
- If the replica is null.public long getNumberOfChangedFiles(Replica replica) throws ArgumentNotValid
getNumberOfChangedFiles
in interface ActiveBitPreservation
replica
- a replica.ArgumentNotValid
- If the replica is null.public Date getDateForChangedFiles(Replica replica) throws ArgumentNotValid
getDateForChangedFiles
in interface ActiveBitPreservation
replica
- The replica to check last time for.ArgumentNotValid
- If the replica is null.public Date getDateForMissingFiles(Replica replica) throws ArgumentNotValid
getDateForMissingFiles
in interface ActiveBitPreservation
replica
- The replica to check last time for.ArgumentNotValid
- If the replica is null.public void uploadMissingFiles(Replica replica, String... filenames) throws IOFailure, IllegalState, ArgumentNotValid
uploadMissingFiles
in interface ActiveBitPreservation
replica
- The replica to restore files tofilenames
- The names of the files.IllegalState
- If one of the files is unknown (For all known files, there will be an attempt at udpload)IOFailure
- If some file cannot be reestablished. All files will be attempted, though.ArgumentNotValid
- If the replica or the list of filenames are null.public void replaceChangedFile(Replica replica, String filename, String credentials, String checksum) throws ArgumentNotValid, IOFailure, PermissionDenied
replaceChangedFile
in interface ActiveBitPreservation
replica
- The replica to restore file tofilename
- The name of the file.credentials
- The credentials used to perform this replace operationchecksum
- The expected checksum.IOFailure
- if the file cannot be reestablishedPermissionDenied
- if the file is not in correct stateArgumentNotValid
- If the filename, the credentials or the checksum either are null or contain the empty
string, or if the replica is null.public Iterable<String> getMissingFilesForAdminData() throws NotImplementedException
getMissingFilesForAdminData
in interface ActiveBitPreservation
NotImplementedException
- Always, since this will not been implemented.public Iterable<String> getChangedFilesForAdminData() throws NotImplementedException
getChangedFilesForAdminData
in interface ActiveBitPreservation
NotImplementedException
- Always, since this will not been implemented.public void addMissingFilesToAdminData(String... filenames) throws NotImplementedException, ArgumentNotValid
addMissingFilesToAdminData
in interface ActiveBitPreservation
filenames
- The files to reestablish state for.NotImplementedException
- Always, since this will not been implemented.ArgumentNotValid
- If the list of filenames are null.public void changeStateForAdminData(String filename) throws PermissionDenied, ArgumentNotValid
changeStateForAdminData
in interface ActiveBitPreservation
filename
- The file to reestablish state for.PermissionDenied
- if the file is not in correct stateArgumentNotValid
- If the filename is null or empty.public void close()
public void cleanup()
CleanupIF
cleanup
in interface CleanupIF
CleanupIF.cleanup()
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.