Package com.ibm.di.fc.filetransferfc
Class FTPConnection
- java.lang.Object
-
- com.ibm.di.fc.filetransferfc.FTPConnection
-
public class FTPConnection extends java.lang.ObjectThis class encapsulates the FTPClient APIs Connection related objects
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTYPEThe connection protocol being used
-
Constructor Summary
Constructors Constructor Description FTPConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FTPClientbeginSession()Begin a session with the target machinevoidcreateDir(java.lang.String dir)Create a directory on the target machinevoidendSession()End the session with the target machineFTPClientgetFTPProtocol()Return the FTP Connection Objectjava.lang.StringgetType()Return this connection typevoidinitializeProps(java.util.Properties p)Initialize the properties of the connectionbooleanisExists(java.lang.String source)Transfers the specified file to target locationjava.util.ArrayList<java.lang.String>list(java.lang.String path)Retrieves the list of filesvoidreceiveFile(java.lang.String source, java.lang.String target)Receive the specified file from target location to local machinevoidtransferFile(java.lang.String source, java.lang.String target)Transfers the specified file to target location
-
-
-
Field Detail
-
TYPE
public static final java.lang.String TYPE
The connection protocol being used- See Also:
- Constant Field Values
-
-
Method Detail
-
initializeProps
public void initializeProps(java.util.Properties p) throws java.lang.ExceptionInitialize 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.ExceptionTransfers the specified file to target location- Parameters:
source- Path to the source filetarget- 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.ExceptionReceive the specified file from target location to local machine- Parameters:
source- Path of the source filetarget- 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.ExceptionTransfers 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.ExceptionCreate 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.ExceptionRetrieves 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
-
-