public class FilePreservationState extends Object implements PreservationState
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 bitarchive replica that contains a version of the file with the correct checksum.
|
String |
getReferenceCheckSum()
Retrieve checksum that the majority of checksum references (replicas+admin) agree upon.
|
List<String> |
getReplicaChecksum(Replica replica)
Get the checksum of this file in a specific replica.
|
String |
getUniqueChecksum(Replica r)
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()
Check if the admin data reflect the actual status of the archive.
|
String |
toString()
Returns a human-readable representation of this object.
|
public List<String> getReplicaChecksum(Replica replica)
getReplicaChecksum
in interface PreservationState
replica
- The replica to get the checksum from.public String getAdminChecksum()
getAdminChecksum
in interface PreservationState
public String getAdminReplicaState(Replica replica)
getAdminReplicaState
in interface PreservationState
replica
- The replica to get status forpublic boolean isAdminDataOk()
Admin State checking: For each replica the admin state is compared to the checksum received from the replica.
If no checksum is received from the replica the valid admin states are UPLOAD_STARTED and UPLOAD_FAILED. If a checksum is received from the replica the valid admin state is UPLOAD_COMPLETED Admin checksum checking: The admin checksum must match the majority of reported checksums.
Notice that a valid Admin data record does NOT imply that everything is ok. Specifically a file may be missing from a replica, or the checksum of a file in a replica may be wrong.
isAdminDataOk
in interface PreservationState
public boolean fileIsMissing(Replica replica)
fileIsMissing
in interface PreservationState
replica
- the replica to check.public Replica getReferenceBitarchive()
The correct checksum is defined as the checksum that the majority of the replicas and admin data agree upon.
If no bitarchive replica exists with a correct version of the file null is returned.
getReferenceBitarchive
in interface PreservationState
public String getUniqueChecksum(Replica r)
getUniqueChecksum
in interface PreservationState
r
- A replica to get checksum for this file frompublic String getReferenceCheckSum()
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–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.