Sun Adapter for Batch/FTP

com.stc.eways.batchext
Class FtpFileProviderImpl

java.lang.Object
  extended by com.stc.eways.batchext.FtpFileProviderImpl
All Implemented Interfaces:
FtpFileProvider
Direct Known Subclasses:
FtpFileProviderImplUser0

public class FtpFileProviderImpl
extends java.lang.Object
implements FtpFileProvider

This class provides basic FTP functions. It supports multiple FTP directory-listing styles that are defined as FTP heuristics. You can extend this class to provide your own implementation. This class is also exposed as a node in the FTP ETD.

Version:
cvs revision: $Revision: 1.15 $ Last Modified: $Date: 2008/02/25 16:56:24 $
Author:
Harry Liu

Field Summary
static int ACTION_ABORTED
           
static int BAD_COMMAND_SEQUENCE
           
static int CANNOT_OPEN_DATA_CONNECTION
           
static int CLOSING_DATA_CONNECTION
           
static int COMMAND_IS_SUPERFLUOUS
           
static int COMMAND_NOT_IMPLEMENTED
           
static int COMMAND_NOT_IMPLEMENTED_FOR_PARAMETER
           
static int COMMAND_OK
           
static int DATA_CONNECTION_ALREADY_OPEN
           
static int DATA_CONNECTION_OPEN
           
static int DEFAULT_TIMEOUT_COMMAND_CONNECTION
           
static int DEFAULT_TIMEOUT_DATA_CONNECTION
           
static int DIRECTORY_STATUS
           
static int ENTERING_PASSIVE_MODE
           
static int FILE_ACTION_NOT_TAKEN
           
static int FILE_ACTION_OK
           
static int FILE_ACTION_PENDING
           
static int FILE_NAME_NOT_ALLOWED
           
static int FILE_STATUS
           
static int FILE_STATUS_OK
           
static int FILE_UNAVAILABLE
           
static int HELP_MESSAGE
           
static int INSUFFICIENT_STORAGE
           
protected  com.stc.connector.logging.Logger mLogger
           
static int NAME_SYSTEM_TYPE
           
static int NEED_ACCOUNT
           
static int NEED_ACCOUNT_FOR_STORING_FILES
           
static int NEED_PASSWORD
           
static int NOT_LOGGED_IN
           
static int PAGE_TYPE_UNKNOWN
           
static int PATHNAME_CREATED
           
static int RESTART_MARKER
           
static int SERVICE_CLOSING_CONTROL_CONNECTION
           
static int SERVICE_NOT_AVAILABLE
           
static int SERVICE_NOT_READY
           
static int SERVICE_READY
           
static int STORAGE_ALLOCATION_EXCEEDED
           
static int SYNTAX_ERROR_IN_ARGUMENTS
           
static int SYSTEM_STATUS
           
static int TRANSFER_ABORTED
           
static int UNRECOGNIZED_COMMAND
           
static int USER_LOGGED_IN
           
 
Constructor Summary
FtpFileProviderImpl()
          Creates a new FtpFileProviderImpl object.
 
Method Summary
 boolean appendFile(java.lang.String remoteFileName, java.io.InputStream local)
          Appends to a file on the remote FTP server with the given name, taking its input from the given InputStream.
 boolean appendFile(java.lang.String remoteFileName, java.lang.String localFileName)
          Appends to a file on the remote FTP server with the given file name, taking the input from the given file name.
 boolean appendFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.io.InputStream local)
          Appends to a file on the remote FTP server with the given name, taking its input from the given InputStream.
 boolean appendFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.lang.String localFileName)
          Appends to a file on the server with the given directory and file name, taking its input from the given file name.
 java.io.OutputStream appendFileStream(java.lang.String remoteFileName)
          Returns an OutputStream through which data can be written.
 java.io.OutputStream appendFileStream(java.lang.String dirName, java.lang.String baseFileName)
          Returns an OutputStream through which data can be written.
 boolean archiveFile(java.lang.String dirNameFrom, java.lang.String baseFileNameFrom, java.lang.String dirNameTo, java.lang.String baseFileNameTo)
          Renames a remote file.
 boolean ascii()
          Sets the file type of the file to be transferred, to ASCII.
 boolean binary()
          Sets the file type of the file to be transferred, to binary.
 boolean cd(java.lang.String dirName)
          Changes the current working directory of the FTP session.
 boolean completePendingCommand()
          Receives an FTPClient method's completion reply from the server and verifies the success of the entire transaction, after the programmer's code completes its actions.
 void connect(java.lang.String host, int port)
          Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.
 void connect(java.lang.String host, int port, java.lang.String encoding)
          Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.
 boolean deleteFile(java.lang.String remoteFileName)
          Deletes a file on the remote FTP server.
 boolean deleteFile(java.lang.String dirName, java.lang.String baseFileName)
          Deletes a file on the remote FTP server.
 void disConnect()
          Closes the connection to the remote FTP server and restores the e*Way Connection parameters to the default values.
 boolean ebcdic()
          Sets the file type of the file to be transferred, to EBCDIC.
 int getDataConnectionMode()
          Returns the current data connection mode (one of the _DATA_CONNECTION_MODE constants).
 com.oroinc.net.ftp.FTPFileListParser getDefaultFileListParser()
          Retrieves the defaultFileListParser object
 com.oroinc.net.ftp.FTPClient getDelegate()
          Retrieves the delegate object
 java.lang.String getFirstFileName(java.lang.String dir, boolean isDirRegex, java.lang.String file, boolean isFileRegex)
          Get the first matching remote file name based on the remote directory regular expression and the remote file regular expression.
 FtpHeuristics getHeuristics()
          Retrieves an FtpHeuristics object.
 int getReplyCode()
          Returns the integer value of the reply code of the last FTP reply.
 java.lang.String getReplyString()
          Returns the entire text of the last FTP server response exactly as it was received.
 java.lang.String[] getReplyStrings()
          Returns the lines of text from the last FTP server response as an array of strings, with one entry per line.
 int getSoLinger()
          Returns the current SO_LINGER timeout (in seconds) of the currently opened socket.
 int getSoTimeout()
          Returns the timeout, in milliseconds, of the currently opened socket.
 java.lang.String getSystemName()
          Retrieves the system type name from the server and returns the string.
 boolean getTcpNoDelay()
          Allows you to determine whether Nagle's algorithm is enabled on the currently opened socket.
 boolean image()
          Sets the file type of the file to be transferred, to "Image."
 void initialize(FtpETD etd)
          Initializes the FTP ETD object.
 boolean isConnected()
          Checks on whether the client is currently connected to a server.
 boolean isNegativePermanent(int replyCode)
          Checks on whether the FTP operation is "Negative Permanent;" the return code can be any integer from 500 through 599.
 boolean isNegativeTransient(int replyCode)
          Checks on whether the FTP operation is "Negative Transient;" the return code can be any integer from 400 through 499.
 boolean isPositiveCompletion(int replyCode)
          Checks on whether the FTP operation is "Positive Completion;" the return code can be any integer from 200 through 299.
 boolean isPositiveIntermediate(int replyCode)
          Checks on whether the FTP operation is "Positive Intermediate;" the return code can be any integer from 300 through 399.
 boolean isPositivePreliminary(int replyCode)
          Checks on whether the FTP operation is "Positive Preliminary;" the return code can be any integer from 100 through 199.
 boolean isRemoteVerificationEnabled()
          Allows you to determine whether verification of the remote FTP host participating in data connections is enabled.
 boolean isTraceRawCommand()
          Check on whether the trace flag is on.
 java.lang.String[] listFileNames(com.oroinc.net.ftp.FTPFile[] files)
          Gets the name for all file entries that are related to real file data.
 java.lang.String[] listFileNames(java.lang.String dir, boolean isDirRegex, java.lang.String file, boolean isFileRegex)
          Lists the remote full file names based on the remote directory regular expression and remote file regular expression.
 com.oroinc.net.ftp.FTPFile[] listFiles()
          Using the default FileListParser , obtains a list of file information for the current working directory.
 com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files, boolean listRealData)
          Gets all file entries that can be used to get real data, when the parameter listRealData is true.
 com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files, int fileType)
          Filters files by type.
 com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName)
          Using default FileListParser, obtains a list of file information for the given working directory.
 com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName, java.lang.String regExp)
          Using the default FileListParser, obtains a list of file information for the given working directory and regular expression.
 java.lang.String listHelp()
          Retrieves the system help information from the remote FTP server and returns the full string.
 java.lang.String listHelp(java.lang.String command)
          Retrieves the help information for a given command from the remote FTP server and returns the full string.
 boolean login(java.lang.String user, java.lang.String password)
          Logs into the remote FTP server using the provided user name and password.
 boolean logout()
          Logs out of the remote FTP server by sending the QUIT command.
static void main(java.lang.String[] args)
          Used to do stand-alone testing.
 boolean mkdir(java.lang.String dir)
          Creates a new directory if the directory does not exist.
 boolean mkdirs(java.lang.String dir)
          Creates a new directory if the directory does not exist.
 java.lang.String pwd()
          Returns the path name of the current working directory.
 boolean rename(java.lang.String remoteFileNameFrom, java.lang.String remoteFileNameTo)
          Renames a remote file.
 boolean rename(java.lang.String dirNameFrom, java.lang.String baseFileNameFrom, java.lang.String dirNameTo, java.lang.String baseFileNameTo)
          Renames a remote file.
 boolean retrieveFile(java.lang.String remoteFileName, java.io.OutputStream local)
          Retrieves a named file from the remote FTP server and writes it to the given OutputStream.
 boolean retrieveFile(java.lang.String remoteFileName, java.lang.String localFileName)
          Retrieves a named file from the remote FTP server and writes it to the given local file.
 boolean retrieveFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.io.OutputStream local)
          Retrieves a named file from the remote FTP server and writes it to the given OutputStream.
 boolean retrieveFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.lang.String localFileName)
          Retrieves a named file from the remote FTP server and writes it to the given local file.
 java.io.InputStream retrieveFileStream(java.lang.String remoteFileName)
          Returns an InputStream from which a named file from the remote FTP server can be read.
 java.io.InputStream retrieveFileStream(java.lang.String dirName, java.lang.String baseFileName)
          Returns an InputStream from which a named file from the remote FTP server can be read.
 boolean rmdir(java.lang.String dirName)
          Removes a directory on the FTP server, if it is empty.
 int sendCommand(java.lang.String command)
          Sends an FTP command without a parameter to the remote FTP server.
 int sendCommand(java.lang.String command, java.lang.String parm)
          Sends an FTP command to the server.
 boolean sendSiteCommand(java.lang.String command)
          send a site command to FTP server
 void setDataSocketTimeout(int timeout)
          Sets the timeout, in milliseconds, to use when reading from the data connection.
 void setDefaultFileListParser(com.oroinc.net.ftp.FTPFileListParser parser)
          Sets the defaultFileListParser object
 void setDelegate(com.oroinc.net.ftp.FTPClient client)
          Sets the delegate object
 void setDirListingStyle(java.lang.String dirListingStyle)
          Initializes and updates the FTP heuristics using a specified directory-listing style.
 void setHeuristics(FtpHeuristics heuristics)
          Sets the heuristics object
 void setRemoteVerificationEnabled(boolean enable)
          Allows you to enable or disable verification that the remote FTP host taking part in a given data connection is the same as the host to which the control connection is attached.
 void setSocketFactory(com.oroinc.net.SocketFactory factory)
          Sets the SocketFactory used by the SocketClient to open socket connections.
 void setSoLinger(boolean on, int val)
          Sets the SO_LINGER timeout (in seconds) on the currently opened command socket.
 void setSoTimeout(int timeout)
          Sets the timeout, in milliseconds, of a currently open command connection.
 void setTcpNoDelay(boolean on)
          Allows you to enable or disable the Nagle's algorithm (TCP_NODELAY) on the currently opened command socket.
 void setTraceRawCommand(boolean newTraceRawCommand)
          Allows you to turn the trace flag on and off.
 void setUserDefinedHeuristicsInfo(java.lang.String userDefinedDirListingStyle, java.lang.String userDefinedHeuristicsCfgFile)
          Initializes and updates the FTP heuristics using a user specified directory-listing style.
 boolean storeFile(java.lang.String remoteFileName, java.io.InputStream local)
          Stores a file on the remote FTP server using the given name and taking its input from the given InputStream.
 boolean storeFile(java.lang.String remoteFileName, java.lang.String localFileName)
          Stores a file on the server using the given name and taking its input from the given local file.
 boolean storeFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.io.InputStream local)
          Stores a file on the remote FTP server using the given name and taking its input from the given InputStream.
 boolean storeFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.lang.String localFileName)
          Stores a file on the remote FTP server using the given name and taking its input from the given local file.
 java.io.OutputStream storeFileStream(java.lang.String remoteFileName)
          Returns an OutputStream through which data can be written to store a file on the server using the given name.
 java.io.OutputStream storeFileStream(java.lang.String dirName, java.lang.String baseFileName)
          Returns an OutputStream through which data can be written.
 void useActive()
          Sets the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.
 void usePassive()
          Sets the current data connection mode to PASSIVE_LOCAL_DATA_CONNECTION_MODE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mLogger

protected com.stc.connector.logging.Logger mLogger

DEFAULT_TIMEOUT_DATA_CONNECTION

public static final int DEFAULT_TIMEOUT_DATA_CONNECTION
See Also:
Constant Field Values

DEFAULT_TIMEOUT_COMMAND_CONNECTION

public static final int DEFAULT_TIMEOUT_COMMAND_CONNECTION
See Also:
Constant Field Values

ACTION_ABORTED

public static final int ACTION_ABORTED
See Also:
Constant Field Values

BAD_COMMAND_SEQUENCE

public static final int BAD_COMMAND_SEQUENCE
See Also:
Constant Field Values

CANNOT_OPEN_DATA_CONNECTION

public static final int CANNOT_OPEN_DATA_CONNECTION
See Also:
Constant Field Values

CLOSING_DATA_CONNECTION

public static final int CLOSING_DATA_CONNECTION
See Also:
Constant Field Values

COMMAND_IS_SUPERFLUOUS

public static final int COMMAND_IS_SUPERFLUOUS
See Also:
Constant Field Values

COMMAND_NOT_IMPLEMENTED

public static final int COMMAND_NOT_IMPLEMENTED
See Also:
Constant Field Values

COMMAND_NOT_IMPLEMENTED_FOR_PARAMETER

public static final int COMMAND_NOT_IMPLEMENTED_FOR_PARAMETER
See Also:
Constant Field Values

COMMAND_OK

public static final int COMMAND_OK
See Also:
Constant Field Values

DATA_CONNECTION_ALREADY_OPEN

public static final int DATA_CONNECTION_ALREADY_OPEN
See Also:
Constant Field Values

DATA_CONNECTION_OPEN

public static final int DATA_CONNECTION_OPEN
See Also:
Constant Field Values

DIRECTORY_STATUS

public static final int DIRECTORY_STATUS
See Also:
Constant Field Values

ENTERING_PASSIVE_MODE

public static final int ENTERING_PASSIVE_MODE
See Also:
Constant Field Values

FILE_ACTION_NOT_TAKEN

public static final int FILE_ACTION_NOT_TAKEN
See Also:
Constant Field Values

FILE_ACTION_OK

public static final int FILE_ACTION_OK
See Also:
Constant Field Values

FILE_ACTION_PENDING

public static final int FILE_ACTION_PENDING
See Also:
Constant Field Values

FILE_NAME_NOT_ALLOWED

public static final int FILE_NAME_NOT_ALLOWED
See Also:
Constant Field Values

FILE_STATUS

public static final int FILE_STATUS
See Also:
Constant Field Values

FILE_STATUS_OK

public static final int FILE_STATUS_OK
See Also:
Constant Field Values

FILE_UNAVAILABLE

public static final int FILE_UNAVAILABLE
See Also:
Constant Field Values

HELP_MESSAGE

public static final int HELP_MESSAGE
See Also:
Constant Field Values

INSUFFICIENT_STORAGE

public static final int INSUFFICIENT_STORAGE
See Also:
Constant Field Values

NAME_SYSTEM_TYPE

public static final int NAME_SYSTEM_TYPE
See Also:
Constant Field Values

NEED_ACCOUNT

public static final int NEED_ACCOUNT
See Also:
Constant Field Values

NEED_ACCOUNT_FOR_STORING_FILES

public static final int NEED_ACCOUNT_FOR_STORING_FILES
See Also:
Constant Field Values

NEED_PASSWORD

public static final int NEED_PASSWORD
See Also:
Constant Field Values

NOT_LOGGED_IN

public static final int NOT_LOGGED_IN
See Also:
Constant Field Values

PAGE_TYPE_UNKNOWN

public static final int PAGE_TYPE_UNKNOWN
See Also:
Constant Field Values

PATHNAME_CREATED

public static final int PATHNAME_CREATED
See Also:
Constant Field Values

RESTART_MARKER

public static final int RESTART_MARKER
See Also:
Constant Field Values

SERVICE_CLOSING_CONTROL_CONNECTION

public static final int SERVICE_CLOSING_CONTROL_CONNECTION
See Also:
Constant Field Values

SERVICE_NOT_AVAILABLE

public static final int SERVICE_NOT_AVAILABLE
See Also:
Constant Field Values

SERVICE_NOT_READY

public static final int SERVICE_NOT_READY
See Also:
Constant Field Values

SERVICE_READY

public static final int SERVICE_READY
See Also:
Constant Field Values

STORAGE_ALLOCATION_EXCEEDED

public static final int STORAGE_ALLOCATION_EXCEEDED
See Also:
Constant Field Values

SYNTAX_ERROR_IN_ARGUMENTS

public static final int SYNTAX_ERROR_IN_ARGUMENTS
See Also:
Constant Field Values

SYSTEM_STATUS

public static final int SYSTEM_STATUS
See Also:
Constant Field Values

TRANSFER_ABORTED

public static final int TRANSFER_ABORTED
See Also:
Constant Field Values

UNRECOGNIZED_COMMAND

public static final int UNRECOGNIZED_COMMAND
See Also:
Constant Field Values

USER_LOGGED_IN

public static final int USER_LOGGED_IN
See Also:
Constant Field Values
Constructor Detail

FtpFileProviderImpl

public FtpFileProviderImpl()
                    throws java.lang.Exception
Creates a new FtpFileProviderImpl object.

Throws:
java.lang.Exception
Method Detail

listFiles

public com.oroinc.net.ftp.FTPFile[] listFiles()
                                       throws java.io.IOException
Using the default FileListParser , obtains a list of file information for the current working directory.

Specified by:
listFiles in interface FtpFileProvider
Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

public com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName)
                                       throws java.io.IOException
Using default FileListParser, obtains a list of file information for the given working directory.

Specified by:
listFiles in interface FtpFileProvider
Parameters:
pathName - The directory name.
Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

public com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files,
                                              int fileType)
                                       throws java.io.IOException
Filters files by type. The type can bre any of the following: FTPFile.FILE_TYPE, FTPFile.DIRECTORY_TYPE, FTPFile.SYMBOLIC_LINK_TYPE or FTPFile.UNKNOWN_TYPE.

Specified by:
listFiles in interface FtpFileProvider
Parameters:
files - An array of FTP ETD objects.
fileType - The file type.
Returns:
An array of FTP ETD objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

public com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName,
                                              java.lang.String regExp)
                                       throws java.io.IOException
Using the default FileListParser, obtains a list of file information for the given working directory and regular expression.

Specified by:
listFiles in interface FtpFileProvider
Parameters:
pathName - The directory name.
regExp - The file name regular expression.
Returns:
An array of FTP ETD objects.
Throws:
java.io.IOException - If some error occurs.

appendFile

public boolean appendFile(java.lang.String remoteFileName,
                          java.lang.String localFileName)
                   throws java.io.IOException
Appends to a file on the remote FTP server with the given file name, taking the input from the given file name. The FileInputSteam related to the localFileName is closed in this method.

Specified by:
appendFile in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
localFileName - The local file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

appendFileStream

public java.io.OutputStream appendFileStream(java.lang.String dirName,
                                             java.lang.String baseFileName)
                                      throws java.io.IOException
Returns an OutputStream through which data can be written. This data is used to append to a file with the given file name, on the remote FTP server. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format (therefore, do not create a special OutputStream to do this operation). You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify its success.

Specified by:
appendFileStream in interface FtpFileProvider
Parameters:
dirName - The remote directory name.
baseFileName - The remote base file name.
Returns:
An OutputStream through which the remote file can be appended. If the data connection cannot be opened (for example, if the file does not exist), a null is returned (in which case you can check the reply code to determine the exact reason for the failure).
Throws:
java.io.IOException - If some error occurs.

deleteFile

public boolean deleteFile(java.lang.String dirName,
                          java.lang.String baseFileName)
                   throws java.io.IOException
Deletes a file on the remote FTP server.

Specified by:
deleteFile in interface FtpFileProvider
Parameters:
dirName - The remote directory name of the file.
baseFileName - The base name of the file.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

isTraceRawCommand

public boolean isTraceRawCommand()
Check on whether the trace flag is on.

Specified by:
isTraceRawCommand in interface FtpFileProvider
Returns:
true if trace flag is on, but false if not.

rename

public boolean rename(java.lang.String dirNameFrom,
                      java.lang.String baseFileNameFrom,
                      java.lang.String dirNameTo,
                      java.lang.String baseFileNameTo)
               throws java.io.IOException
Renames a remote file.

Specified by:
rename in interface FtpFileProvider
Parameters:
dirNameFrom - The remote directory name.
baseFileNameFrom - The remote base file name.
dirNameTo - The remote directory name.
baseFileNameTo - The remote base file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

public boolean retrieveFile(java.lang.String remoteFileName,
                            java.lang.String localFileName)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given local file. The FileOutputSteam related to the localFileName is closed in this method.

Specified by:
retrieveFile in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
localFileName - The local file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFileStream

public java.io.InputStream retrieveFileStream(java.lang.String dirName,
                                              java.lang.String baseFileName)
                                       throws java.io.IOException
Returns an InputStream from which a named file from the remote FTP server can be read. If the current file type is ASCII, the returned InputStream converts the line separators in the file to the local representation. You must close the InputStream when you finish reading from it. The InputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer you must call the method completePendingCommand() and check its return value to verify your success.

Specified by:
retrieveFileStream in interface FtpFileProvider
Parameters:
dirName - The remote directory name.
baseFileName - The remote base file name.
Returns:
An InputStream from which the remote file can be read. If the data connection cannot be opened (for example, if the file does not exist), a null is returned, in which case you can check the reply code to determine the exact reason for failure.
Throws:
java.io.IOException - If some error occurs.

sendCommand

public int sendCommand(java.lang.String command,
                       java.lang.String parm)
                throws java.io.IOException
Sends an FTP command to the server. The method then waits for a reply and returns the numerical response code.

Specified by:
sendCommand in interface FtpFileProvider
Parameters:
command - The FTP command to be executed.
parm - The parameter of the FTP command.
Returns:
The reply code from FTP command.
Throws:
java.io.IOException - If some error occurs.

setTraceRawCommand

public void setTraceRawCommand(boolean newTraceRawCommand)
Allows you to turn the trace flag on and off.

Specified by:
setTraceRawCommand in interface FtpFileProvider
Parameters:
newTraceRawCommand - true or false.

storeFile

public boolean storeFile(java.lang.String remoteFileName,
                         java.lang.String localFileName)
                  throws java.io.IOException
Stores a file on the server using the given name and taking its input from the given local file. The FileInputSteam related to the localFileName is closed in this method.

Specified by:
storeFile in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
localFileName - The local file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

storeFileStream

public java.io.OutputStream storeFileStream(java.lang.String dirName,
                                            java.lang.String baseFileName)
                                     throws java.io.IOException
Returns an OutputStream through which data can be written. This data is used to append to a file with the given file name, on the remote FTP server. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format (therefore, do not create a special OutputStream to do this operation). You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify its success.

Specified by:
storeFileStream in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
baseFileName - The remote base file name.
Returns:
An OutputStream through which the remote file can be appended. If the data connection cannot be opened (for example, if the file does not exist), a null is returned (in which case you can check the reply code to determine the exact reason for the failure).
Throws:
java.io.IOException - If some error occurs.

appendFile

public boolean appendFile(java.lang.String remoteDirName,
                          java.lang.String remoteBaseFileName,
                          java.lang.String localFileName)
                   throws java.io.IOException
Appends to a file on the server with the given directory and file name, taking its input from the given file name. The FileInputSteam related to the localFileName is closed in this method.

Specified by:
appendFile in interface FtpFileProvider
Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote base file name.
localFileName - The local file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

public boolean retrieveFile(java.lang.String remoteDirName,
                            java.lang.String remoteBaseFileName,
                            java.lang.String localFileName)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given local file. The FileOutputSteam related to the localFileName is closed in this method.

Specified by:
retrieveFile in interface FtpFileProvider
Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote base file name.
localFileName - The local file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

storeFile

public boolean storeFile(java.lang.String remoteDirName,
                         java.lang.String remoteBaseFileName,
                         java.lang.String localFileName)
                  throws java.io.IOException
Stores a file on the remote FTP server using the given name and taking its input from the given local file. The FileInputSteam related to the localFileName is closed in this method.

Specified by:
storeFile in interface FtpFileProvider
Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote file name.
localFileName - The local file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

listFiles

public com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files,
                                              boolean listRealData)
                                       throws java.io.IOException
Gets all file entries that can be used to get real data, when the parameter listRealData is true. The file entries contain all files with FILE_TYPE and/or files with SYMBOLIC_LINK_TYPE, if they are linked to real data that is available (in FtpHeuristics) the parameter is true. However, if the list only contains files with FILE_TYPE , if they are linked to real data that is available, the parameter is false. This method filters out directory entries and pure symbolic link entries.

Specified by:
listFiles in interface FtpFileProvider
Parameters:
files - An array of FTPFile objects.
listRealData - Indicates whether the files listed contain real data.
Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

getReplyCode

public int getReplyCode()
Returns the integer value of the reply code of the last FTP reply.

Specified by:
getReplyCode in interface FtpFileProvider
Returns:
The reply code.

getReplyString

public java.lang.String getReplyString()
Returns the entire text of the last FTP server response exactly as it was received.

Specified by:
getReplyString in interface FtpFileProvider
Returns:
The reply string.

getReplyStrings

public java.lang.String[] getReplyStrings()
Returns the lines of text from the last FTP server response as an array of strings, with one entry per line.

Specified by:
getReplyStrings in interface FtpFileProvider
Returns:
The reply string lines.

appendFile

public boolean appendFile(java.lang.String remoteFileName,
                          java.io.InputStream local)
                   throws java.io.IOException
Appends to a file on the remote FTP server with the given name, taking its input from the given InputStream. The InputSteam is NOT closed in this method.

Specified by:
appendFile in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
local - The local input stream.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

appendFile

public boolean appendFile(java.lang.String remoteDirName,
                          java.lang.String remoteBaseFileName,
                          java.io.InputStream local)
                   throws java.io.IOException
Appends to a file on the remote FTP server with the given name, taking its input from the given InputStream. The InputSteam is NOT closed in this method.

Specified by:
appendFile in interface FtpFileProvider
Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote base file name.
local - The local input stream.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

appendFileStream

public java.io.OutputStream appendFileStream(java.lang.String remoteFileName)
                                      throws java.io.IOException
Returns an OutputStream through which data can be written. This data is used to append to a file with the given file name, on the remote FTP server. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format (therefore, do not create a special OutputStream to do this operation). You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify its success.

Specified by:
appendFileStream in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
Returns:
An OutputStream through which the remote file can be appended. If the data connection cannot be opened (for example, if the file does not exist), a null is returned (in which case you can check the reply code to determine the exact reason for the failure).
Throws:
java.io.IOException - If some error occurs.

ascii

public boolean ascii()
              throws java.io.IOException
Sets the file type of the file to be transferred, to ASCII.

Specified by:
ascii in interface FtpFileProvider
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

binary

public boolean binary()
               throws java.io.IOException
Sets the file type of the file to be transferred, to binary.

Specified by:
binary in interface FtpFileProvider
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

cd

public boolean cd(java.lang.String dirName)
           throws java.io.IOException
Changes the current working directory of the FTP session.

Specified by:
cd in interface FtpFileProvider
Parameters:
dirName - The new directory name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

connect

public void connect(java.lang.String host,
                    int port)
             throws java.net.SocketException,
                    java.io.IOException
Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.

Specified by:
connect in interface FtpFileProvider
Parameters:
host - The FTP host name.
port - The FTP server port.
Throws:
java.net.SocketException - If some socket error occurs.
java.io.IOException - If some input-output error occurs.

connect

public void connect(java.lang.String host,
                    int port,
                    java.lang.String encoding)
             throws java.net.SocketException,
                    java.io.IOException
Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.

Specified by:
connect in interface FtpFileProvider
Parameters:
host - The FTP host name.
port - The FTP server port.
encoding - The encoding for the server.
Throws:
java.net.SocketException - If some socket error occurs.
java.io.IOException - If some input-output error occurs.

deleteFile

public boolean deleteFile(java.lang.String remoteFileName)
                   throws java.io.IOException
Deletes a file on the remote FTP server.

Specified by:
deleteFile in interface FtpFileProvider
Parameters:
remoteFileName - The name of the remote file to be deleted.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

getDataConnectionMode

public int getDataConnectionMode()
Returns the current data connection mode (one of the _DATA_CONNECTION_MODE constants). For example, PASSIVE or ACTIVE.

Specified by:
getDataConnectionMode in interface FtpFileProvider
Returns:
The data connection mode.

getSystemName

public java.lang.String getSystemName()
                               throws java.io.IOException
Retrieves the system type name from the server and returns the string.

Specified by:
getSystemName in interface FtpFileProvider
Returns:
The system name.
Throws:
java.io.IOException - If some error occurs.

image

public boolean image()
              throws java.io.IOException
Sets the file type of the file to be transferred, to "Image."

Specified by:
image in interface FtpFileProvider
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

isConnected

public boolean isConnected()
Checks on whether the client is currently connected to a server.

Specified by:
isConnected in interface FtpFileProvider
Returns:
true if the client is connected, but false if not.

isNegativePermanent

public boolean isNegativePermanent(int replyCode)
Checks on whether the FTP operation is "Negative Permanent;" the return code can be any integer from 500 through 599.

Specified by:
isNegativePermanent in interface FtpFileProvider
Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Negative Permanent."

isNegativeTransient

public boolean isNegativeTransient(int replyCode)
Checks on whether the FTP operation is "Negative Transient;" the return code can be any integer from 400 through 499.

Specified by:
isNegativeTransient in interface FtpFileProvider
Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Negative Transient."

isPositiveCompletion

public boolean isPositiveCompletion(int replyCode)
Checks on whether the FTP operation is "Positive Completion;" the return code can be any integer from 200 through 299.

Specified by:
isPositiveCompletion in interface FtpFileProvider
Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Positive Completion."

isPositiveIntermediate

public boolean isPositiveIntermediate(int replyCode)
Checks on whether the FTP operation is "Positive Intermediate;" the return code can be any integer from 300 through 399.

Specified by:
isPositiveIntermediate in interface FtpFileProvider
Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Positive Intermediate."

isPositivePreliminary

public boolean isPositivePreliminary(int replyCode)
Checks on whether the FTP operation is "Positive Preliminary;" the return code can be any integer from 100 through 199.

Specified by:
isPositivePreliminary in interface FtpFileProvider
Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Positive Preliminary."

listHelp

public java.lang.String listHelp()
                          throws java.io.IOException
Retrieves the system help information from the remote FTP server and returns the full string.

Specified by:
listHelp in interface FtpFileProvider
Returns:
The system help information.
Throws:
java.io.IOException - If some error occurs.

listHelp

public java.lang.String listHelp(java.lang.String command)
                          throws java.io.IOException
Retrieves the help information for a given command from the remote FTP server and returns the full string.

Specified by:
listHelp in interface FtpFileProvider
Parameters:
command - The command given.
Returns:
The system help information.
Throws:
java.io.IOException - If some error occurs.

login

public boolean login(java.lang.String user,
                     java.lang.String password)
              throws java.io.IOException
Logs into the remote FTP server using the provided user name and password.

Specified by:
login in interface FtpFileProvider
Parameters:
user - The user name.
password - The password.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

logout

public boolean logout()
               throws java.io.IOException
Logs out of the remote FTP server by sending the QUIT command.

Specified by:
logout in interface FtpFileProvider
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

pwd

public java.lang.String pwd()
                     throws java.io.IOException
Returns the path name of the current working directory.

Specified by:
pwd in interface FtpFileProvider
Returns:
The current working path name.
Throws:
java.io.IOException - If some error occurs.

rename

public boolean rename(java.lang.String remoteFileNameFrom,
                      java.lang.String remoteFileNameTo)
               throws java.io.IOException
Renames a remote file.

Specified by:
rename in interface FtpFileProvider
Parameters:
remoteFileNameFrom - The old remote file name.
remoteFileNameTo - The new remote file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

public boolean retrieveFile(java.lang.String remoteFileName,
                            java.io.OutputStream local)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given OutputStream. The OutputSteam is NOT closed in this method.

Specified by:
retrieveFile in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
local - The local output stream.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

public boolean retrieveFile(java.lang.String remoteDirName,
                            java.lang.String remoteBaseFileName,
                            java.io.OutputStream local)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given OutputStream. The OutputSteam is NOT closed in this method.

Specified by:
retrieveFile in interface FtpFileProvider
Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote base file name.
local - The local output stream.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFileStream

public java.io.InputStream retrieveFileStream(java.lang.String remoteFileName)
                                       throws java.io.IOException
Returns an InputStream from which a named file from the remote FTP server can be read. If the current file type is ASCII, the returned InputStream converts the line separators in the file to the local representation. You must close the InputStream when you finish reading from it. The InputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer you must call the method completePendingCommand() and check its return value to verify your success.

Specified by:
retrieveFileStream in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
Returns:
An InputStream from which the remote file can be read. If the data connection cannot be opened (for example, if the file does not exist), a null is returned, in which case you can check the reply code to determine the exact reason for failure.
Throws:
java.io.IOException - If some error occurs.

sendCommand

public int sendCommand(java.lang.String command)
                throws java.io.IOException
Sends an FTP command without a parameter to the remote FTP server. The method then waits for a reply and returns the numerical response code.

Specified by:
sendCommand in interface FtpFileProvider
Parameters:
command - The FTP command to be executed.
Returns:
The reply code from the FTP command.
Throws:
java.io.IOException - If some error occurs.

sendSiteCommand

public boolean sendSiteCommand(java.lang.String command)
                        throws java.io.IOException
send a site command to FTP server

Specified by:
sendSiteCommand in interface FtpFileProvider
Parameters:
command - - site command
Returns:
- true, success, false, failure;
Throws:
java.io.IOException

storeFile

public boolean storeFile(java.lang.String remoteFileName,
                         java.io.InputStream local)
                  throws java.io.IOException
Stores a file on the remote FTP server using the given name and taking its input from the given InputStream. The InputSteam is NOT closed in this method.

Specified by:
storeFile in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
local - The local input stream.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

storeFile

public boolean storeFile(java.lang.String remoteDirName,
                         java.lang.String remoteBaseFileName,
                         java.io.InputStream local)
                  throws java.io.IOException
Stores a file on the remote FTP server using the given name and taking its input from the given InputStream. The InputSteam is NOT closed in this method.

Specified by:
storeFile in interface FtpFileProvider
Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote file name.
local - The local input stream.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

storeFileStream

public java.io.OutputStream storeFileStream(java.lang.String remoteFileName)
                                     throws java.io.IOException
Returns an OutputStream through which data can be written to store a file on the server using the given name. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format , that is, you do not have to create a special OutputStream to do this operation. You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify your success.

Specified by:
storeFileStream in interface FtpFileProvider
Parameters:
remoteFileName - The remote file name.
Returns:
An OutputStream through which the remote file can be written. If the data connection cannot be opened (for example, the file does not exist), a null is returned. In such cases, you can check the reply code to determine the exact reason for failure.
Throws:
java.io.IOException - If some error occurs.

useActive

public void useActive()
Sets the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.

Specified by:
useActive in interface FtpFileProvider

usePassive

public void usePassive()
Sets the current data connection mode to PASSIVE_LOCAL_DATA_CONNECTION_MODE.

Specified by:
usePassive in interface FtpFileProvider

archiveFile

public boolean archiveFile(java.lang.String dirNameFrom,
                           java.lang.String baseFileNameFrom,
                           java.lang.String dirNameTo,
                           java.lang.String baseFileNameTo)
                    throws java.io.IOException
Renames a remote file. The difference between this method and rename() is that this method can also create the target path if it does not already exist.

Specified by:
archiveFile in interface FtpFileProvider
Parameters:
dirNameFrom - The remote directory name.
baseFileNameFrom - The remote base file name.
dirNameTo - The remote directory name.
baseFileNameTo - The remote base file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

completePendingCommand

public boolean completePendingCommand()
                               throws java.io.IOException
Receives an FTPClient method's completion reply from the server and verifies the success of the entire transaction, after the programmer's code completes its actions. There are a few FTPClient methods that do not complete the entire sequence of FTP commands when completing a transaction. These commands require action by the programmer, using this method, after the reception of a positive intermediate command.

Specified by:
completePendingCommand in interface FtpFileProvider
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

listFileNames

public java.lang.String[] listFileNames(com.oroinc.net.ftp.FTPFile[] files)
                                 throws java.io.IOException
Gets the name for all file entries that are related to real file data. This method filters out directory entries and pure symbolic link entries.

Specified by:
listFileNames in interface FtpFileProvider
Parameters:
files - An array of FTP ETD objects.
Returns:
An array of full file names.
Throws:
java.io.IOException - If some error occurs.

getHeuristics

public FtpHeuristics getHeuristics()
Retrieves an FtpHeuristics object.

Specified by:
getHeuristics in interface FtpFileProvider
Returns:
The FtpHeuristics object.

mkdir

public boolean mkdir(java.lang.String dir)
              throws java.io.IOException
Creates a new directory if the directory does not exist. For directory dir1/dir2, if the parent directory dir1 does not exist, the method fails. There is another method, mkdirs(), that creates all necessary parent directories.

Specified by:
mkdir in interface FtpFileProvider
Parameters:
dir - The directory name to be created.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

mkdirs

public boolean mkdirs(java.lang.String dir)
               throws java.io.IOException
Creates a new directory if the directory does not exist. This method also creates all necessary parent directories.

Specified by:
mkdirs in interface FtpFileProvider
Parameters:
dir - The directory name to be created.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

setSocketFactory

public void setSocketFactory(com.oroinc.net.SocketFactory factory)
Sets the SocketFactory used by the SocketClient to open socket connections. If the factory value is a null, a default factory value is used. Only use this method to reset the factory after you have previously altered it.

Specified by:
setSocketFactory in interface FtpFileProvider
Parameters:
factory - The new SocketFactory the SocketClient must use.

disConnect

public void disConnect()
                throws java.io.IOException
Closes the connection to the remote FTP server and restores the e*Way Connection parameters to the default values.

Specified by:
disConnect in interface FtpFileProvider
Throws:
java.io.IOException - If some error occurs.

ebcdic

public boolean ebcdic()
               throws java.io.IOException
Sets the file type of the file to be transferred, to EBCDIC.

Specified by:
ebcdic in interface FtpFileProvider
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

getSoLinger

public int getSoLinger()
                throws java.net.SocketException
Returns the current SO_LINGER timeout (in seconds) of the currently opened socket. A -1 return means that the option is disabled. The setting only affects socket closing.

Specified by:
getSoLinger in interface FtpFileProvider
Returns:
The current SO_LINGER timeout. If SO_LINGER is disabled, the return is -1.
Throws:
java.net.SocketException - If the operation fails.

getSoTimeout

public int getSoTimeout()
                 throws java.net.SocketException
Returns the timeout, in milliseconds, of the currently opened socket.

Specified by:
getSoTimeout in interface FtpFileProvider
Returns:
The timeout, in milliseconds, of the currently opened socket.
Throws:
java.net.SocketException - If the operation fails.

getTcpNoDelay

public boolean getTcpNoDelay()
                      throws java.net.SocketException
Allows you to determine whether Nagle's algorithm is enabled on the currently opened socket.

Specified by:
getTcpNoDelay in interface FtpFileProvider
Returns:
true if Nagle's algorithm is enabled on the currently opened socket, but false if otherwise.
Throws:
java.net.SocketException - If the operation fails.

isRemoteVerificationEnabled

public boolean isRemoteVerificationEnabled()
Allows you to determine whether verification of the remote FTP host participating in data connections is enabled. The default is for verification to be enabled.

Specified by:
isRemoteVerificationEnabled in interface FtpFileProvider
Returns:
true if verification is enabled, but false if not.

main

public static void main(java.lang.String[] args)
Used to do stand-alone testing.

Parameters:
args - Command-line parameters.

setRemoteVerificationEnabled

public void setRemoteVerificationEnabled(boolean enable)
Allows you to enable or disable verification that the remote FTP host taking part in a given data connection is the same as the host to which the control connection is attached. The default is for verification to be enabled. You can set this value at any time, whether the FTP client is currently connected or not.

Specified by:
setRemoteVerificationEnabled in interface FtpFileProvider
Parameters:
enable - true enables verification, and false disables it.

setSoLinger

public void setSoLinger(boolean on,
                        int val)
                 throws java.net.SocketException
Sets the SO_LINGER timeout (in seconds) on the currently opened command socket. The maximum timeout value is platform-specific. The setting only affects the closing of the socket.

Specified by:
setSoLinger in interface FtpFileProvider
Parameters:
on - true if the timeout is to be enabled, and false if not.
val - The timeout in seconds (in hundredths of a second?)
Throws:
java.net.SocketException - If the operation fails.

setSoTimeout

public void setSoTimeout(int timeout)
                  throws java.net.SocketException
Sets the timeout, in milliseconds, of a currently open command connection. Only call this method after a command connection has been opened by the connect() method. A timeout of zero is interpreted as an infinite timeout. To set the timeout before using connect() and avoiding the possible blocking of the connect() method, instead use the method setDefaultTimeout(). The timeout set by setDefaultTimeout() can be overwritten by the timeout set by setSoTimeout().

Specified by:
setSoTimeout in interface FtpFileProvider
Parameters:
timeout - The timeout, in milliseconds, to use for the currently open command connection socket.
Throws:
java.net.SocketException - If the operation fails.

setTcpNoDelay

public void setTcpNoDelay(boolean on)
                   throws java.net.SocketException
Allows you to enable or disable the Nagle's algorithm (TCP_NODELAY) on the currently opened command socket.

Specified by:
setTcpNoDelay in interface FtpFileProvider
Parameters:
on - true to enable Nagle's algorithm, and false to disable.
Throws:
java.net.SocketException - If the operation fails.

rmdir

public boolean rmdir(java.lang.String dirName)
              throws java.io.IOException
Removes a directory on the FTP server, if it is empty.

Specified by:
rmdir in interface FtpFileProvider
Parameters:
dirName - The name of the remote directory to remove.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

setDataSocketTimeout

public void setDataSocketTimeout(int timeout)
Sets the timeout, in milliseconds, to use when reading from the data connection. This timeout is set immediately after the data connection is opened. NOTE: This connection is not the command connection.

Specified by:
setDataSocketTimeout in interface FtpFileProvider
Parameters:
timeout - The timeout, in milliseconds, that is used when opening a data connection socket.

initialize

public void initialize(FtpETD etd)
                throws FtpFileException
Initializes the FTP ETD object.

Specified by:
initialize in interface FtpFileProvider
Parameters:
etd - The FTP ETD instance.
Throws:
FtpFileException - If some error occurs.

setDirListingStyle

public void setDirListingStyle(java.lang.String dirListingStyle)
                        throws java.lang.Exception
Initializes and updates the FTP heuristics using a specified directory-listing style.

Specified by:
setDirListingStyle in interface FtpFileProvider
Parameters:
dirListingStyle - The directory-listing style.
Throws:
java.lang.Exception - If some error occurs.

setUserDefinedHeuristicsInfo

public void setUserDefinedHeuristicsInfo(java.lang.String userDefinedDirListingStyle,
                                         java.lang.String userDefinedHeuristicsCfgFile)
                                  throws java.lang.Exception
Initializes and updates the FTP heuristics using a user specified directory-listing style.

Specified by:
setUserDefinedHeuristicsInfo in interface FtpFileProvider
Parameters:
userDefinedDirListingStyle - The user defined directory-listing style.
userDefinedHeuristicsCfgFile - The heuristics configuration file path on logical host containing user defined heuristics information.
Throws:
java.lang.Exception - If error occurs.

getFirstFileName

public java.lang.String getFirstFileName(java.lang.String dir,
                                         boolean isDirRegex,
                                         java.lang.String file,
                                         boolean isFileRegex)
                                  throws java.io.IOException
Get the first matching remote file name based on the remote directory regular expression and the remote file regular expression.

Specified by:
getFirstFileName in interface FtpFileProvider
Parameters:
dir - The directory name.
isDirRegex - Determines whether the directory name is a regular expression.
file - The file name.
isFileRegex - Determines whether the file name is a regular expression.
Returns:
The full file name.
Throws:
java.io.IOException - If some error occurs.

listFileNames

public java.lang.String[] listFileNames(java.lang.String dir,
                                        boolean isDirRegex,
                                        java.lang.String file,
                                        boolean isFileRegex)
                                 throws java.io.IOException
Lists the remote full file names based on the remote directory regular expression and remote file regular expression.

Specified by:
listFileNames in interface FtpFileProvider
Parameters:
dir - The directory name.
isDirRegex - Determines whether the directory name is a regular expression.
file - The file name.
isFileRegex - Determines whether the file name is a regular expression.
Returns:
The full file names.
Throws:
java.io.IOException - If some error occurs.

getDefaultFileListParser

public com.oroinc.net.ftp.FTPFileListParser getDefaultFileListParser()
Retrieves the defaultFileListParser object

Returns:
FTPFileListParser

getDelegate

public com.oroinc.net.ftp.FTPClient getDelegate()
Retrieves the delegate object

Returns:
FTPClient

setDefaultFileListParser

public void setDefaultFileListParser(com.oroinc.net.ftp.FTPFileListParser parser)
Sets the defaultFileListParser object

Parameters:
parser - FTPFileListParser instance

setDelegate

public void setDelegate(com.oroinc.net.ftp.FTPClient client)
Sets the delegate object

Parameters:
client - FTPClient instance

setHeuristics

public void setHeuristics(FtpHeuristics heuristics)
Sets the heuristics object

Parameters:
heuristics - FtpHeuristics instance

Sun Adapter for Batch/FTP