|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.archive.arcrepository.bitpreservation.ActiveBitPreservation
public class ActiveBitPreservation
Class handling integrity check of a given bit archive.
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 |
ActiveBitPreservation()
Initalises an ActiveBitPreservation instance. |
Method Summary | |
---|---|
void |
cleanup()
Used to clean up a class from within a shutdown hook. |
void |
close()
Shut down cleanly. |
void |
findMissingFiles(Location institution)
This method takes as input the name of a bitarchive institution for which we have previously run a runFileListJob. |
void |
findWrongFiles(Location institution)
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 |
generateActionListForMissingFiles(Location institution,
Location referenceLocation)
This methods figures out what actions to take for missing files by comparing checksums for missing files with the reference bitarchive. |
FilePreservationStatus |
getFilePreservationStatus(java.lang.String filename)
Retrieve the preservation status for the file with a given filename. |
static ActiveBitPreservation |
getInstance()
Get singleton ActiveBitPreservation instance. |
boolean |
reestablishMissingFile(java.lang.String fileName,
Location damagedBitarchive,
java.lang.StringBuilder result,
java.util.Locale l)
Reestablish a file missing in a bitarchive. |
void |
removeAndGetFile(java.lang.String filename,
Location bitarchive,
java.lang.String checksum,
java.lang.String credentials)
Call upon the arc repository to remove a file, returning it to this machine. |
void |
runChecksumJob(Location institution)
Runs a checksum job on the bit archive at the given institution. |
void |
runChecksumJob(Location institution,
java.util.List<java.lang.String> specifiedFiles)
Runs a checksum job on the bit archive at the given institution. |
void |
runFileListJob(Location institution)
Method to get a list of all files in a given bitarchive. |
void |
runFileListJob(Location institution,
Location referencedBy,
java.util.List<java.lang.String> specifiedFiles)
Method to get a list of all files in a given bitarchive and store list in the given directory. |
void |
setAdminChecksum(java.lang.String filename,
java.lang.String checksum)
Calls upon the arc repository to change the known checksum for the given file in one bitarchive. |
void |
setAdminData(java.lang.String filename,
Location ba,
BitArchiveStoreState state)
Calls upon the arc repository to change the known state for the given file in one bitarchive. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ActiveBitPreservation()
Method Detail |
---|
public static ActiveBitPreservation getInstance()
public void findWrongFiles(Location institution)
institution
- the institution the checksumjob came from
IOFailure
- if the given directory does not contain a file
checksumjobOutput/unsorted.txt, or it cannot be read
PermissionDenied
- if the output directory cannot be createdpublic void findMissingFiles(Location institution)
institution
-
ArgumentNotValid
- if the given directory does not contain a file
filelistOutput/sorted.txt.
PermissionDenied
- if the output directory cannot be createdpublic void generateActionListForMissingFiles(Location institution, Location referenceLocation)
institution
- The bitarchive we're doing bitpreservation for.referenceLocation
- A different bitarchive used for reference.
IOFailure
- if the necessary output from findMissingFiles cannot be
found.
PermissionDenied
- if the output directory cannot be createdpublic FilePreservationStatus getFilePreservationStatus(java.lang.String filename)
filename
- a given filename
public void setAdminData(java.lang.String filename, Location ba, BitArchiveStoreState state)
filename
- The file to change state forba
- The bitarchive to change state for the file for.state
- The state to change to.public void setAdminChecksum(java.lang.String filename, java.lang.String checksum)
filename
- The file to change state forchecksum
- The checksum to change to.public void runChecksumJob(Location institution)
institution
- One of the bitarchive locations.
IOFailure
- If unable to create output dirs or if unable to
write/read output to files.public void runChecksumJob(Location institution, java.util.List<java.lang.String> specifiedFiles)
institution
- One of the bitarchive locations.specifiedFiles
- Only process specfied files. May be null, meaning
all files.
IOFailure
- If unable to create output dirs or if unable to
write/read output to files.public void runFileListJob(Location institution) throws ArgumentNotValid, IOFailure
institution
- the institution where the given bitarchive lies
PermissionDenied
- if the output directories cannot be created
IOFailure
- if there is a problem writing the output file, or if
the job fails for some reason
ArgumentNotValid
public void runFileListJob(Location institution, Location referencedBy, java.util.List<java.lang.String> specifiedFiles) throws ArgumentNotValid, IOFailure
institution
- the institution where the given bitarchive liesreferencedBy
- The institution that we are in the process of
doing bit preservation for. This determines where output is placed.specifiedFiles
- only run the job on the specified files. May be
null, meaning all files
PermissionDenied
- if the output directories cannot be created
IOFailure
- if there is a problem writing the output file, or if
the job fails for some reason
ArgumentNotValid
public boolean reestablishMissingFile(java.lang.String fileName, Location damagedBitarchive, java.lang.StringBuilder result, java.util.Locale l)
fileName
- name of the file to reestablishdamagedBitarchive
- Name of the bitarchive missing the filel
- the localeresult
- Output buffer for writing a textual description of the result of the operation
public void removeAndGetFile(java.lang.String filename, Location bitarchive, java.lang.String checksum, java.lang.String credentials)
filename
- The file to remove.bitarchive
- The bitarchive to remove the file from.checksum
- The checksum of the file.credentials
- Credentials required to run this operation.public 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 |