|
||||||||||
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 location)
This method takes as input the name of a bitarchive location for which we have previously run a runFileListJob. |
void |
findWrongFiles(Location location)
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 location,
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 location)
Runs a checksum job on the bit archive at the given location. |
void |
runChecksumJob(Location location,
java.util.List<java.lang.String> specifiedFiles)
Runs a checksum job on the bit archive at the given location. |
void |
runFileListJob(Location location)
Method to get a list of all files in a given bitarchive. |
void |
runFileListJob(Location location,
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 location)
location
- the bitarchive location 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 created
ArgumentNotValid
- if arguments location is nullpublic void findMissingFiles(Location location)
location
- the location to search for missing files
ArgumentNotValid
- if the given directory does not contain a file
filelistOutput/sorted.txt, or the argument location is null
PermissionDenied
- if the output directory cannot be createdpublic void generateActionListForMissingFiles(Location location, Location referenceLocation)
location
- 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 created
ArgumentNotValid
- if arguments are nullpublic FilePreservationStatus getFilePreservationStatus(java.lang.String filename)
filename
- a given filename
ArgumentNotValid
- if argument is null or the empty stringpublic 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.
ArgumentNotValid
- if arguments are null or empty stringspublic void setAdminChecksum(java.lang.String filename, java.lang.String checksum)
filename
- The file to change state forchecksum
- The checksum to change to.
ArgumentNotValid
- if arguments are null or empty stringspublic void runChecksumJob(Location location)
location
- 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 location, java.util.List<java.lang.String> specifiedFiles)
location
- 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 location) throws ArgumentNotValid, IOFailure
location
- the location 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 location, Location referencedBy, java.util.List<java.lang.String> specifiedFiles) throws ArgumentNotValid, IOFailure
location
- the location where the given bitarchive liesreferencedBy
- The location 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 |