Class MyGridFTP

java.lang.Object
  |
  +--MyGridFTP

public class MyGridFTP
extends java.lang.Object

Sample Java class to perform a transfer.

Example usage is: (to transfer a file in parallel to a remote computer)

MyGridFTP grid = new MyGridFTP("hawk01.mcs.surrey.ac.uk", 2811, "/tmp/x509up_u28008");

String rf1 = "/grid/users/tugba/TestGridFile";

String lf1 = "/user/csckmst/css1tt/gt3/samples/TestGridFile";

int TRANSFER_TYPE = GridFTPSession.TYPE_ASCII;

myGridFTP1.parallelTransfer(rf1,lf1);

myGridFTP1.close();


Field Summary
static int GRIDFTP_PORT
           
 
Constructor Summary
MyGridFTP(java.lang.String host, int port, java.lang.String credentialFile)
          Initiate GRIDFTP session
 
Method Summary
 void close()
          Cleanup FTP connection & certs
 void download(java.lang.String remoteFile, java.lang.String localFile, int transferType)
          Download a file from a remote host
static void main(java.lang.String[] args)
          testing GridFTP class
 void markerArrived(Marker m)
           
 void parallelDownload(java.lang.String remoteFile, java.lang.String localFile)
          Download a file in parallel.
 void parallelTransfer(java.lang.String remoteFile, java.lang.String localfile)
          Transfer a local file to the remote host in parallel
 void transfer(java.lang.String remoteFile, java.lang.String localfile)
          Transfer a local file to the remote host
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRIDFTP_PORT

public static int GRIDFTP_PORT
Constructor Detail

MyGridFTP

public MyGridFTP(java.lang.String host,
                 int port,
                 java.lang.String credentialFile)
Initiate GRIDFTP session

Parameters:
host - remote GRIDFTP host
port - remote GridFTP port (default is 2811)
credentialFile - The user's credential file e.g. /tmp/x509up_u28008. This value can be obtained as follows:

cd /tmp

ls -al

find your file associated with your login name e.g.:

-rw------- 1 css1tt csstaff 2203 Feb 13 10:32 x509up_u28008

Use this file name in your credentialFile

Method Detail

transfer

public void transfer(java.lang.String remoteFile,
                     java.lang.String localfile)
Transfer a local file to the remote host

Parameters:
remoteFile - Remote host file
localfile - The file which will be transferred

parallelTransfer

public void parallelTransfer(java.lang.String remoteFile,
                             java.lang.String localfile)
Transfer a local file to the remote host in parallel

Parameters:
remoteFile - Remote host file
localfile - The file which will be transferred

markerArrived

public void markerArrived(Marker m)

download

public void download(java.lang.String remoteFile,
                     java.lang.String localFile,
                     int transferType)
Download a file from a remote host

Parameters:
remoteFile - Remote host file must exist
localFile - Whre should the remote file be stored

parallelDownload

public void parallelDownload(java.lang.String remoteFile,
                             java.lang.String localFile)
Download a file in parallel. Requires transfer type IMAGE & transfer mode EBLOCK Opens 2 parallel trasfer streams to the same remote file


close

public void close()
Cleanup FTP connection & certs


main

public static void main(java.lang.String[] args)
testing GridFTP class