public class DatabaseChecksumArchive extends Object implements ChecksumArchive
FileChecksumArchive
to the
DatabaseChecksumArchive is done with the LoadDatabaseChecksumArchive
tool.Constructor and Description |
---|
DatabaseChecksumArchive()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
calculateChecksum(File f)
Method for calculating the checksum of a specific file.
|
String |
calculateChecksum(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.
|
File |
correct(String filename,
File correctFile)
Method for removing a bad entry from the archive.
|
File |
getAllFilenames()
Method for retrieving the names of all the files within the archive as a temporary file.
|
File |
getArchiveAsFile()
Method for retrieving the archive as a temporary file containing the checksum entries.
|
String |
getChecksum(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(String filename)
Method for checking whether an entry exists within the archive.
|
void |
put(String filename,
String checksum)
Update the database with a new filename and its checksum.
|
void |
upload(RemoteFile file,
String filename)
Method for uploading a new file to the archive.
|
public DatabaseChecksumArchive() throws com.sleepycat.je.DatabaseException
Exception
com.sleepycat.je.DatabaseException
public static DatabaseChecksumArchive getInstance() throws Exception
Exception
public boolean hasEnoughSpace()
ChecksumArchive
hasEnoughSpace
in interface ChecksumArchive
public File correct(String filename, 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 String getChecksum(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(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, String filename)
ChecksumArchive
upload
in interface ChecksumArchive
file
- The remote file to be uploaded.filename
- The name of the file.public void put(String filename, String checksum)
filename
- A given filenamechecksum
- The related checksumpublic String calculateChecksum(File f)
ChecksumArchive
calculateChecksum
in interface ChecksumArchive
f
- The file to calculate the checksum from.public String calculateChecksum(InputStream is)
ChecksumArchive
calculateChecksum
in interface ChecksumArchive
is
- The input stream to calculate the checksum from.public File getArchiveAsFile()
ChecksumArchive
getArchiveAsFile
in interface ChecksumArchive
public File getAllFilenames()
ChecksumArchive
getAllFilenames
in interface ChecksumArchive
public void cleanup()
ChecksumArchive
cleanup
in interface ChecksumArchive
Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.