dk.netarkivet.archive.checksum.distribute
Class CorrectMessage

java.lang.Object
  extended by dk.netarkivet.common.distribute.NetarkivetMessage
      extended by dk.netarkivet.archive.distribute.ArchiveMessage
          extended by dk.netarkivet.archive.checksum.distribute.CorrectMessage
All Implemented Interfaces:
java.io.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
    CorrectMessage(ChannelID to, ChannelID replyTo, java.lang.String badChecksum, RemoteFile file)
              Constructor.
     
    Method Summary
     void accept(ArchiveMessageVisitor v)
              Accept this message.
     java.lang.String getArcfileName()
              Retrieve name of the uploaded file.
     java.lang.String getChecksum()
              Method for retrieving the 'bad' checksum which should correspond to the checksum of the current entry on this file in the archive.
     void getData(java.io.File toFile)
              Writes the the content of the retrieved file into a local 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

    CorrectMessage

    public CorrectMessage(ChannelID to,
                          ChannelID replyTo,
                          java.lang.String badChecksum,
                          RemoteFile file)
    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.
    file - The file to replace the 'bad' entry.
    Method Detail

    getArcfileName

    public java.lang.String getArcfileName()
    Retrieve name of the uploaded file.

    Returns:
    current value of arcfileName

    getData

    public void getData(java.io.File toFile)
    Writes the the content of the retrieved file into a 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 file

    getChecksum

    public java.lang.String getChecksum()
    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.

    accept

    public void accept(ArchiveMessageVisitor v)
    Accept this message.

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

    toString

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

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