|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.archive.checksum.DatabaseChecksumArchive
public class DatabaseChecksumArchive
A ChecksumArchive persisted with a Berkeley DB JE Database.
Migrating from the FileChecksumArchive
to the DatabaseChecksumArchive is
done with the LoadDatabaseChecksumArchive
tool.
Constructor Summary | |
---|---|
DatabaseChecksumArchive()
Constructor. |
Method Summary | |
---|---|
java.lang.String |
calculateChecksum(java.io.File f)
Method for calculating the checksum of a specific file. |
java.lang.String |
calculateChecksum(java.io.InputStream is)
Method for calculating the checksum when the file is received in the form of an inputstream. |
void |
cleanup()
Method for cleaning up when closing down. |
java.io.File |
correct(java.lang.String filename,
java.io.File correctFile)
Method for removing a bad entry from the archive. |
java.io.File |
getAllFilenames()
Method for retrieving the names of all the files within the archive as a temporary file. |
java.io.File |
getArchiveAsFile()
Method for retrieving the archive as a temporary file containing the checksum entries. |
java.lang.String |
getChecksum(java.lang.String filename)
Method for retrieving the checksum of a specific entry in the archive. |
static DatabaseChecksumArchive |
getInstance()
Method for obtaining the current singleton instance of this class. |
boolean |
hasEnoughSpace()
Method for checking whether there is enough space left on the hard drive. |
boolean |
hasEntry(java.lang.String filename)
Method for checking whether an entry exists within the archive. |
void |
put(java.lang.String filename,
java.lang.String checksum)
Update the database with a new filename and its checksum. |
void |
upload(RemoteFile file,
java.lang.String filename)
Method for uploading a new file to the archive. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatabaseChecksumArchive() throws com.sleepycat.je.DatabaseException
java.lang.Exception
com.sleepycat.je.DatabaseException
Method Detail |
---|
public static DatabaseChecksumArchive getInstance() throws java.lang.Exception
java.lang.Exception
public boolean hasEnoughSpace()
ChecksumArchive
hasEnoughSpace
in interface ChecksumArchive
public java.io.File correct(java.lang.String filename, java.io.File correctFile) throws IOFailure, ArgumentNotValid, IllegalState
ChecksumArchive
correct
in interface ChecksumArchive
filename
- The name of the file whose record should be removed.correctFile
- The correct remote file to replace the bad one in
the archive.
IOFailure
- If the entry cannot be corrected.
ArgumentNotValid
- If one of the arguments are not valid.
IllegalState
- If no such entry exists to be corrected, or if the
entry has a different checksum than expected.public java.lang.String getChecksum(java.lang.String filename)
ChecksumArchive
getChecksum
in interface ChecksumArchive
filename
- The name of the file entry in the archive for whom the
checksum should be retrieved.
public boolean hasEntry(java.lang.String filename)
ChecksumArchive
hasEntry
in interface ChecksumArchive
filename
- The name of the file whose entry in the archive should
be determined.
public void upload(RemoteFile file, java.lang.String filename)
ChecksumArchive
upload
in interface ChecksumArchive
file
- The remote file to be uploaded.filename
- The name of the file.public void put(java.lang.String filename, java.lang.String checksum)
filename
- A given filenamechecksum
- The related checksumpublic java.lang.String calculateChecksum(java.io.File f)
ChecksumArchive
calculateChecksum
in interface ChecksumArchive
f
- The file to calculate the checksum from.
public java.lang.String calculateChecksum(java.io.InputStream is)
ChecksumArchive
calculateChecksum
in interface ChecksumArchive
is
- The input stream to calculate the checksum from.
public java.io.File getArchiveAsFile()
ChecksumArchive
getArchiveAsFile
in interface ChecksumArchive
public java.io.File getAllFilenames()
ChecksumArchive
getAllFilenames
in interface ChecksumArchive
public void cleanup()
ChecksumArchive
cleanup
in interface ChecksumArchive
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |