org.nees.util.grid
Class FTPFacade

java.lang.Object
  extended byorg.nees.util.TransferFacade
      extended byorg.nees.util.grid.FTPFacade
Direct Known Subclasses:
GridFTPFacade

public class FTPFacade
extends TransferFacade


Field Summary
protected  java.lang.String _password
           
protected  java.lang.String _userID
           
protected  java.lang.String host
           
protected  int port
           
 
Constructor Summary
FTPFacade(java.lang.String host, int port)
           
FTPFacade(java.lang.String h, java.lang.String userID, java.lang.String password, int p)
          Create a facade for the given FTP server, with the default credential.
 
Method Summary
 void append(java.io.File localFragment, java.lang.String remoteFile)
          Get a client, authenticate, append to a file on the server, and close the client.
 void append(java.io.File localFragment, java.lang.String remoteDir, java.lang.String remoteFile)
          Get a client, authenticate, append to a file on the server, and close the client.
 void append(java.io.File localFragment, java.net.URI remoteURI)
           
 void get(java.lang.String remoteFile, java.io.File localFile)
          Get a client, authenticate, get a file, and close the client.
 void get(java.lang.String remoteDir, java.lang.String remoteFile, java.io.File localFile)
          Get a client, authenticate, get a file, and close the client.
 void get(java.net.URI remoteURI, java.io.File localFile)
           
 org.globus.ftp.FTPClient getClient()
          Get a client authenticated to this server.
 void put(java.io.File localFile, java.lang.String remoteFile)
          Get a client, authenticate, put a file to the server, and close the client.
 void put(java.io.File localFile, java.lang.String remoteDir, java.lang.String remoteFile)
          Get a client, authenticate, put a file to the server, and close the client.
 void put(java.io.File localFile, java.net.URI remoteURI)
          Get a client, authenticate, append to a file on the server, and close the client.
 void setASCIITransferType()
          Set transfer type to ASCII
 void setBinaryTransferType()
          Set transfer type to binary ("IMAGE");
 void setTransferType(int tt)
          Set the transfer type (e.g., ascii, binary).
 
Methods inherited from class org.nees.util.TransferFacade
splitPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

host

protected java.lang.String host

_userID

protected java.lang.String _userID

_password

protected java.lang.String _password

port

protected int port
Constructor Detail

FTPFacade

public FTPFacade(java.lang.String h,
                 java.lang.String userID,
                 java.lang.String password,
                 int p)
          throws java.lang.Exception
Create a facade for the given FTP server, with the default credential.

Parameters:
h - the server host
p - the server port

FTPFacade

public FTPFacade(java.lang.String host,
                 int port)
          throws java.lang.Exception
Method Detail

setTransferType

public void setTransferType(int tt)
Set the transfer type (e.g., ascii, binary). Value must be one of the constants from org.globus.ftp.Session

Parameters:
tt - the transfer type

setASCIITransferType

public void setASCIITransferType()
Set transfer type to ASCII


setBinaryTransferType

public void setBinaryTransferType()
Set transfer type to binary ("IMAGE");


getClient

public org.globus.ftp.FTPClient getClient()
                                   throws java.lang.Exception
Get a client authenticated to this server.

Throws:
java.lang.Exception

put

public void put(java.io.File localFile,
                java.lang.String remoteDir,
                java.lang.String remoteFile)
         throws java.lang.Exception
Get a client, authenticate, put a file to the server, and close the client.

Specified by:
put in class TransferFacade
Parameters:
localFile - the file to put
remoteDir - the remote directory
remoteFile - the remote file name
Throws:
java.lang.Exception

put

public void put(java.io.File localFile,
                java.lang.String remoteFile)
         throws java.lang.Exception
Get a client, authenticate, put a file to the server, and close the client. The file will be put in the default directory for the user on the server.

Specified by:
put in class TransferFacade
Parameters:
localFile - the file to put
remoteFile - the remote file name
Throws:
java.lang.Exception

append

public void append(java.io.File localFragment,
                   java.lang.String remoteDir,
                   java.lang.String remoteFile)
            throws java.lang.Exception
Get a client, authenticate, append to a file on the server, and close the client.

Specified by:
append in class TransferFacade
Parameters:
localFragment - the file fragment to append
remoteDir - the remote directory
remoteFile - the remote file name
Throws:
java.lang.Exception

append

public void append(java.io.File localFragment,
                   java.lang.String remoteFile)
            throws java.lang.Exception
Get a client, authenticate, append to a file on the server, and close the client.

Specified by:
append in class TransferFacade
Parameters:
localFragment - the file fragment to append
remoteFile - the remote file name
Throws:
java.lang.Exception

append

public void append(java.io.File localFragment,
                   java.net.URI remoteURI)
            throws java.lang.Exception
Specified by:
append in class TransferFacade
Throws:
java.lang.Exception

get

public void get(java.net.URI remoteURI,
                java.io.File localFile)
         throws java.lang.Exception
Specified by:
get in class TransferFacade
Throws:
java.lang.Exception

put

public void put(java.io.File localFile,
                java.net.URI remoteURI)
         throws java.lang.Exception
Description copied from class: TransferFacade
Get a client, authenticate, append to a file on the server, and close the client.

Specified by:
put in class TransferFacade
Throws:
java.lang.Exception

get

public void get(java.lang.String remoteDir,
                java.lang.String remoteFile,
                java.io.File localFile)
         throws java.lang.Exception
Get a client, authenticate, get a file, and close the client.

Specified by:
get in class TransferFacade
Parameters:
remoteDir - the remote directory
localFile - the file to store the results in
Throws:
java.lang.Exception

get

public void get(java.lang.String remoteFile,
                java.io.File localFile)
         throws java.lang.Exception
Get a client, authenticate, get a file, and close the client. The file will be retrieved from the user's default directory on the server.

Specified by:
get in class TransferFacade
Parameters:
localFile - the file to store the results in
Throws:
java.lang.Exception