dk.netarkivet.archive.checksum.distribute
Class GetAllChecksumsMessage

java.lang.Object
  extended by dk.netarkivet.common.distribute.NetarkivetMessage
      extended by dk.netarkivet.archive.distribute.ArchiveMessage
          extended by dk.netarkivet.archive.checksum.distribute.GetAllChecksumsMessage
All Implemented Interfaces:
java.io.Serializable

public class GetAllChecksumsMessage
extends ArchiveMessage

The GetChecksumMessage has the purpose to retrieve the checksum of all the files. The output is in the form of a file corresponding to the reply file of a ChecksumJob. This is checksum replica alternative to sending a ChecksumBatchJob.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
replyOfId
 
Constructor Summary
GetAllChecksumsMessage(ChannelID to, ChannelID replyTo, java.lang.String repId)
          Constructor.
 
Method Summary
 void accept(ArchiveMessageVisitor v)
          Accept visitation.
 void getData(java.io.File toFile)
          Method for retrieving the resulting file.
 java.lang.String getReplicaId()
          Method for retrieving the id for the replica where this message should be sent.
 void setFile(java.io.File file)
          Method for setting the resulting file.
 java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GetAllChecksumsMessage

public GetAllChecksumsMessage(ChannelID to,
                              ChannelID replyTo,
                              java.lang.String repId)
Constructor.

Parameters:
to - Where this message is headed.
replyTo - Where the reply on this message is sent.
repId - The replica where the job involved in this message is to be performed.
Method Detail

setFile

public void setFile(java.io.File file)
             throws ArgumentNotValid
Method for setting the resulting file. This file will be retrieved from the caller of this message. This should be a movable instance since the temporary file should be removed after is has been retrieved. TODO cleanup if remoteFile already has been set.

Parameters:
file - The file with the checksum message.
Throws:
ArgumentNotValid - If file is null.

getData

public void getData(java.io.File toFile)
             throws IOFailure,
                    ArgumentNotValid
Method for retrieving the resulting file. This method can only be called once, since the remoteFile is cleaned up and set to null.

Parameters:
toFile - The file for the remotely retrieved content.
Throws:
IOFailure - If the data in the remoteFile already has be retrieved.
ArgumentNotValid - If toFile is null.

getReplicaId

public java.lang.String getReplicaId()
Method for retrieving the id for the replica where this message should be sent.

Returns:
The id for the replica.

toString

public java.lang.String toString()
Generate String representation of this object.

Overrides:
toString in class NetarkivetMessage
Returns:
String representation of this object

accept

public void accept(ArchiveMessageVisitor v)
Accept visitation.

Specified by:
accept in class ArchiveMessage
Parameters:
v - The ArchiveMessageVisitor which accepts this message.
See Also:
ArchiveMessageVisitor