dk.netarkivet.common.distribute
Interface RemoteFile

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbstractRemoteFile, FTPRemoteFile, HTTPRemoteFile, HTTPSRemoteFile, NullRemoteFile

public interface RemoteFile
extends java.io.Serializable

RemoteFile: Interface for encapsulating remote files. Enables us to transmit large files between system components situated on different machines. Our current JMS broker(s) does not allow large message (i.e. messages > 70 MB).


Method Summary
 void appendTo(java.io.OutputStream out)
          Write the contents of this remote file to an output stream.
 void cleanup()
          Cleanup this remote file.
 void copyTo(java.io.File destFile)
          Copy remotefile to local disk storage.
 java.lang.String getChecksum()
          Returns a MD5 Checksum on the file.
 java.io.InputStream getInputStream()
          Get an inputstream that contains the data transferred in this RemoteFile.
 java.lang.String getName()
          Return the file name.
 long getSize()
          Returns the total size of the remote file.
 

Method Detail

copyTo

void copyTo(java.io.File destFile)
Copy remotefile to local disk storage. Used by the data recipient

Parameters:
destFile - local File
Throws:
IOFailure - on communication trouble.
ArgumentNotValid - on null parameter or non-writable file

appendTo

void appendTo(java.io.OutputStream out)
Write the contents of this remote file to an output stream.

Parameters:
out - OutputStream that the data will be written to. This stream will not be closed by this operation.
Throws:
IOFailure - If append operation fails
ArgumentNotValid - on null parameter

getInputStream

java.io.InputStream getInputStream()
Get an inputstream that contains the data transferred in this RemoteFile.

Returns:
A stream object with the data in the object. Note that the close() method of this may throw exceptions if e.g. a transmission error is detected.
Throws:
IOFailure - on communication trouble.

getName

java.lang.String getName()
Return the file name.

Returns:
the file name

getChecksum

java.lang.String getChecksum()
Returns a MD5 Checksum on the file. May return null, if checksums not supported for this operation.

Returns:
MD5 checksum

cleanup

void cleanup()
Cleanup this remote file. The file is invalid after this.


getSize

long getSize()
Returns the total size of the remote file.

Returns:
Size of the remote file.