dk.netarkivet.archive.arcrepositoryadmin
Interface BitPreservationDAO

All Superinterfaces:
CleanupIF
All Known Implementing Classes:
ReplicaCacheDatabase

public interface BitPreservationDAO
extends CleanupIF

This is an interface for communicating with bitpreservation databases.


Method Summary
 void addChecksumInformation(java.util.List<java.lang.String> checksumOutput, Replica replica)
          Given the output of a checksum job, add the results to the database.
 void addFileListInformation(java.util.List<java.lang.String> filelistOutput, Replica replica)
          Given the output of a file list job, add the results to the database.
 void cleanup()
          Method for cleaning up when done.
 Replica getBitarchiveWithGoodFile(java.lang.String filename)
          Method for retrieving a replica which has the file and the checksum_status = OK.
 Replica getBitarchiveWithGoodFile(java.lang.String filename, Replica badReplica)
          Method for retrieving a replica which has the file and the checksum_status = OK.
 java.sql.Date getDateOfLastMissingFilesUpdate(Replica replica)
          Get the date for the last file list job.
 java.sql.Date getDateOfLastWrongFilesUpdate(Replica replica)
          Get the date for the last file list job.
 java.lang.Iterable<java.lang.String> getMissingFilesInLastUpdate(Replica replica)
          Return files with upload_status = COMPLETE for the replica, but the filelist_status = MISSING.
 long getNumberOfFiles(Replica replica)
          Returns the count of files in the replica which is not missing.
 long getNumberOfMissingFilesInLastUpdate(Replica replica)
          Return the count of missing files for replica.
 long getNumberOfWrongFilesInLastUpdate(Replica replica)
          Return the count of corrupt files for replica.
 ReplicaFileInfo getReplicaFileInfo(java.lang.String filename, Replica replica)
          Method for retrieving the entry in the replicafileinfo table for a given file and replica.
 java.lang.Iterable<java.lang.String> getWrongFilesInLastUpdate(Replica replica)
          Return files with filelist_status CORRUPT for the replica, but not present in the last missing files job.
 void updateChecksumInformationForFileOnReplica(java.lang.String filename, java.lang.String checksum, Replica replica)
          Method for updating a specific entry in the replicafileinfo table.
 void updateChecksumStatus()
          Method for updating the status for the files for all the replicas.
 void updateChecksumStatus(java.lang.String filename)
          Method for updating the status for a specific file for all the replicas.
 

Method Detail

addChecksumInformation

void addChecksumInformation(java.util.List<java.lang.String> checksumOutput,
                            Replica replica)
Given the output of a checksum job, add the results to the database. NOTE: the Checksum version of Replica must be implemented with output in the same form as checksumJobOutput for implementation of bitArchive replicas

Parameters:
checksumOutput - The parsed output of a GetAllChecksumMessage as a list of ChecksumJob lines, i.e. filename##checksum.
replica - The replica this checksum job is for.

addFileListInformation

void addFileListInformation(java.util.List<java.lang.String> filelistOutput,
                            Replica replica)
Given the output of a file list job, add the results to the database. NOTE: the Checksum version of Replica must be implemented with output in the same form as filelistJobOutput for implementation of bitArchive replicas

Parameters:
filelistOutput - The list of filenames for the given replica.
replica - The replica this filelist job is for.

getMissingFilesInLastUpdate

java.lang.Iterable<java.lang.String> getMissingFilesInLastUpdate(Replica replica)
Return files with upload_status = COMPLETE for the replica, but the filelist_status = MISSING. This is done by querying the database for files with no or different update date from the last known update date for bitarchive, but which are present from admin data.

Parameters:
replica - The replica to check for.
Returns:
The list of missing files for a specific replica.

getWrongFilesInLastUpdate

java.lang.Iterable<java.lang.String> getWrongFilesInLastUpdate(Replica replica)
Return files with filelist_status CORRUPT for the replica, but not present in the last missing files job. This is done by querying the database for files with different checksum from the checksum in the last known update date for bitarchive, but which are present from admin data.

Parameters:
replica - The replica to check for.
Returns:
The list of wrong files for the replica in the last update.

getNumberOfMissingFilesInLastUpdate

long getNumberOfMissingFilesInLastUpdate(Replica replica)
Return the count of missing files for replica.

Parameters:
replica - The replica to get the count for.
Returns:
The count of missing files for a replica.

getNumberOfWrongFilesInLastUpdate

long getNumberOfWrongFilesInLastUpdate(Replica replica)
Return the count of corrupt files for replica.

Parameters:
replica - The replica to get the count for.
Returns:
The number of wrong files for a replica.

getNumberOfFiles

long getNumberOfFiles(Replica replica)
Returns the count of files in the replica which is not missing.

Parameters:
replica - The replica to have the files.
Returns:
The number of files, which does not have filelist_status = MISSING.

getDateOfLastMissingFilesUpdate

java.sql.Date getDateOfLastMissingFilesUpdate(Replica replica)
Get the date for the last file list job.

Parameters:
replica - The replica to get the date for.
Returns:
The date of the last missing files update for the replica.

getDateOfLastWrongFilesUpdate

java.sql.Date getDateOfLastWrongFilesUpdate(Replica replica)
Get the date for the last file list job.

Parameters:
replica - The replica to get the date for.
Returns:
The date of the last wrong file update for the replica.

getBitarchiveWithGoodFile

Replica getBitarchiveWithGoodFile(java.lang.String filename)
Method for retrieving a replica which has the file and the checksum_status = OK.

Parameters:
filename - The name of the file.
Returns:
A replica which contains the file, or null if no such replica can be found.

getBitarchiveWithGoodFile

Replica getBitarchiveWithGoodFile(java.lang.String filename,
                                  Replica badReplica)
Method for retrieving a replica which has the file and the checksum_status = OK.

Parameters:
filename - The name of the file.
badReplica - A replica which is known to contain a corrupt instance of this file.
Returns:
A replica which contains the file, or null if no such replica can be found.

updateChecksumStatus

void updateChecksumStatus()
Method for updating the status for the files for all the replicas. If the checksums of the archives differ for some replicas, then based on a checksum vote, a specific checksum is chosen as the 'correct' one, and the entries with another checksum that this 'correct' one will be marked as corrupt.


updateChecksumStatus

void updateChecksumStatus(java.lang.String filename)
Method for updating the status for a specific file for all the replicas. If the checksums for the replicas differ for some replica, then based on a checksum vote, a specific checksum is chosen as the 'correct' one, and the entries with another checksum than the 'correct one' will be marked as corrupt. If no winner of the voting is found, the all instances will be chosen to have 'UNKNOWN' checksum status.

Parameters:
filename - The name of the file to update the status for.

getReplicaFileInfo

ReplicaFileInfo getReplicaFileInfo(java.lang.String filename,
                                   Replica replica)
Method for retrieving the entry in the replicafileinfo table for a given file and replica.

Parameters:
filename - The name of the file for the entry.
replica - The replica of the entry.
Returns:
The replicafileinfo entry corresponding to the given filename and replica.

updateChecksumInformationForFileOnReplica

void updateChecksumInformationForFileOnReplica(java.lang.String filename,
                                               java.lang.String checksum,
                                               Replica replica)
Method for updating a specific entry in the replicafileinfo table.

Parameters:
filename - Name of the file.
checksum - The checksum of the file.
replica - The replica where the file exists.

cleanup

void cleanup()
Method for cleaning up when done.

Specified by:
cleanup in interface CleanupIF