|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FTPClient
FTPClient interface models an FTP client that can connect to an FTP server. FTPClient exposes the command defined in the FTP specification (RFC 959 and QUOTE command from RFC 1123, AUTH from RFC 2228). The FTP specification is available at:
http://www.ietf.org/rfc/rfc0959.txt?number=959
QUOTE command is defined in section 4.1.4.2 of the following RFC specification:
http://www.ietf.org/rfc/rfc1123.txt?number=1123
Only the commands specified in RFC959 can be passed in QUOTE.
FTPClient can operate either in secure mode or in unsecure mode.
When secure mode is selected, both the control and data connection are secured
so that no one can snoop on the transmission. Secure mode is
enabled by calling setSecureMode(boolean)
, setting the SSL Certificate Name
in the Credentials tab of the trading partner, and specifying the Certificate Name
as the argument to setSSLCertificate(java.lang.String)
. If the secure FTP server supports
Client Authorization, users set the Host Private Key Name as specified in the Credentials tab of the
host and invoke setSSLHostKey(java.lang.String)
providing the Key Name as the argument.
Users of this interface will be given an FTPClient object through the Job variable. One can get this object inside EcmaScript or JavaScript as shown below:
var ftpClient = job.get("ftpObj"); ftpClient.connect(); Your logic ... ftpClient.disconnect();
This ftpClient object is available only during the duration of the script and is not a serializable or persistent object. Once the ftpClient object is obtained, users can call any of the methods described in the interface below if they have not configured for file transfer through an http proxy server. All the commands are supported if the connection is configured with a non-http proxy (e.g. socks4 or socks5).
If the configuration is set to send FTP using HTTP proxy server, only the following commands are allowed:
getUsername()
, getPassword()
, getHost()
, getPort()
,
connect()
, disconnect()
, useProxyServer()
, executeTypeCmd(java.lang.String)
,
executeGetCmd(java.lang.String)
and executePutCmd(java.lang.String)
Apart from the ftpObj job variable, there are few variables to get information relating to local directories, filenames, trading partner, and trading host name.
The variables that are available for the FTP transport configured in trading partner outbound transports (FTP outbound) are: To get the directory of the file (in cases where the payload is referenced by a file) located in the local directory, you can use
To get the filename (in cases where the payload is referenced by a file) located in the local directory, you can usevar srcPath = job.get("srcFilePath");
To get the data object, which is not referenced by a filenamevar srcFile = job.get("srcFileName");
To get the trading partner namevar dataObject = job.get("dataObj");
To get the trading host namevar tpName = job.get("tpName");
var hostName = job.get("hostName");
The variables that are available for the FTP inbound transport configured in business agreements (FTP inbound) are: To get the temporary directory, where the file(s) will be downloaded from the FTP server, you can use
To get the trading partner namevar getTmpDir = job.get("getTmpDir");
To get the trading host namevar tpName = job.get("tpName");
var hostName = job.get("hostName");
PGP Handling is also supported in FTP script, when it is nither SSL (FTPS) nor SSH FTP session.
To get the PGP handler for outbound FTP (FTP PUT), an instance of interface IOBScriptPGPHandler
,
and set the PGP process options:
You can also set the compression algorithm as well as the format of the resulting PGP package:var obPGPHandler = job.get("obPGPHandler"); var sign = ... var encrypt = ... var compress = ... //sign, encrypt and compress are boolean values (true or false); obPGPHandler.setPGPOptions(sign, encrypt, compress);
Finally package the payload using PGP:obPGPHandler.setCompressionAlgo("ZLIB"); //"ZLIB" or "ZIP" obPGPHandler.setFormat("armored"); //"armored" or "binary"
All these PGP settings in FTP script overwrite the configuration in trading partner outbound transports (FTP outbound). The PGP keys used for PGP processing in FTP outbound are configured in business agreements's Document Exchange.obPGPHandler.packageMessage();
To get the PGP Handler for FTP inbound (FTP GET), an instance of interface IIBScriptPGPHandler
,
and set the inbound PGP processing policy:
You might also need to set the operaton id for audit log of PGP processing.var ibPGPHandler = job.get("ibPGPHandler"); var policy = ... //options: "None", "Must Encrypt", "Must Sign", "Must Sign and Encrypt", "Pass-through" ibPGPHandler.setPGPPolicy(policy);
Finally unpackage the received file:ibPGPHandler.setOperationID(...);
The "reply" is a FTPReply instance returned back from FTP Get operation (such asvar tmpDir = job.get("getTmpDir"); var filename = reply.getFileName(); var filefullname = tmpDir + fileName; ibPGPHandler.unpackageMessage(filefullname);
executeGetCmd(java.lang.String)
).
After the PGP processing, the unpackaged payload is consumed by BusinessConnect inbound process, just like the payloads from other transports.
Field Summary | |
---|---|
static int |
ACTIVE_MODE
FTP active mode to be set so that FTP client can listen on a port and send the ip and port information through the use of PORT FTP command |
static java.lang.String |
ALL_FILE_LIST
Optional, it can be used by business protocols during post processing messages. |
static java.lang.String |
COMMON_ALL_FILE_LIST
Optional, it can be used by business protocols during post processing messages. |
static java.lang.String |
DATA_OBJ
If the payload exists in memory and therefore it is not referenced by a filename, this slot holds the object, which can be retrieved through the method get("dataObj"). |
static int |
DEFAULT_FTP_PORT
|
static java.lang.String |
DELETE_FILE
Currently not used. |
static java.lang.String |
DOCUMENT_ID
The document ID of the message. |
static java.lang.String |
FTP_OBJ
The name of the slot, which returns the ftp client itself. |
static int |
FTP_STATUS_ERROR
Generic failure, possibly due to unknown reasons. |
static int |
FTP_STATUS_OK
Generic successful completion. |
static java.lang.String |
HOSTNAME
The host name |
static java.lang.String |
IBPGP_HANDLER
The Inbound PGPHandler name |
static java.lang.String |
INPUT_SOURCE_DIR
For FTP Get this is the path where the fetched files are to be stored |
static java.lang.String |
LOG_OBJ
The log client extension handle for custom scripts to log. |
static java.lang.String |
OBPGP_HANDLER
The Outbound PGPHandler name |
static java.lang.String |
OPERATION_ID
The operation ID of the message. |
static java.lang.String |
ORIG_FILE_NAME
Optional, it can be used by business protocols to indicate the original file name location of a file reference. |
static java.lang.String |
ORIG_FILE_PATH
Optional, it can be used by business protocols to indicate the original path of a file reference. |
static java.lang.String |
OUTPUT_SOURCE_DIR
For FTP Put this is the path where the referenced file is taken from. |
static int |
PASSIVE_MODE
FTP passive mode to be set so that FTP server can listen on a port and send the ip and port information to the FTP client when the client issues PASV command. |
static java.lang.String |
RETRY_SLOT
The value "true" or "false" depending on whether the custom script wants BusinessConnect to re-execute itself. |
static java.lang.String |
SRC_FILE_NAME
The file name used specifically for outbound referenced payload. |
static java.lang.String |
TPNAME
The partner name |
static java.lang.String |
TRANSACTION_ID
The transaction ID of the message. |
static java.lang.String |
USER_STATUS_CODE
The custom script can return a status code in this slot. |
static java.lang.String |
USER_STATUS_MSG
The custom script can return a status message in this slot. |
Method Summary | |
---|---|
void |
aeTrace(java.lang.String role,
java.lang.String msgcode,
java.lang.String desc,
java.lang.String trackingInfo)
|
FTPReply |
connect()
Connects to the FTP server using the user, password, and port specified in the configuration for non-proxy connections. |
void |
disconnect()
Disconnects from the FTP server by sending the QUIT command for non proxy connections. |
FTPReply |
executeAppendCmd(java.lang.String filename)
Sends APPE command to the FTP server to store the contents of the file under the name filename on the FTP server. |
FTPReply |
executeCdCmd(java.lang.String pathname)
Sends CWD command to the FTP server and returns the reply. |
FTPReply |
executeDelCmd(java.lang.String filename)
Sends DELE command to the FTP server to delete the filename specified in filename parameter. |
FTPReply |
executeDirCmd(java.lang.String pathname)
Sends LIST command to the FTP server and receives the list of directory listing for that current pathname. |
FTPReply |
executeGetCmd(java.lang.String filename)
Sends RETR command to the FTP server and receive the response. |
FTPReply |
executeLsCmd(java.lang.String pathname)
Sends NLST command to the FTP server and receive the list of files available for that current pathname |
FTPReply[] |
executeMdelCmd(java.lang.String pathname)
Sends NLST command to retrieve the files that needs to be deleted based on the pathname specified. |
FTPReply[] |
executeMgetCmd(java.lang.String filename)
Retrieves the list of files that match the filename value. |
FTPReply |
executeMkdirCmd(java.lang.String pathname)
Sends MKD command to the FTP server to create a directory specified in pathname at the current working directory. |
FTPReply[] |
executeMputCmd(java.lang.String filename)
Stores the list of files that match the filename value. |
FTPReply |
executePutCmd(java.lang.Object data,
boolean isreference,
java.lang.String remotefilename)
Sends STOR command to the FTP server to store the contents of the file under the name specified in remotefilename . |
FTPReply |
executePutCmd(java.lang.String filename)
Sends STOR command to the FTP server to store the contents of the file under the name specified in filename . |
FTPReply |
executePutCmd(java.lang.String filename,
java.lang.String remotefilename)
Sends STOR command to the FTP server to store the contents of the file under the name specified in remotefilename . |
FTPReply |
executePwdCmd()
Sends PWD command to the FTP server and Prints the Working Directory |
FTPReply |
executeQuoteCmd(java.lang.String command,
java.lang.String arg)
Sends any command that is defined in the RFC 959 specification. |
FTPReply[] |
executeRenameCmd(java.lang.String oldfilename,
java.lang.String newfilename)
Sends RNFR and RNTO to rename the oldfilename to |
FTPReply |
executeRmdirCmd(java.lang.String pathname)
Sends RMD command to the FTP server to remove the directory specified in pathname . |
FTPReply |
executeSiteCmd(java.lang.String command)
Sends SITE command to the FTP server to retrieve services specific to his system that are essential to file transfer but not sufficiently universal to be included as a regular command. |
FTPReply |
executeStatusCmd(java.lang.String pathname)
Sends STAT command to the FTP server to get the status response of the pathname specified as a parameter. |
FTPReply |
executeStouCmd()
Sends STOU command to the FTP server to store the contents of the file under the name that is generated by the FTP server. |
FTPReply |
executeTypeCmd(java.lang.String typeCode)
Sends TYPE command to the FTP server. |
IClientObject |
getClientObject()
Retrieve a client object, which can provide more context specific information about the transaction. |
int |
getFTPMode()
Gets the FTP mode that is set. |
java.lang.String |
getHost()
Gets the hostname of the FTP server. |
java.lang.String |
getName()
|
java.lang.String |
getPassword()
Gets the password that is used to connect to the FTP server. |
int |
getPort()
Gets the port number that is used to connect to the FTP server. |
java.lang.String |
getTransportType()
Only when secure transport is used. |
java.lang.String |
getUsername()
Gets the username that is used to connect to the FTP server. |
boolean |
isBinaryTransfer()
Get the transfer mode. |
boolean |
isSecureMode()
Checks if the FTP connection is secure or unsecure. |
void |
setBinaryTransfer(boolean binary)
Set the transfer mode. |
void |
setControlConnectionTimeout(int seconds)
Enable/disable the SO_TIMEOUT with the specified timeout, in seconds. |
void |
setDataConnectionTimeout(int seconds)
Enable/disable the SO_TIMEOUT with the specified timeout, in seconds for the data connection. |
void |
setFTPMode(int mode)
Sets the FTP mode to be either Active or Passive for the data connection. |
void |
setSecureMode(boolean bSecureMode)
Deprecated. The FTP transport configuration provides a way to set the secure mode and associate a certificate for SSL. |
void |
setSSLCertificate(java.lang.String certificateName)
Set the SSL certificate name to do SSL handshake. |
void |
setSSLHostKey(java.lang.String hostKeyName)
Set the host private key to be used for SSL handshake that requires client authentication. |
void |
setTransportType(java.lang.String type)
Only when secure transport is used. |
boolean |
useHttpProxyServer()
Checks if an HTTP proxy server is used to connect to the FTP server. |
boolean |
useProxyServer()
Checks if a proxy server is used to connect to the FTP server. |
Field Detail |
---|
static final int FTP_STATUS_OK
static final int FTP_STATUS_ERROR
static final java.lang.String FTP_OBJ
static final java.lang.String OBPGP_HANDLER
static final java.lang.String IBPGP_HANDLER
static final java.lang.String TPNAME
static final java.lang.String HOSTNAME
static final java.lang.String LOG_OBJ
static final java.lang.String SRC_FILE_NAME
static final java.lang.String OUTPUT_SOURCE_DIR
static final java.lang.String ORIG_FILE_NAME
static final java.lang.String ORIG_FILE_PATH
static final java.lang.String TRANSACTION_ID
static final java.lang.String DOCUMENT_ID
static final java.lang.String OPERATION_ID
static final java.lang.String DATA_OBJ
static final java.lang.String INPUT_SOURCE_DIR
static final java.lang.String RETRY_SLOT
static final java.lang.String USER_STATUS_CODE
static final java.lang.String USER_STATUS_MSG
static final java.lang.String ALL_FILE_LIST
static final java.lang.String COMMON_ALL_FILE_LIST
static final java.lang.String DELETE_FILE
static final int ACTIVE_MODE
static final int PASSIVE_MODE
Please notice that if the FTP server does not support passive mode,
then the FTP command PASV will result in a 502
code from the FTP server.
static final int DEFAULT_FTP_PORT
Method Detail |
---|
java.lang.String getUsername()
This method can be called when FTP connections go through the HTTP proxy server.
java.lang.String getPassword()
This method can be called when FTP connections go through the HTTP proxy server.
java.lang.String getHost()
This method can be called when FTP connections go through the HTTP proxy server.
int getPort()
This method can be called when FTP connections go through the HTTP proxy server.
FTPReply connect()
This method can be called when FTP connections go through the HTTP proxy server.
After creating to the socket, internally it would send USER and then PASS to complete the connection. It also sends PASV command to verify if the FTP server has PASV implemented. If PASV is not implemented by the FTP server, it will create a ServerSocket and listen on a port for receiving data.
For proxy server connection, it just creates a socket connection and waits for the command to be executed.
Note: Possible FTP codes returned by USER command
Note: Possible FTP codes returned by PASS command
Note: Possible FTP codes returned by PASV command
void disconnect()
This method can be called when FTP connections go through the HTTP proxy server.
void setFTPMode(int mode)
ACTIVE_MODE
or PASSIVE_MODE
as the argument.
This method is valid only for FTP connections over non-proxy mode.
mode
- is either ACTIVE_MODE
or PASSIVE_MODE
int getFTPMode()
ACTIVE_MODE
or PASSIVE_MODE
.
ACTIVE_MODE
or PASSIVE_MODE
This method is valid only for FTP connections over non-proxy mode.
void setSecureMode(boolean bSecureMode) throws java.lang.Exception
connect()
method.
Secure mode is achieved by opening a SSL connection using AUTH SSL
FTP command (specified in RFC 2228) sent to the FTP server.
FTP server must support SSL (AUTH command as well) for secure mode.
Note: FTP over SSL cannot be used over proxy server at this time. This method should not be called if the FTP connections go over a proxy server.
bSecureMode
- is the flag to set secure/unsecure mode. A value of
true will set the FTP connection to be secure.
java.lang.Exception
- If an FTP connection is already open with the FTP server.boolean isSecureMode()
void setSSLCertificate(java.lang.String certificateName) throws java.lang.Exception
connect()
method
to be effective.
Secure mode is achieved by opening a SSL connection using AUTH SSL
with the certificateName
provided as a parameter.
FTP server must support SSL (AUTH command as well) for secure mode.
Note: FTP over SSL cannot be used over a proxy server. This method should not be called if the FTP connections go over a proxy server.
certificateName
- is the name of the certificate specified in the trading partner Credentials tab.
java.lang.Exception
- if certificateName
is null or if a valid certificate name
cannot be obtained from the store. Exception is also thrown if you try to set the
certificate when an FTP connection is already open with the FTP server.void setSSLHostKey(java.lang.String hostKeyName) throws java.lang.Exception
connect()
method
to be effective.
Secure mode is achieved by opening a SSL connection using AUTH SSL
FTP command (specified in RFC 2228) sent to the FTP server.
FTP server must support SSL (AUTH command as well) for secure mode.
Note: FTP over SSL cannot be used with a proxy server. This method should not be called if the FTP connections go over a proxy server.
hostKeyName
- is the name of the host private key to be used for
SSL handshake that requires client authentication.
java.lang.Exception
- if hostKeyName
is null or if the key could not be located
in the key store. Exception is also thrown if you try to set the host key when an FTP connection
is already open with the FTP server.void setControlConnectionTimeout(int seconds)
seconds
after which an java.io.InterruptedIOException
will be thrown by the Socket.
seconds
- is the non-zero timeout value specified in units of seconds.
This method is valid only for FTP connections over non-proxy mode. For FTP connections involving HTTP proxy server, the value set on this method will be ignored.
void setDataConnectionTimeout(int seconds)
seconds
- is the non-zero timeout value specified in units of seconds.boolean useProxyServer()
This method can be called when FTP connections go through the HTTP proxy server.
boolean useHttpProxyServer()
This method can be called when FTP connections go through the HTTP proxy server.
FTPReply executeCdCmd(java.lang.String pathname) throws java.lang.Exception
Note: Possible FTP codes returned by this command
pathname
- is the directory to change
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executeLsCmd(java.lang.String pathname) throws java.lang.Exception
pathname
Note: Possible FTP codes returned by this command
pathname
- is the directory to list files
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executeDirCmd(java.lang.String pathname) throws java.lang.Exception
Note: Possible FTP codes returned by this command
pathname
- is the directory you want to list files
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executePwdCmd() throws java.lang.Exception
Note: Possible FTP codes returned by this command
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executeTypeCmd(java.lang.String typeCode) throws java.lang.Exception
This method can be called when FTP connections go through the HTTP proxy server.
typeCode
- is the data representation to be followed for file transfer
until the typeCode
is modified. Default representation is A.
Typecode support is purely based on the implementation of the FTP server.
Note: Possible FTP codes returned by this command
java.lang.Exception
- when connect()
is not called before calling this method.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executeGetCmd(java.lang.String filename) throws java.lang.Exception
This method can be called when FTP connections go through the HTTP proxy server.
Note: Possible FTP codes returned by this command
filename
- to be retrieved from the FTP server.
This parameter can only be a filename and should not include
any directory path. If you want to retrieve a file from a particular
directory, call executeCdCmd(java.lang.String)
first to that directory. File that
is retrieved will be stored locally to a directory that is specified by
the configuration property. See documentation for more details on the
location of the storage.
java.lang.Exception
- if connect()
is not called before calling this method
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply[] executeMgetCmd(java.lang.String filename) throws java.lang.Exception
filename
value.
NLST is sent to the FTP server for the filename
specified.
If there are files found that match the filename
,
then either PASV or PORT command is
sent depending on if the FTP Client is setup to either initiate or
'listen' the connection for each file to be retrieved.
A RETR command is sent for each file to retrieve the file
to the local fileSystem.
Note: Possible FTP codes returned by this command includes codes from
executeLsCmd(java.lang.String)
and executeGetCmd(java.lang.String)
filename
- is sent which can contain a wildcard '*'
to get all files that have the pattern described in filename
.
This parameter can only be a filename with/without wildcard and should not include
any directory path. If you want to retrieve a file from a particular
directory, call executeCdCmd(java.lang.String)
first to that directory. Files that
are retrieved will be stored locally to a directory that is specified by
the configuration property. See documentation for more details on the
location of the storage.
filename
pattern, only
NLST command reply object is sent back.
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executePutCmd(java.lang.String filename) throws java.lang.Exception
filename
.
The filename
is the actual filename in the file system
passed from the Job Slot.
This method can be called when FTP connections go through the HTTP proxy server.
Note: Possible FTP codes returned by this command
To store a filename specified by the user, you would want to use executePutCmd(String, String)
call.
filename
- that is passed from the Job slot which
represends the actual filename in the filesystem.
This parameter can only be a filename and should not include
any directory path. If you want to store a file to a particular
directory in the FTP server, call executeCdCmd(java.lang.String)
first to that directory.
File that is about to be stored will be read from local directory
that is specified by the configuration. See documentation for
more details on the location of the storage.
java.lang.Exception
- if connect()
is not called before calling this method
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executePutCmd(java.lang.String filename, java.lang.String remotefilename) throws java.lang.Exception
remotefilename
.
This method can be called when FTP connections go through the HTTP proxy server.
Note: Possible FTP codes returned by this command
filename
- that is passed from the Job slot which
represends the actual filename in the filesystem.remotefilename
- to be stored to the FTP server.
This parameter can only be a filename and should not include
any directory path. If you want to store a file to a particular
directory in the FTP server, call executeCdCmd(java.lang.String)
first to that directory.
File that is about to be stored will be read from local directory
that is specified by the configuration property. See documentation for
more details on the location of the storage.
java.lang.Exception
- if connect()
is not called before calling this method
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executePutCmd(java.lang.Object data, boolean isreference, java.lang.String remotefilename) throws java.lang.Exception
remotefilename
.
This method can be called when FTP connections go through the HTTP proxy server.
Note: Possible FTP codes returned by this command
data
- that is passed from the Job slot which represents the actual in memory object.isreference
- if an in memory object is passed in, it must be false, otherwise true.
If a reference is used then executePutCmd(String)
or executePutCmd(String, String)
can be used instead.remotefilename
- to be stored to the FTP server.
This parameter can only be a filename and should not include
any directory path. If you want to store a file to a particular
directory in the FTP server, call executeCdCmd(java.lang.String)
first to that directory.
File that is about to be stored will be read from local directory
that is specified by the configuration property. See documentation for
more details on the location of the storage.
java.lang.Exception
- if connect()
is not called before calling this method
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply[] executeMputCmd(java.lang.String filename) throws java.lang.Exception
filename
value.
Either PASV or PORT command is
sent depending on if the FTP Client is setup to either initiate or
'listen' the connection for each file to be stored. A STOR
command is sent for each file to be stored on the FTP server from
the local fileSystem.
Note: Possible FTP codes returned by this command includes code from
executePutCmd(java.lang.String)
filename
- is sent which can contain a wildcard '*'
to get all files that have the pattern described in filename
.
This parameter can only be a filename with/without wildcard and should not include
any directory path. If you want to store a file to a particular
directory in the FTP server, call executeCdCmd(java.lang.String)
first to that directory.
File that is about to be stored will be read from local directory
that is specified by the configuration property. See documentation for
more details on the location of the storage.
filename
pattern, only
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executeStouCmd() throws java.lang.Exception
Note: Possible FTP codes returned by this command
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply executeAppendCmd(java.lang.String filename) throws java.lang.Exception
filename
on the FTP server.
If a file exists in the FTP server with the same filename
, the
contents are appended to that file. If a file does not exist, a new file
is created and saved under the name specified in filename
.
Note: Possible FTP codes returned by this command
filename
- is the name of the file that should be stored
on the FTP server.
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.FTPReply[] executeRenameCmd(java.lang.String oldfilename, java.lang.String newfilename) throws java.lang.Exception
oldfilename to newfilename
. If the RNFR
fails because oldfilename
does not exist, then RNTO
command is not issued to the FTP server.
Note: Possible FTP codes returned by RNFR command
Note: Possible FTP codes returned by RNTO command
- Parameters:
oldfilename
- is the old filename that exists in the FTP server.newfilename
- is the new filename that you would to rename to.
- Returns:
- If the RNFR succeeds, then a list of 2 FTPReply
objects are returned with the FTP code for RNFR and RNTO
If RNFR fails, then the list will contain only one
FTPReply object.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.
executeDelCmd
FTPReply executeDelCmd(java.lang.String filename)
throws java.lang.Exception
- Sends DELE command to the FTP server to delete the filename
specified in
filename
parameter.
Note: Possible FTP codes returned by this command
- Parameters:
filename
- is the name of the file to be deleted in the FTP server.
- Returns:
- the reply from the FTP server about the status of the command.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method. Due to the
lack of standard guidance, this command cannot be used over a http proxy connection.
executeMdelCmd
FTPReply[] executeMdelCmd(java.lang.String pathname)
throws java.lang.Exception
- Sends NLST command to retrieve the files that needs to be deleted
based on the
pathname
specified. If there are files returned from
NLST command, then DELE command is sent
for each of those files to be deleted at the FTP server.
Note: Possible FTP codes returned by this command includes codes from
executeDelCmd(java.lang.String)
and executeLsCmd(java.lang.String)
- Parameters:
pathname
- is the partial pathname to be deleted in the FTP server.
- Returns:
- the reply from the FTP server about the status of the command.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.
executeMkdirCmd
FTPReply executeMkdirCmd(java.lang.String pathname)
throws java.lang.Exception
- Sends MKD command to the FTP server to create a directory
specified in
pathname
at the current working directory.
Note: Possible FTP codes returned by this command
- Parameters:
pathname
- is the name of the directory in the FTP server.
- Returns:
- the reply from the FTP server about the status of the command.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.
executeRmdirCmd
FTPReply executeRmdirCmd(java.lang.String pathname)
throws java.lang.Exception
- Sends RMD command to the FTP server to remove the directory
specified in
pathname
.
Note: Possible FTP codes returned by this command
- Parameters:
pathname
- is the name of the directory to be in the FTP server.
- Returns:
- the reply from the FTP server about the status of the command.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.
executeSiteCmd
FTPReply executeSiteCmd(java.lang.String command)
throws java.lang.Exception
- Sends SITE command to the FTP server to retrieve services
specific to his system that are essential to file transfer but not
sufficiently universal to be included as a regular command.
Note: Possible FTP codes returned by this command
- Parameters:
command
- is the command that is provided by the FTP
server. If an empty string is sent, then a list of commands serviced for
SITE command is returned in the control connection.
- Returns:
- the reply from the FTP server.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.
executeStatusCmd
FTPReply executeStatusCmd(java.lang.String pathname)
throws java.lang.Exception
- Sends STAT command to the FTP server to get the status response of the
pathname
specified as a parameter. If you send in a empty value,
the server should return general status information about the server FTP process.
By providing a pathname, the command is analogous to the executeDirCmd(java.lang.String)
except that data shall be transferred over the control connection. If a partial
pathname is given, the server may respond with a list of file names or attributes
associated with that specification.
Note: Possible FTP codes returned by this command
- Parameters:
pathname
- is either to return a list of files for a
qualified name,
- Returns:
- the reply from the FTP server about the status of the command and
the FTP message text.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.
executeQuoteCmd
FTPReply executeQuoteCmd(java.lang.String command,
java.lang.String arg)
throws java.lang.Exception
- Sends any
command
that is defined in the RFC 959 specification.
arg
value should be sent for the command
.
Note: Possible FTP codes returned by this command
depends on the command that is executed.
- Parameters:
command
- is the name of the command to be executed on the
FTP server.arg
- is the argument for command
- Returns:
- the reply from the FTP server about the status of the command.
- Throws:
java.lang.Exception
- if connect()
is not called before calling this method or
if this method is called when FTP connections go through HTTP proxy server.
Exception is also thrown if this method is called when connect()
method
is not successful. So users must always check the reply of connect method.
setBinaryTransfer
void setBinaryTransfer(boolean binary)
- Set the transfer mode.
- Parameters:
binary
- True if binary, false otherwise.
isBinaryTransfer
boolean isBinaryTransfer()
- Get the transfer mode.
- Returns:
- True, if binary, false otherwise.
aeTrace
void aeTrace(java.lang.String role,
java.lang.String msgcode,
java.lang.String desc,
java.lang.String trackingInfo)
getName
java.lang.String getName()
setTransportType
void setTransportType(java.lang.String type)
- Only when secure transport is used. Set the secured transport type to either SSL or TLS
- Parameters:
type
- The value of "SSL" or "TLS".
getTransportType
java.lang.String getTransportType()
- Only when secure transport is used. Returns the type as either "SSL" or "TLS"
- Returns:
- The type of the secure transport.
getClientObject
IClientObject getClientObject()
- Retrieve a client object, which can provide more context specific information about the
transaction.
- Returns:
- The client object
IClientObject
.
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD