|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.archive.arcrepository.bitpreservation.FileBasedActiveBitPreservation
public class FileBasedActiveBitPreservation
Class handling integrity check of the arcrepository.
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.
Constructor Summary | |
---|---|
protected |
FileBasedActiveBitPreservation()
Initialises a FileBasedActiveBitPreservation instance. |
Method Summary | |
---|---|
void |
addMissingFilesToAdminData(java.lang.String... filename)
Reestablish admin data to match bitarchive states for files. |
void |
changeStateForAdminData(java.lang.String filename)
Reestablish admin data to match bitarchive states for file. |
void |
cleanup()
Used to clean up a class from within a shutdown hook. |
void |
close()
Shut down cleanly. |
void |
findChangedFiles(Replica replica)
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)
This method takes as input the name of a bitarchive replica for which we wish to run a FileListJob. |
java.lang.Iterable<java.lang.String> |
getChangedFiles(Replica bitarchive)
Get a list of wrong files in a given bitarchive. |
java.lang.Iterable<java.lang.String> |
getChangedFilesForAdminData()
Return a list of files with wrong checksum or status in admin data. |
java.util.Date |
getDateForChangedFiles(Replica replica)
Get the date for last time the checksum information was updated for this replica. |
java.util.Date |
getDateForMissingFiles(Replica replica)
Get the date for last time the missing files information was updated for this 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)
Retrieve the preservation status for the files with the given filenames. |
static FileBasedActiveBitPreservation |
getInstance()
Get singleton instance. |
java.lang.Iterable<java.lang.String> |
getMissingFiles(Replica replica)
Get a list of missing files in a given replica. |
java.lang.Iterable<java.lang.String> |
getMissingFilesForAdminData()
Return a list of files present in bitarchive but missing in AdminData. |
long |
getNumberOfChangedFiles(Replica bitarchive)
Get the number of wrong files for a bitarchive. |
long |
getNumberOfFiles(Replica bitarchive)
Return the number of files found in the bitarchive. |
long |
getNumberOfMissingFiles(Replica bitarchive)
Get the number of missing files in a given bitarchive. |
void |
replaceChangedFile(Replica replica,
java.lang.String filename,
java.lang.String credentials,
java.lang.String checksum)
Check that file checksum is indeed different to admin data and reference replica. |
void |
uploadMissingFiles(Replica replica,
java.lang.String... filenames)
Check that files are indeed missing on the bitarchive replica, and present in admin data and reference replica. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FileBasedActiveBitPreservation()
Method Detail |
---|
public static FileBasedActiveBitPreservation getInstance()
public java.util.Map<java.lang.String,FilePreservationState> getFilePreservationStateMap(java.lang.String... filenames)
getFilePreservationStateMap
in interface ActiveBitPreservation
filenames
- List of filenames
ArgumentNotValid
- if argument is nullpublic FilePreservationState getFilePreservationState(java.lang.String filename)
getFilePreservationState
in interface ActiveBitPreservation
filename
- A given file
public java.lang.Iterable<java.lang.String> getMissingFiles(Replica replica)
getMissingFiles
in interface ActiveBitPreservation
replica
- A given replica.
IllegalState
- if the file with the list cannot be found.public void findMissingFiles(Replica replica)
findMissingFiles
in interface ActiveBitPreservation
replica
- the replica to search for missing files
ArgumentNotValid
- 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 createdpublic java.lang.Iterable<java.lang.String> getChangedFiles(Replica bitarchive)
getChangedFiles
in interface ActiveBitPreservation
bitarchive
- a bitarchive
IllegalState
- if the file with the list cannot be found.public void findChangedFiles(Replica replica)
findChangedFiles
in interface ActiveBitPreservation
replica
- the bitarchive replica the checksumjob came from
IOFailure
- On file or network trouble.
PermissionDenied
- if the output directory cannot be created
ArgumentNotValid
- if argument replica is nullpublic long getNumberOfFiles(Replica bitarchive)
getNumberOfFiles
in interface ActiveBitPreservation
bitarchive
- the bitarchive to check
public long getNumberOfMissingFiles(Replica bitarchive)
getNumberOfMissingFiles
in interface ActiveBitPreservation
bitarchive
- a given bitarchive
public long getNumberOfChangedFiles(Replica bitarchive)
getNumberOfChangedFiles
in interface ActiveBitPreservation
bitarchive
- a bitarchive
public java.util.Date getDateForChangedFiles(Replica replica)
getDateForChangedFiles
in interface ActiveBitPreservation
replica
- The replica to check last time for.
public java.util.Date getDateForMissingFiles(Replica replica)
getDateForMissingFiles
in interface ActiveBitPreservation
replica
- The replica to check last time for.
public void uploadMissingFiles(Replica replica, java.lang.String... filenames)
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.public void replaceChangedFile(Replica replica, java.lang.String filename, java.lang.String credentials, java.lang.String checksum)
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 reestablished
PermissionDenied
- if the file is not in correct statepublic java.lang.Iterable<java.lang.String> getMissingFilesForAdminData()
getMissingFilesForAdminData
in interface ActiveBitPreservation
IOFailure
- if the list cannot be generated.public java.lang.Iterable<java.lang.String> getChangedFilesForAdminData()
getChangedFilesForAdminData
in interface ActiveBitPreservation
IOFailure
- if the list cannot be generated.public void addMissingFilesToAdminData(java.lang.String... filename)
addMissingFilesToAdminData
in interface ActiveBitPreservation
filename
- The files to reestablish state for.
PermissionDenied
- if the file is not in correct statepublic void changeStateForAdminData(java.lang.String filename)
changeStateForAdminData
in interface ActiveBitPreservation
filename
- The file to reestablish state for.
PermissionDenied
- if the file is not in correct statepublic void close()
public void cleanup()
CleanupIF
cleanup
in interface CleanupIF
CleanupIF.cleanup()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |