Class GetFileMessage
- java.lang.Object
-
- dk.netarkivet.common.distribute.NetarkivetMessage
-
- dk.netarkivet.archive.distribute.ArchiveMessage
-
- dk.netarkivet.archive.bitarchive.distribute.GetFileMessage
-
- All Implemented Interfaces:
Serializable
public class GetFileMessage extends ArchiveMessage
Message requesting a file from a bitarchive. Messages is forwarded through arcrepository, but reponds directly to sender.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
replyOfId
-
-
Constructor Summary
Constructors Constructor Description GetFileMessage(ChannelID to, ChannelID replyTo, String arcfileName, String replicaId)
Constructor for get file message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ArchiveMessageVisitor v)
Should be implemented as a part of the visitor pattern.void
clearBuffer()
Clear content buffer.String
getArcfileName()
Get name of the file to retrieve.void
getData(File toFile)
Writes the the content of the retrieved file into a local file.String
getReplicaId()
Retrieve the replica id.void
setFile(File data)
Set the file this message should return.String
toString()
Retrieval of a string representation of this instance.-
Methods inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
getErrMsg, getID, getReplyOfId, getReplyTo, getTo, hasBeenSent, isOk, setNotOk, setNotOk
-
-
-
-
Method Detail
-
setFile
public void setFile(File data)
Set the file this message should return. Note: This will make a remote file handle fopr the file.- Parameters:
data
- Content of the file to retrieve
-
getData
public void getData(File toFile) throws ArgumentNotValid, IOFailure
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 fileArgumentNotValid
- If the file is null.
-
getReplicaId
public String getReplicaId()
Retrieve the replica id.- Returns:
- replica id
-
getArcfileName
public String getArcfileName()
Get name of the file to retrieve.- Returns:
- file name
-
clearBuffer
public void clearBuffer()
Clear content buffer.
-
accept
public void accept(ArchiveMessageVisitor v)
Should be implemented as a part of the visitor pattern. fx.: public void accept(ArchiveMessageVisitor v) { v.visit(this); }- Specified by:
accept
in classArchiveMessage
- Parameters:
v
- A message visitor- See Also:
ArchiveMessageVisitor
-
toString
public String toString()
Retrieval of a string representation of this instance.- Overrides:
toString
in classNetarkivetMessage
- Returns:
- The string representing this instance.
- See Also:
NetarkivetMessage.toString()
-
-