com.ibm.di.fc.filetransferfc
Class FTPConnection

java.lang.Object
  extended by com.ibm.di.fc.filetransferfc.FTPConnection

public class FTPConnection
extends java.lang.Object

This class encapsulates the FTPClient APIs Connection related objects


Field Summary
static java.lang.String TYPE
          The connection protocol being used
 
Constructor Summary
FTPConnection()
           
 
Method Summary
 FTPClient beginSession()
          Begin a session with the target machine
 void createDir(java.lang.String dir)
          Create a directory on the target machine
 void endSession()
          End the session with the target machine
 FTPClient getFTPProtocol()
          Return the FTP Connection Object
 java.lang.String getType()
          Return this connection type
 void initializeProps(java.util.Properties p)
          Initialize the properties of the connection
 boolean isExists(java.lang.String source)
          Transfers the specified file to target location
 java.util.ArrayList<java.lang.String> list(java.lang.String path)
          Retrieves the list of files
 void receiveFile(java.lang.String source, java.lang.String target)
          Receive the specified file from target location to local machine
 void transferFile(java.lang.String source, java.lang.String target)
          Transfers the specified file to target location
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final java.lang.String TYPE
The connection protocol being used

See Also:
Constant Field Values
Constructor Detail

FTPConnection

public FTPConnection()
Method Detail

initializeProps

public void initializeProps(java.util.Properties p)
                     throws java.lang.Exception
Initialize the properties of the connection

Parameters:
p - Properties object containing the configurable connection attributes
Throws:
java.lang.Exception

beginSession

public FTPClient beginSession()
                       throws java.lang.Exception
Begin a session with the target machine

Returns:
FTPClient the FTP connection object connecting to the target
Throws:
java.lang.Exception

getType

public java.lang.String getType()
Return this connection type

Returns:
String The connection protocol used for this connection.

endSession

public void endSession()
End the session with the target machine


transferFile

public void transferFile(java.lang.String source,
                         java.lang.String target)
                  throws java.lang.Exception
Transfers the specified file to target location

Parameters:
source - Path to the source file
target - Path to where the file is to be stored on the target
Throws:
java.lang.Exception

receiveFile

public void receiveFile(java.lang.String source,
                        java.lang.String target)
                 throws java.lang.Exception
Receive the specified file from target location to local machine

Parameters:
source - Path of the source file
target - Path to where the file is to be stored on the local machine
Throws:
java.lang.Exception

isExists

public boolean isExists(java.lang.String source)
                 throws java.lang.Exception
Transfers the specified file to target location

Parameters:
source - Path to the file
Returns:
true if the file exists on the remote machine otherwise false
Throws:
java.lang.Exception

createDir

public void createDir(java.lang.String dir)
               throws java.lang.Exception
Create a directory on the target machine

Parameters:
dir - Path of the folder to be created
Throws:
java.lang.Exception - if the folder cannot be successfully created on the target

list

public java.util.ArrayList<java.lang.String> list(java.lang.String path)
                                           throws java.lang.Exception
Retrieves the list of files

Parameters:
path - path on the remote machine
Throws:
java.lang.Exception

getFTPProtocol

public FTPClient getFTPProtocol()
Return the FTP Connection Object

Returns:
FTP connection object accessing the target