com.ibm.di.fc.filetransferfc
Class FTPConnection

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

public class FTPConnection
extends Object

This class encapsulates the FTPClient APIs Connection related objects


Field Summary
static String TYPE
          The connection protocol being used
 
Constructor Summary
FTPConnection()
           
 
Method Summary
 FTPClient beginSession()
          Begin a session with the target machine
 void createDir(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
 String getType()
          Return this connection type
 void initializeProps(Properties p)
          Initialize the properties of the connection
 boolean isExists(String source)
          Transfers the specified file to target location
 ArrayList<String> list(String path)
          Retrieves the list of files
 void receiveFile(String source, String target)
          Receive the specified file from target location to local machine
 void transferFile(String source, 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 String TYPE
The connection protocol being used

See Also:
Constant Field Values
Constructor Detail

FTPConnection

public FTPConnection()
Method Detail

initializeProps

public void initializeProps(Properties p)
                     throws Exception
Initialize the properties of the connection

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

beginSession

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

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

getType

public 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(String source,
                         String target)
                  throws 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:
Exception

receiveFile

public void receiveFile(String source,
                        String target)
                 throws 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:
Exception

isExists

public boolean isExists(String source)
                 throws 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:
Exception

createDir

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

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

list

public ArrayList<String> list(String path)
                       throws Exception
Retrieves the list of files

Parameters:
path - path on the remote machine
Throws:
Exception

getFTPProtocol

public FTPClient getFTPProtocol()
Return the FTP Connection Object

Returns:
FTP connection object accessing the target