Package com.ibm.di.fc.filetransferfc
Class FTPConnection
- java.lang.Object
-
- com.ibm.di.fc.filetransferfc.FTPConnection
-
public class FTPConnection extends java.lang.Object
This class encapsulates the FTPClient APIs Connection related objects
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TYPE
The connection protocol being used
-
Constructor Summary
Constructors Constructor Description FTPConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FTPClient
beginSession()
Begin a session with the target machinevoid
createDir(java.lang.String dir)
Create a directory on the target machinevoid
endSession()
End the session with the target machineFTPClient
getFTPProtocol()
Return the FTP Connection Objectjava.lang.String
getType()
Return this connection typevoid
initializeProps(java.util.Properties p)
Initialize the properties of the connectionboolean
isExists(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 filesvoid
receiveFile(java.lang.String source, java.lang.String target)
Receive the specified file from target location to local machinevoid
transferFile(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.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 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.Exception
Receive 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.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
-
-