4122 |
22 Sep 16 |
nicklas |
1 |
package net.sf.basedb.opengrid.filetransfer; |
4122 |
22 Sep 16 |
nicklas |
2 |
|
4122 |
22 Sep 16 |
nicklas |
3 |
import java.io.IOException; |
4122 |
22 Sep 16 |
nicklas |
4 |
import java.io.OutputStream; |
4122 |
22 Sep 16 |
nicklas |
5 |
|
4301 |
13 Jan 17 |
nicklas |
6 |
import net.sf.basedb.opengrid.AbstractSession; |
4301 |
13 Jan 17 |
nicklas |
7 |
|
4122 |
22 Sep 16 |
nicklas |
8 |
/** |
4301 |
13 Jan 17 |
nicklas |
Represents a local file or resource that is the target for |
4301 |
13 Jan 17 |
nicklas |
a file that is about to be downloaded from a remote server. |
4301 |
13 Jan 17 |
nicklas |
The download is initiated by calling |
4301 |
13 Jan 17 |
nicklas |
{@link AbstractSession#downloadFile(String, DownloadTarget)} |
4301 |
13 Jan 17 |
nicklas |
which will call {@link #getMetadata()} first and populate this |
4301 |
13 Jan 17 |
nicklas |
with as much information as it can get from the remote server. |
4301 |
13 Jan 17 |
nicklas |
Then, the {@link #getOutputStream()} is called and the file |
4301 |
13 Jan 17 |
nicklas |
data is written to the returned stream. |
4122 |
22 Sep 16 |
nicklas |
17 |
|
4122 |
22 Sep 16 |
nicklas |
@author nicklas |
4122 |
22 Sep 16 |
nicklas |
@since 1.0 |
4122 |
22 Sep 16 |
nicklas |
20 |
*/ |
4122 |
22 Sep 16 |
nicklas |
21 |
public interface DownloadTarget |
4122 |
22 Sep 16 |
nicklas |
22 |
{ |
4122 |
22 Sep 16 |
nicklas |
23 |
/** |
4122 |
22 Sep 16 |
nicklas |
The name of the local resource. |
4122 |
22 Sep 16 |
nicklas |
25 |
*/ |
4122 |
22 Sep 16 |
nicklas |
26 |
public String getName(); |
4122 |
22 Sep 16 |
nicklas |
27 |
|
4122 |
22 Sep 16 |
nicklas |
28 |
/** |
4122 |
22 Sep 16 |
nicklas |
Get an ouput stream for writing the file data to the |
4122 |
22 Sep 16 |
nicklas |
local resource. |
4122 |
22 Sep 16 |
nicklas |
31 |
*/ |
4122 |
22 Sep 16 |
nicklas |
32 |
public OutputStream getOutputStream() |
4122 |
22 Sep 16 |
nicklas |
33 |
throws IOException; |
4122 |
22 Sep 16 |
nicklas |
34 |
|
4122 |
22 Sep 16 |
nicklas |
35 |
/** |
4124 |
23 Sep 16 |
nicklas |
Get a metadata instance for collecting information |
4124 |
23 Sep 16 |
nicklas |
about the remote file. The metadata will be populated |
4124 |
23 Sep 16 |
nicklas |
before the download is started. |
4124 |
23 Sep 16 |
nicklas |
@return A metadata instance or null if not important |
4122 |
22 Sep 16 |
nicklas |
40 |
*/ |
4124 |
23 Sep 16 |
nicklas |
41 |
public FileMetaData getMetadata(); |
4124 |
23 Sep 16 |
nicklas |
42 |
|
4122 |
22 Sep 16 |
nicklas |
43 |
} |