public class DatabasePreservationState extends Object implements PreservationState
Constructor and Description |
---|
DatabasePreservationState(String fileName,
List<ReplicaFileInfo> rfis)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
fileIsMissing(Replica replica)
Check if the file is missing from a replica.
|
String |
getAdminChecksum()
Get the MD5 checksum stored in the admin data.
|
String |
getAdminReplicaState(Replica replica)
Get the status of the file in a replica, according to the admin data.
|
String |
getFilename()
Get the filename, this FilePreservationState is about.
|
Replica |
getReferenceBitarchive()
Returns a reference to a replica that contains a version of the file with the correct checksum.
|
String |
getReferenceCheckSum()
THIS IS VOTING! Retrieve checksum that the majority of checksum references replicas agree upon.
|
List<String> |
getReplicaChecksum(Replica replica)
Get the checksum of this file in a specific replica.
|
String |
getUniqueChecksum(Replica replica)
Get a checksum that the whole replica agrees upon, or else "".
|
boolean |
isAdminCheckSumOk()
Returns true if the checksum reported by admin data is equal to the majority checksum.
|
boolean |
isAdminDataOk()
INHERITED DUMMY FUNCTION!
|
String |
toString()
Returns a human-readable representation of this object.
|
public DatabasePreservationState(String fileName, List<ReplicaFileInfo> rfis) throws ArgumentNotValid
fileName
- The name of the file.rfis
- A list of the ReplicaFileInfo entries in the database for the given file.ArgumentNotValid
- If the filename is null or the empty string, or if the list of ReplicaFileInfos are null
or empty.public List<String> getReplicaChecksum(Replica replica) throws ArgumentNotValid
getReplicaChecksum
in interface PreservationState
replica
- The replica to get the checksum from.ArgumentNotValid
- If the replica is null.public String getAdminChecksum()
getAdminChecksum
in interface PreservationState
public String getAdminReplicaState(Replica replica) throws ArgumentNotValid
getAdminReplicaState
in interface PreservationState
replica
- The replica to get status forArgumentNotValid
- If the replica is null.public boolean isAdminDataOk()
isAdminDataOk
in interface PreservationState
public Replica getReferenceBitarchive()
The correct checksum is defined as the checksum that the majority of the replica and admin data agree upon.
If no replica exists with a correct version of the file null is returned.
getReferenceBitarchive
in interface PreservationState
public String getUniqueChecksum(Replica replica) throws ArgumentNotValid
getUniqueChecksum
in interface PreservationState
replica
- A replica to get checksum for this file fromArgumentNotValid
- If the replica is null.public boolean fileIsMissing(Replica replica) throws ArgumentNotValid
fileIsMissing
in interface PreservationState
replica
- the replica to checkArgumentNotValid
- If the replica is null.public String getReferenceCheckSum()
TODO Voting is already done by the DatabasedActiveBitPreservation. Thus replace with finding an entry with checksum-status = OK.
getReferenceCheckSum
in interface PreservationState
public boolean isAdminCheckSumOk()
isAdminCheckSumOk
in interface PreservationState
public String toString()
toString
in interface PreservationState
toString
in class Object
public String getFilename()
getFilename
in interface PreservationState
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.