Class CorrectMessage
- java.lang.Object
-
- dk.netarkivet.common.distribute.NetarkivetMessage
-
- dk.netarkivet.archive.distribute.ArchiveMessage
-
- dk.netarkivet.archive.checksum.distribute.CorrectMessage
-
- All Implemented Interfaces:
Serializable
public class CorrectMessage extends ArchiveMessage
The message to correct a bad entry in an archive.- In a bitarchive it should replace a corrupted file.
- In a checksum archive it should replace checksum entry of the file.
The message contains the checksum of the 'bad' entry in the archive, which is only corrected if it actually has this 'bad checksum'.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
replyOfId
-
-
Constructor Summary
Constructors Constructor Description CorrectMessage(ChannelID to, ChannelID replyTo, String badChecksum, RemoteFile rf, String repId, String cred)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ArchiveMessageVisitor v)
Accept this message.String
getArcfileName()
Retrieve name of the uploaded file.RemoteFile
getCorrectFile()
Method for retrieving the correct file.String
getCredentials()
The credentials to allow correction of an entry in the archive.void
getData(File toFile)
Retrieves the content of the remoteFile and writes it into the local file.String
getIncorrectChecksum()
Method for retrieving the 'bad' checksum which should correspond to the checksum of the current entry on this file in the archive.RemoteFile
getRemovedFile()
Returns the removed file.String
getReplicaId()
Method for retrieving the replica, where this message should be sent.void
setRemovedFile(RemoteFile rf)
Sets the removed file.String
toString()
Generate String representation of this object.-
Methods inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
getErrMsg, getID, getReplyOfId, getReplyTo, getTo, hasBeenSent, isOk, setNotOk, setNotOk
-
-
-
-
Constructor Detail
-
CorrectMessage
public CorrectMessage(ChannelID to, ChannelID replyTo, String badChecksum, RemoteFile rf, String repId, String cred) throws ArgumentNotValid
Constructor. Initializes the variables.- Parameters:
to
- Where the message should be sent.replyTo
- Who is sending this message.badChecksum
- The checksum of the 'bad' entry.rf
- The remote file to replace the 'bad' entry.repId
- The identification of the replica, where this message should be sent.cred
- The credentials to allow the correction of an entry.- Throws:
ArgumentNotValid
- If any of the arguments are null, or any of the strings are empty.
-
-
Method Detail
-
getArcfileName
public String getArcfileName()
Retrieve name of the uploaded file.- Returns:
- current value of arcfileName
-
getData
public void getData(File toFile) throws IOFailure, ArgumentNotValid
Retrieves the content of the remoteFile and writes it into the local file. Note: This is transferred through a remote file handle, and then the handle is invalidated. This method may only be called once.- Parameters:
toFile
- where to write the content- Throws:
IOFailure
- on error reading the remote file or writing the local fileArgumentNotValid
- If toFile is null.
-
getCorrectFile
public RemoteFile getCorrectFile()
Method for retrieving the correct file.- Returns:
- The RemoteFile for the correct file.
-
getIncorrectChecksum
public String getIncorrectChecksum()
Method for retrieving the 'bad' checksum which should correspond to the checksum of the current entry on this file in the archive.- Returns:
- The checksum for the archive entry.
-
getReplicaId
public String getReplicaId()
Method for retrieving the replica, where this message should be sent.- Returns:
- The id of the replica where this message should be sent.
-
getCredentials
public String getCredentials()
The credentials to allow correction of an entry in the archive.- Returns:
- The credentials.
-
getRemovedFile
public RemoteFile getRemovedFile() throws IOFailure
Returns the removed file.- Returns:
- The removed file.
- Throws:
IOFailure
- If the removed file is null.
-
setRemovedFile
public void setRemovedFile(RemoteFile rf) throws ArgumentNotValid
Sets the removed file. This is the file which are returned to the sender of the message.- Parameters:
rf
- The removed file which is part of the reply of this message.- Throws:
ArgumentNotValid
- If the remote file is null.
-
accept
public void accept(ArchiveMessageVisitor v)
Accept this message.- Specified by:
accept
in classArchiveMessage
- Parameters:
v
- The message visitor accepting this message.- See Also:
ArchiveMessageVisitor
-
toString
public String toString()
Generate String representation of this object.- Overrides:
toString
in classNetarkivetMessage
- Returns:
- String representation of this object
-
-