com.ibm.network.ftp.protocol
Class FTPProtocol

java.lang.Object
  |
  +--com.ibm.network.ftp.protocol.FTPProtocol
All Implemented Interfaces:
com.ibm.network.ftp.event.CommandListener, java.util.EventListener, java.io.Serializable

public class FTPProtocol
extends java.lang.Object
implements com.ibm.network.ftp.event.CommandListener, java.io.Serializable

This class provides FTP protocol services. All the frequently used FTP commands is implemented by this class and provided in the form of APIs. This FTP protocol can connect to a FTP server outside a firewall and automatically interact in passive mode. It listens for CommandEvents by implementing CommandListener . The CommandEvent carries the command name to be executed. This class throws StatusEvent which carries the current status of FTP connection. This class throws LocalFileListEvent and RemoteFileListEvent which carry the local and remote current directory and their file listing. The details of local and remote files are stored in a vector of FileInfo objects.

See Also:
CommandListener, StatusEvent, RemoteFileListEvent, LocalFileListEvent, FileInfo, Response, Serialized Form

Field Summary
protected  java.beans.PropertyChangeSupport propertyChange
           
 
Constructor Summary
FTPProtocol()
          Creates an object of FTPProtocol class.
 
Method Summary
 void abort()
          Aborts the last issued command.
 void addLocalFileListListener(com.ibm.network.ftp.event.LocalFileListListener listener)
          Adds the specified LocalFileListListener to receive LocalFileListEvents from this FTPProtocol object.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          The addPropertyChangeListener method was generated to support the propertyChange field.
 void addRemoteFileListListener(com.ibm.network.ftp.event.RemoteFileListListener listener)
          Adds the specified RemoteFileListListener to receive RemoteFileListEvents from this FTPProtocol object.
 void addStatusListener(com.ibm.network.ftp.event.StatusListener listener)
          Adds the specified StatusListener to receive StatusEvents from this FTPProtocol object.
 void changeDir(java.lang.String newName, boolean remote)
          Changes directory whose pathname is specified by the first string parameter.
 void changeDirList(java.lang.String newName, boolean remote)
          Changes directory whose pathname is specified by the first string parameter.
 void commandPerformed(com.ibm.network.ftp.event.CommandEvent cevent)
          Implements the commandPerformed method defined in CommandListener interface.
 void configureSocks(java.lang.String hostName, java.lang.String port)
          Configures socksProxyHost and socksProxyPort.
 void connect(java.lang.String hostName)
          Connects to the specified host.
 void connect(java.lang.String hostName, java.lang.String port)
          Connects to the specified host.
 void connectLogin(java.lang.String hostName, java.lang.String user, java.lang.String pwd)
          Connects to the specified host.
 void connectLogin(java.lang.String hostName, java.lang.String port, java.lang.String user, java.lang.String pwd)
          Connects to the specified host.
 void deleteFile(java.lang.String fileName, boolean remote)
          Deletes the specified file.
 void deleteFile(java.util.Vector fileNames, boolean remote)
          Deletes the specified file(s).
 void deleteFileList(java.lang.String fileName, boolean remote)
          Deletes the specified file.
 void deleteFileList(java.util.Vector fileNames, boolean remote)
          Deletes the specified file(s).
 void disconnect()
          Disconnect from the FTP server.
 void fileList(boolean remote)
          This method lists files from the current working directory.
 void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          The firePropertyChange method was generated to support the propertyChange field.
 int getBufferSize()
          Gets the bufferSize property value.
protected  boolean getBusy()
          Gets the busy property value.
 int getBytesRead()
          Gets the bytesRead property value which shows the count of read bytes for downloading file.
 int getBytesWrite()
          Gets the bytesWrite property (int) value.
 java.lang.String getCurrentDir(boolean remote)
          Gets the current working directory.
 void getFile(java.lang.String fileName)
          Download the specified file from the FTP server.
 void getFile(java.lang.String fileName, java.lang.String localFileName)
          Download the specified file from the FTP server.
 void getFile(java.util.Vector fileNames)
          Download the specified file(s) from the FTP server.
 void getFileList(java.lang.String fileName)
          Download the specified file(s) from the FTP server.
 void getFileList(java.util.Vector fileNames)
          Download the specified file(s) from the FTP server.
 java.io.InputStream getInpStream()
          Return current input stream.
 java.lang.String getLocalDir()
          Returns the current local directory.
 java.util.Vector getLocalFileList()
          Returns a Vector of FileInfo objects.
 java.lang.String getName()
          This method was created in VisualAge.
 java.io.OutputStream getOutStream()
          Return current output stream.
 java.lang.String getPortString()
           
protected  java.beans.PropertyChangeSupport getPropertyChange()
          Accessor for the propertyChange field.
 java.lang.String getRemoteDir()
          Returns the FTP server working directory.
 java.util.Vector getRemoteFileList()
          Returns a Vector of FileInfo objects.
 java.lang.String getRemoteOperatingSystem()
          Returns the Operating System.
protected  Remote getRemoteProtocol()
          This method was created by a SmartGuide.
 boolean getRestartable()
          Gets the restartable property (boolean) value which indicates restartable feature for FTP server.
 int getRestartCount()
          Gets the restartCount property (int) value.
 int getRestartCounter()
          Gets the restartCounter property (int) value which indicates restart attempts.
 java.lang.String getSocksProxyHost()
          Returns socksProxyHost.
 java.lang.String getSocksProxyPort()
          Returns socksProxyPort.
 java.lang.String getStatus()
          This method returns the latest status of connection to FTP server.
 int getTimeout()
          Gets the timeout property in ms (int) value which indicates the period of time after which the bean breaks the socket connection if the expected remark has not been received.
 java.lang.String getType()
          This method returns the data transfer type,ie., either "ASCII" or "BINARY".
 boolean isStreamedInput()
          Return streamedInput flag.
 boolean isStreamedOutput()
          Rerturn streamedOutput flag.
 void list(boolean remote)
          Initializes remote or local file list.
 void login(java.lang.String userName, java.lang.String passwd)
          This method lets the user login to the connected FTP server.
 void makeDir(java.lang.String dirName, boolean remote)
          This method creates a directory in the current working directory.
 void makeDirList(java.lang.String dirName, boolean remote)
          This method creates a directory in the current working directory.
 void passiveServer()
          This method lets the user to configure the FTP server in passive mode.
 void putFile(java.lang.String fileName)
          Upload the specified file or specified input stream to the FTP server.
 void putFile(java.lang.String fileName, java.lang.String remoteFileName)
          Upload the specified file to the FTP server and stores it as the 2nd parameter.
 void putFile(java.util.Vector fileNames)
          Upload the specified file(s) to the FTP server.
 void putFileList(java.lang.String fileName)
          Upload the specified file to the FTP server.
 void putFileList(java.util.Vector fileNames)
          Upload the specified file(s) to the FTP server.
 void quote(java.lang.String param)
          Sends a QUOTE specific command to the FTP server
 void removeDir(java.lang.String dirName, boolean remote)
          Remove the named directory.
 void removeList(java.lang.String dirName, boolean remote)
          Remove the named directory or file.
 void removeList(java.util.Vector dirNames, boolean remote)
          Remove the named directories or files.
 void removeLocalFileListListener(com.ibm.network.ftp.event.LocalFileListListener listener)
          Removes the specified LocalFileListListener so that it no longer receives LocalFileListEvents from this protocol.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          The removePropertyChangeListener method was generated to support the propertyChange field.
 void removeRemoteFileListListener(com.ibm.network.ftp.event.RemoteFileListListener listener)
          Removes the specified RemoteFileListListener so that it no longer receives RemoteFileListEvents from this protocol.
 void removeStatusListener(com.ibm.network.ftp.event.StatusListener listener)
          Removes the specified StatusListener so that it no longer receives StatusEvents from this protocol.
 void rename(java.lang.String oldName, java.lang.String newName, boolean remote)
          Renames the file specified by the first argument to the name given by second argument.
 void renameList(java.lang.String oldName, java.lang.String newName, boolean remote)
          Renames the file specified by the first argument to the name given by second argument.
 void setBufferSize(int bufferSize)
          Sets the bufferSize property (int) value.
protected  void setBytesRead(int bytesRead)
          Sets the bytesRead property (int) value.
protected  void setBytesWrite(int bytesWrite)
          Sets the bytesWrite property (int) value.
 void setInpStream(java.io.InputStream in)
          Sets the inpStream property.
 void setName(java.lang.String newValue)
          Sets the name property.
 void setOutStream(java.io.OutputStream out)
          Sets the outStream property.
 void setPortString(java.lang.String i)
           
protected  void setRestartable(boolean restartable)
          Sets the restartable property (boolean) value.
 void setRestartCount(int restartCount)
          Sets the restartCount property (int) value.
protected  void setRestartCounter(int counter)
          This method was created in VisualAge.
 void setSocksProxyHost(java.lang.String socksProxyHost)
          Sets the SocksProxyHost.
 void setSocksProxyPort(java.lang.String socksProxyPort)
          Sets the SocksProxyPort.
 void setStreamedInput(boolean in)
          Sets the streamedInput property.
 void setStreamedOutput(boolean out)
          Sets the streamedOutput property.
 void setTimeout(int timeout)
          Sets the timeout property in ms (int) value indicates the period of time after which the bean breaks the socket connection if the expected remark has not been received.
 void setType(java.lang.String newType)
          This method sets the "TYPE" to be used for data transfer on the data connection.
 void site(java.lang.String s)
          Sends a Site specific command to the FTP server
 void status()
          Execute the status command on FTP server.
 void system()
          Sends a SYST command to the FTP server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyChange

protected transient java.beans.PropertyChangeSupport propertyChange
Constructor Detail

FTPProtocol

public FTPProtocol()
Creates an object of FTPProtocol class.
Method Detail

abort

public void abort()
Aborts the last issued command. This command will abort the previously issued FTP-commands such as LIST, RETR, and STOR, if these are running. If the execution of previously issued command is complete it will do nothing.

addLocalFileListListener

public void addLocalFileListListener(com.ibm.network.ftp.event.LocalFileListListener listener)
Adds the specified LocalFileListListener to receive LocalFileListEvents from this FTPProtocol object.
Parameters:
listener - LocalFileListListener
See Also:
LocalFileListListener

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
The addPropertyChangeListener method was generated to support the propertyChange field.

addRemoteFileListListener

public void addRemoteFileListListener(com.ibm.network.ftp.event.RemoteFileListListener listener)
Adds the specified RemoteFileListListener to receive RemoteFileListEvents from this FTPProtocol object.
Parameters:
listener - RemoteFileListListener
See Also:
RemoteFileListListener

addStatusListener

public void addStatusListener(com.ibm.network.ftp.event.StatusListener listener)
Adds the specified StatusListener to receive StatusEvents from this FTPProtocol object.
Parameters:
listener - StatusListener
See Also:
StatusListener

changeDir

public void changeDir(java.lang.String newName,
                      boolean remote)
               throws java.lang.IllegalArgumentException
Changes directory whose pathname is specified by the first string parameter. The second boolean parameter specifies whether the change directory is for local machine or remote FTP server. If second parameter is true then command is for remote machine else it is for local machine. This method throws IllegalArgumentException if user attempts to change directory without specifing the new directory name. After execution remoteFileList or localFileList property is set to empty Vector
Parameters:
newName - the new directory name.
remote - this boolean argument specifies whether the change directory is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If user tries to change directory without specifying the new directory name.

changeDirList

public void changeDirList(java.lang.String newName,
                          boolean remote)
                   throws java.lang.IllegalArgumentException
Changes directory whose pathname is specified by the first string parameter. The second boolean parameter specifies whether the change directory is for local machine or remote FTP server. If second parameter is true then command is for remote machine else it is for local machine. This method throws IllegalArgumentException if user attempts to change directory without specifing the new directory name. After directory was changed, the method gets local or remote file list and fire LocalFileListEvent or RemoteFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
newName - the new directory name.
remote - this boolean argument specifies whether the change directory is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If user tries to change directory without specifying the new directory name.

commandPerformed

public void commandPerformed(com.ibm.network.ftp.event.CommandEvent cevent)
                      throws java.lang.IllegalArgumentException
Implements the commandPerformed method defined in CommandListener interface. This method receives the CommandEvent from the CommandEvent sources and passes it on to CommandInterpreter.
Specified by:
commandPerformed in interface com.ibm.network.ftp.event.CommandListener
Parameters:
cevent - CommandEvent
Throws:
java.lang.IllegalArgumentException - If user calls this method with CommandEvent argument as null.
See Also:
CommandListener

configureSocks

public void configureSocks(java.lang.String hostName,
                           java.lang.String port)
                    throws java.lang.IllegalArgumentException
Configures socksProxyHost and socksProxyPort. The socksProxyHost and socksProxyPort are set by this method. The socks host will be used by the protocol for connecting to servers, when the client machine is behind a firewall.
Parameters:
hostName - the socksProxyHost IP or domain name.
port - the socksProxyPort.
Throws:
java.lang.IllegalArgumentException - If any of the arguments are null.

connect

public void connect(java.lang.String hostName)
             throws java.lang.IllegalArgumentException
Connects to the specified host. Creates a FTP connection to the named host. Uses the default port 21.
Parameters:
hostName - the IP address of the FTP server.
Throws:
java.lang.IllegalArgumentException - If the host name specified is null.

connect

public void connect(java.lang.String hostName,
                    java.lang.String port)
             throws java.lang.IllegalArgumentException
Connects to the specified host. Creates a FTP connection to the named host and port.
Parameters:
hostName - the IP address of the FTP server.
port - the port of the FTP server.
Throws:
java.lang.IllegalArgumentException - If the host name specified is null.

connectLogin

public void connectLogin(java.lang.String hostName,
                         java.lang.String user,
                         java.lang.String pwd)
Connects to the specified host. Creates a FTP connection to the named host. Gets the current remote directory and it contents. Fires RemoteFileListEvent after it. Then method lets the user login to the connected FTP server. It takes the user name and password as the parameters. User can either specify his login name and password or connect as a anonymous user. In the later case he/she has to specify his/her email id as the password. This method was created for compatibility with FTPUI bean.
Parameters:
hostName - the IP address of the FTP server.
user - user name of the user profile on the FTP server.
pwd - password of user profile on the FTP server.
Throws:
java.lang.IllegalArgumentException - If the host name specified is null.

connectLogin

public void connectLogin(java.lang.String hostName,
                         java.lang.String port,
                         java.lang.String user,
                         java.lang.String pwd)
Connects to the specified host. Creates a FTP connection to the named host. Gets the current remote directory and it contents. Fires RemoteFileListEvent after it. Then method lets the user login to the connected FTP server. It takes the user name and password as the parameters. User can either specify his login name and password or connect as a anonymous user. In the later case he/she has to specify his/her email id as the password. This method was created for compatibility with FTPUI bean.
Parameters:
hostName - the IP address of the FTP server.
port - the port number of the FTP server.
user - user name of the user profile on the FTP server.
pwd - password of user profile on the FTP server.
Throws:
java.lang.IllegalArgumentException - If the host name specified is null.

deleteFile

public void deleteFile(java.lang.String fileName,
                       boolean remote)
                throws java.lang.IllegalArgumentException
Deletes the specified file. This method deletes the file name as specified by the first parameter. The second parameter decides whether the deletion has to be on local machine or remote FTP server. If second parameter is true then delete remote file else delete local file.
Parameters:
fileName - name of the file to be deleted.
remote - this boolean argument specifies whether the file deletion is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the file name specified is null.

deleteFile

public void deleteFile(java.util.Vector fileNames,
                       boolean remote)
                throws java.lang.IllegalArgumentException
Deletes the specified file(s). This method deletes the files names as specified by the first parameter. The second parameter decides whether the deletion has to be on local machine or remote FTP server. If second parameter is true then delete remote file else delete local file.
Parameters:
fileNames - Vector of objects of string type which contains file names to be deleted.
remote - this boolean argument specifies whether the file deletion is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the file name specified is null.

deleteFileList

public void deleteFileList(java.lang.String fileName,
                           boolean remote)
                    throws java.lang.IllegalArgumentException
Deletes the specified file. This method deletes the file name as specified by the first parameter. The second parameter decides whether the deletion has to be on local machine or remote FTP server. If second parameter is true then delete remote file else delete local file. After file was deleted, the method gets local or remote file list and fire LocalFileListEvent or remoteFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
fileName - name of the file to be deleted.
remote - this boolean argument specifies whether the file deletion is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the file name specified is null.

deleteFileList

public void deleteFileList(java.util.Vector fileNames,
                           boolean remote)
                    throws java.lang.IllegalArgumentException
Deletes the specified file(s). This method deletes the files names as specified by the first parameter. The second parameter decides whether the deletion has to be on local machine or remote FTP server. If second parameter is true then delete remote file else delete local file. After file was deleted, the method gets local or remote file list and fire LocalFileListEvent or remoteFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
fileNames - Vector of objects of string type which contains name of the file to be deleted.
remote - this boolean argument specifies whether the file deletion is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the file name specified is null.

disconnect

public void disconnect()
Disconnect from the FTP server. This method will close any active FTP connection. Throws RemoteFileListEvent to refresh the view, to all of the registered listeners.

fileList

public void fileList(boolean remote)
This method lists files from the current working directory. The boolean value decides whether the listing is for local machine or remote FTP server. If the parameter is true then listing is for FTP server or else the listing is for local machine. This method will throw LocalFileListEvent or RemoteFileListEvent depending on whether the listing is for local machine or remote FTP server.
Parameters:
remote - this boolean argument specifies whether the file listing is for local machine or FTP server.

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
The firePropertyChange method was generated to support the propertyChange field.

getBufferSize

public int getBufferSize()
Gets the bufferSize property value.
Returns:
The bufferSize property value.
See Also:
setBufferSize(int)

getBusy

protected boolean getBusy()
Gets the busy property value. If busy is true then any FTP operation is not completed.
Returns:
The busy property value.

getBytesRead

public int getBytesRead()
Gets the bytesRead property value which shows the count of read bytes for downloading file.
Returns:
The bytesRead property value.

getBytesWrite

public int getBytesWrite()
Gets the bytesWrite property (int) value.
Returns:
The bytesWrite property value.

getCurrentDir

public java.lang.String getCurrentDir(boolean remote)
Gets the current working directory. This method executes the proper commands to determine the current working directory.The "pwd" command is used for remote FTP server and System property "user.dir" is used for local machine. The boolean variable decides whether the command is for local or remote machine. If argument is true then the command is for FTP server else it is for local machine.
Parameters:
remote - this boolean argument specifies whether this method is executes for local machine or FTP server.
Returns:
current working directory on local machine or FTP server.

getFile

public void getFile(java.lang.String fileName)
             throws java.lang.IllegalArgumentException
Download the specified file from the FTP server. This method will download the specified file from the FTP server and store it on the local machine with the same file name.
Parameters:
fileName - name of the file to be downloaded.
Throws:
java.lang.IllegalArgumentException - If the specified file name is null.

getFile

public void getFile(java.lang.String fileName,
                    java.lang.String localFileName)
             throws java.lang.IllegalArgumentException
Download the specified file from the FTP server. This method will download the specified file from the FTP server and store it on the local machine with the file name supplied in the 2nd param.
Parameters:
fileName - name of the file to be downloaded.
localFileName - name of the target locla file.
Throws:
java.lang.IllegalArgumentException - If the specified file name is null.

getFile

public void getFile(java.util.Vector fileNames)
             throws java.lang.IllegalArgumentException
Download the specified file(s) from the FTP server. This method will download the specified file(s) from the FTP server and store it on the local machine with the same file name.
Parameters:
fileNames - Vector of objects of string type which contains names of the file to be downloaded.
Throws:
java.lang.IllegalArgumentException - If the specified vector is null.

getFileList

public void getFileList(java.lang.String fileName)
                 throws java.lang.IllegalArgumentException
Download the specified file(s) from the FTP server. This method will download the specified file(s) from the FTP server and store it on the local machine with the same file name. After downloading it gets local file list and fire LocalFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
fileNames - name of the file to be downloaded.
Throws:
java.lang.IllegalArgumentException - If the specified fileName is null.

getFileList

public void getFileList(java.util.Vector fileNames)
                 throws java.lang.IllegalArgumentException
Download the specified file(s) from the FTP server. This method will download the specified file(s) from the FTP server and store it on the local machine with the same file name. After downloading it gets local file list and fire LocalFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
fileNames - Vector of objects of string type which contains names of the file to be downloaded.
Throws:
java.lang.IllegalArgumentException - If the specified vector is null.

getInpStream

public java.io.InputStream getInpStream()
Return current input stream. Creation date: (20.03.00 15:34:20)
Returns:
java.io.InputStream

getLocalDir

public java.lang.String getLocalDir()
Returns the current local directory. This method returns the String value of the current local working directory.
Returns:
current local working directory.

getLocalFileList

public java.util.Vector getLocalFileList()
Returns a Vector of FileInfo objects. Each FileInfo element in the vector corresponds to a file in the local working directory. FileInfo contains other information like size,date and time for each file.
Returns:
vector of FileInfo objects representing the files in the current local working directory.
See Also:
FileInfo

getName

public java.lang.String getName()
This method was created in VisualAge.
Returns:
java.lang.String

getOutStream

public java.io.OutputStream getOutStream()
Return current output stream. Creation date: (20.03.00 15:34:58)
Returns:
java.io.OutputStream

getPortString

public java.lang.String getPortString()

getPropertyChange

protected java.beans.PropertyChangeSupport getPropertyChange()
Accessor for the propertyChange field.

getRemoteDir

public java.lang.String getRemoteDir()
Returns the FTP server working directory. This method returns the String value of the current working directory on the FTP server.
Returns:
current working directory on FTP server.

getRemoteFileList

public java.util.Vector getRemoteFileList()
Returns a Vector of FileInfo objects. Each FileInfo element in the vector corresponds to a file on the FTP server working directory. FileInfo contains other information like size,date and time for each file.
Returns:
vector of FileInfo objects representing the files in the current working directory of FTP server.
See Also:
FileInfo

getRemoteOperatingSystem

public java.lang.String getRemoteOperatingSystem()
Returns the Operating System. This method returns the String value of the Operating System of the remote FTP server, as it is reported by the 'system' command in the FTP specification.

getRemoteProtocol

protected Remote getRemoteProtocol()
This method was created by a SmartGuide.
Returns:
FTPProtocolBean.Protocol

getRestartable

public boolean getRestartable()
Gets the restartable property (boolean) value which indicates restartable feature for FTP server.
Returns:
The restartable property value.

getRestartCount

public int getRestartCount()
Gets the restartCount property (int) value. Max value attempts for restarting.
Returns:
The restartCount property value.
See Also:
setRestartCount(int)

getRestartCounter

public int getRestartCounter()
Gets the restartCounter property (int) value which indicates restart attempts.
Returns:
The restartCounter property value.

getSocksProxyHost

public java.lang.String getSocksProxyHost()
Returns socksProxyHost. This method returns the String value of the socksProxyHost used by the protocol to connect to FTP servers outside the Firewall. If the user hasn't configured the socks properties , this method will return null.
Returns:
the socksProxyHost name if initialized or else returns null.

getSocksProxyPort

public java.lang.String getSocksProxyPort()
Returns socksProxyPort. This method returns the String value of the socksProxyPort used by the protocol to connect to FTP servers outside the Firewall. If the user hasn't configured the socks properties , this method will return null.
Returns:
the socksProxyPort if initialized or else returns null.

getStatus

public java.lang.String getStatus()
This method returns the latest status of connection to FTP server. In most of the cases this method returns status of last issued command.
Returns:
the current FTP connection status.

getTimeout

public int getTimeout()
Gets the timeout property in ms (int) value which indicates the period of time after which the bean breaks the socket connection if the expected remark has not been received.
Returns:
The timeout property value.
See Also:
setTimeout(int)

getType

public java.lang.String getType()
This method returns the data transfer type,ie., either "ASCII" or "BINARY". By default,it returns "ASCII".
Returns:
the data transfer type.

isStreamedInput

public boolean isStreamedInput()
Return streamedInput flag. Creation date: (21.03.00 14:01:59)
Returns:
boolean

isStreamedOutput

public boolean isStreamedOutput()
Rerturn streamedOutput flag. Creation date: (21.03.00 14:03:12)
Returns:
boolean

list

public void list(boolean remote)
Initializes remote or local file list. It can be useful after executing such command as changeDir. After execution it fires RemoteFileListEvent or LocalFileListEvent accordance. If a parameter is true then command is for remote machine else it is for local machine. If remote is true then command LIST is sending to the FTP server
Parameters:
remote - this boolean argument specifies whether the change directory is for local machine or FTP server.

login

public void login(java.lang.String userName,
                  java.lang.String passwd)
           throws java.lang.IllegalArgumentException
This method lets the user login to the connected FTP server. It takes the user name and password as the parameters. User can either specify his login name and password or connect as a anonymous user. In the later case he/she has to specify his/her email id as the password.
Parameters:
userName - user name of the user profile on the FTP server.
passwd - password of user profile on the FTP server.

makeDir

public void makeDir(java.lang.String dirName,
                    boolean remote)
             throws java.lang.IllegalArgumentException
This method creates a directory in the current working directory. The first String parameter to this method specifies the directory name. The second boolean parameter decides whether the directory has to be created on local machine or on the FTP server. If second parameter is true then create directory on FTP server. If second parameter is false then create directory on local machine.
Parameters:
dirName - name of the directory to be created.
remote - this boolean argument specifies whether the create directory is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified directory name is null.

makeDirList

public void makeDirList(java.lang.String dirName,
                        boolean remote)
                 throws java.lang.IllegalArgumentException
This method creates a directory in the current working directory. The first String parameter to this method specifies the directory name. The second boolean parameter decides whether the directory has to be created on local machine or on the FTP server. If second parameter is true then create directory on FTP server. If second parameter is false then create directory on local machine. After directory making it gets local or remote file list and fire LocalFileListEvent or RemoteFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
dirName - name of the directory to be created.
remote - this boolean argument specifies whether the create directory is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified directory name is null.

passiveServer

public void passiveServer()
This method lets the user to configure the FTP server in passive mode. In this case the FTP server opens a passive data connection( Server Socket). The FTP client opens a active data connection. This method will have to be used for severs located outside firewall since they can't open a connection back to the host.The protocol automatically takes care of changing to passive mode if active mode attempt fails.

putFile

public void putFile(java.lang.String fileName)
             throws java.lang.IllegalArgumentException
Upload the specified file or specified input stream to the FTP server. This method uploads the specified file to the FTP server and store it on the server with the same file name. Or this method uploads the specified input stream to the FTP server and store it on the server with the specified file name. The method uses "STOR" command which overwrites any files with the same name as file to be uploaded.
Parameters:
fileName - name of the file to be uploaded on to the FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified file name is null.

putFile

public void putFile(java.lang.String fileName,
                    java.lang.String remoteFileName)
             throws java.lang.IllegalArgumentException
Upload the specified file to the FTP server and stores it as the 2nd parameter. This method uploads the specified file to the FTP server and store it on the server with the same file name. Or this method uploads the specified input stream to the FTP server and store it on the server with the specified file name. The method uses "STOR" command which overwrites any files with the same name as file to be uploaded.
Parameters:
fileName - name of the file to be uploaded on to the FTP server.
remoteFileName - name of the target file to be uploaded on to the FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified file name is null.

putFile

public void putFile(java.util.Vector fileNames)
             throws java.lang.IllegalArgumentException
Upload the specified file(s) to the FTP server. This method uploads the specified file(s) to the FTP server and store it on the server with the same file name(s).The method uses "STOR" command which overwrites any files with the same name as file to be uploaded.
Parameters:
fileNames - Vector of objects of string type which contains names of the files to be uploaded on to the FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified Vector is null.

putFileList

public void putFileList(java.lang.String fileName)
                 throws java.lang.IllegalArgumentException
Upload the specified file to the FTP server. This method uploads the specified file to the FTP server and store it on the server with the same file name.The method uses "STOR" command which overwrites any files with the same name as file to be uploaded. After file putting it gets remote file list and fire RemoteFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
fileName - name of the file to be uploaded on to the FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified file name is null.

putFileList

public void putFileList(java.util.Vector fileNames)
                 throws java.lang.IllegalArgumentException
Upload the specified file(s) to the FTP server. This method uploads the specified file(s) to the FTP server and store it on the server with the same file name(s).The method uses "STOR" command which overwrites any files with the same name as file to be uploaded. After file putting it gets remote file list and fire RemoteFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
fileNames - Vector of objects of string type which contains names of the files to be uploaded on to the FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified Vector is null.

quote

public void quote(java.lang.String param)
           throws java.lang.IllegalArgumentException
Sends a QUOTE specific command to the FTP server
Parameters:
param - - String value of specific command .

removeDir

public void removeDir(java.lang.String dirName,
                      boolean remote)
               throws java.lang.IllegalArgumentException
Remove the named directory. This method deletes the named directory form the FTP server or the local machine depending on the second boolean parameter. If second parameter is true then delete directory on the FTP server. If second parameter is false delete directory from the local machine. For deleting files on local machine, the directory has to be empty or else this command fails.
Parameters:
dirName - name of the directory to be deleted.
remote - boolean argument specifies whether the delete directory is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified directory name is null.

removeList

public void removeList(java.lang.String dirName,
                       boolean remote)
                throws java.lang.IllegalArgumentException
Remove the named directory or file. This method deletes the named directory or file form the FTP server or the local machine depending on the second boolean parameter. If second parameter is true then delete directory on the FTP server. If second parameter is false delete directory from the local machine. For deleting files on local machine, the directory has to be empty or else this command fails. If dirName presents directory name then directory name must be enclosed in brackets. After directory or file was deleted, the method gets local or remote file list and fire LocalFileListEvent or remoteFileListEvent. This method was created for compatibility with FTPUI bean. Note: If it is necessary to delete file, name of which is began and ended by brackets (e.g., file name is [and] ) you must use methods deleteFile or deleteFileList.
Parameters:
dirName - name of the directory or file to be deleted.
remote - boolean argument specifies whether the delete directory is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified directory name is null.

removeList

public void removeList(java.util.Vector dirNames,
                       boolean remote)
                throws java.lang.IllegalArgumentException
Remove the named directories or files. This method deletes the named directories or files form the FTP server or the local machine depending on the second boolean parameter. If second parameter is true then delete directory on the FTP server. If second parameter is false delete directory from the local machine. For deleting files on local machine, the directory has to be empty or else this command fails. If any element of dirNames presents directory name then directory name must be enclosed in brackets. After directories or files were deleted, the method gets local or remote file list and fire LocalFileListEvent or remoteFileListEvent. Note: If it is necessary to delete file, name of which is began and ended by brackets (e.g., file name is [and] ) you must use methods deleteFile or deleteFileList. This method was created for compatibility with FTPUI bean.
Parameters:
dirName - Vector of objects of string type which contains names of the directories or files to be deleted.
remote - boolean argument specifies whether the delete directory is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If the specified directory name is null.

removeLocalFileListListener

public void removeLocalFileListListener(com.ibm.network.ftp.event.LocalFileListListener listener)
Removes the specified LocalFileListListener so that it no longer receives LocalFileListEvents from this protocol. LocalFilelList events occur whenever a new local file listing has to be notified to the registered listeners.
Parameters:
listener - LocalFileListListener to be removed from LocalFileListListener listeners list.
See Also:
LocalFileListListener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
The removePropertyChangeListener method was generated to support the propertyChange field.

removeRemoteFileListListener

public void removeRemoteFileListListener(com.ibm.network.ftp.event.RemoteFileListListener listener)
Removes the specified RemoteFileListListener so that it no longer receives RemoteFileListEvents from this protocol. RemoteFilelList events occur whenever a new remote file listing has to be notified to the registered listeners.
Parameters:
listener - RemoteFileListListener to be removed from RemoteFileListListener listeners list.
See Also:
RemoteFileListListener

removeStatusListener

public void removeStatusListener(com.ibm.network.ftp.event.StatusListener listener)
Removes the specified StatusListener so that it no longer receives StatusEvents from this protocol. StatusEvent occurs whenever a new status has to be notified to the registered listeners.
Parameters:
listener - StatusListener to be removed from the StatusListener listeners list.
See Also:
StatusListener

rename

public void rename(java.lang.String oldName,
                   java.lang.String newName,
                   boolean remote)
            throws java.lang.IllegalArgumentException
Renames the file specified by the first argument to the name given by second argument. The first argument specifies the file that has to be renamed. The second argument specifies the new name for the file.The file named by the first argument should exist in the current working directory. The third boolean parameter determines whether the rename has to be done on local machine or on remote machine. If third parameter is true then rename on FTP server else on local machine.
Parameters:
oldName - name of the file to be renamed.
newName - new name of the file to be renamed.
remote - this boolean argument specifies whether the rename file is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If any of the newName or oldName parameters are null.

renameList

public void renameList(java.lang.String oldName,
                       java.lang.String newName,
                       boolean remote)
                throws java.lang.IllegalArgumentException
Renames the file specified by the first argument to the name given by second argument. The first argument specifies the file that has to be renamed. The second argument specifies the new name for the file.The file named by the first argument should exist in the current working directory. The third boolean parameter determines whether the rename has to be done on local machine or on remote machine. If third parameter is true then rename on FTP server else on local machine. After renaming it gets local or remote file list and fire LocalFileListEvent or RemoteFileListEvent. This method was created for compatibility with FTPUI bean.
Parameters:
oldName - name of the file to be renamed.
newName - new name of the file to be renamed.
remote - this boolean argument specifies whether the rename file is for local machine or FTP server.
Throws:
java.lang.IllegalArgumentException - If any of the newName or oldName parameters are null.

setBufferSize

public void setBufferSize(int bufferSize)
Sets the bufferSize property (int) value. Buffer size in bytes for file transfer.
Parameters:
bufferSize - The new value for the property.
See Also:
getBufferSize()

setBytesRead

protected void setBytesRead(int bytesRead)
Sets the bytesRead property (int) value.
Parameters:
bytesRead - The new value for the property.

setBytesWrite

protected void setBytesWrite(int bytesWrite)
Sets the bytesWrite property (int) value.
Parameters:
bytesWrite - The new value for the property.

setInpStream

public void setInpStream(java.io.InputStream in)
Sets the inpStream property. Creation date: (20.03.00 15:28:40)
Parameters:
userStream - java.io.InputStream

setName

public void setName(java.lang.String newValue)
Sets the name property.
Parameters:
newValue - java.lang.String

setOutStream

public void setOutStream(java.io.OutputStream out)
Sets the outStream property. Creation date: (20.03.00 15:32:55)
Parameters:
userStream - java.io.OutputStream

setPortString

public void setPortString(java.lang.String i)

setRestartable

protected void setRestartable(boolean restartable)
Sets the restartable property (boolean) value.
Parameters:
restartable - boolean
See Also:
getRestartable()

setRestartCount

public void setRestartCount(int restartCount)
Sets the restartCount property (int) value. Max value attempts for restarting.
Parameters:
restartCount - The new value for the property.
See Also:
getRestartCount()

setRestartCounter

protected void setRestartCounter(int counter)
This method was created in VisualAge.
Parameters:
counter - int

setSocksProxyHost

public void setSocksProxyHost(java.lang.String socksProxyHost)
                       throws java.lang.IllegalArgumentException
Sets the SocksProxyHost. This method takes a String parameter and sets the SocksProxyHost to be used for connecting to Servers outside firewall.
Parameters:
socksProxyHost - domain name or the IP address of socksProxyHost.
Throws:
java.lang.IllegalArgumentException - If the socksProxyHost argument is null.

setSocksProxyPort

public void setSocksProxyPort(java.lang.String socksProxyPort)
                       throws java.lang.IllegalArgumentException
Sets the SocksProxyPort. This method takes a String parameter and sets the SocksProxyPort to be used for connecting to Servers outside firewall.
Parameters:
socksProxyPort - socksProxyPort as a String.
Throws:
java.lang.IllegalArgumentException - If the socksProxyPort argument is null.

setStreamedInput

public void setStreamedInput(boolean in)
Sets the streamedInput property. Creation date: (21.03.00 14:01:23)
Parameters:
in - boolean

setStreamedOutput

public void setStreamedOutput(boolean out)
Sets the streamedOutput property. Creation date: (21.03.00 14:02:41)
Parameters:
out - boolean

setTimeout

public void setTimeout(int timeout)
Sets the timeout property in ms (int) value indicates the period of time after which the bean breaks the socket connection if the expected remark has not been received.
Parameters:
timeout - The new value for the property.
See Also:
getTimeout()

setType

public void setType(java.lang.String newType)
             throws java.lang.IllegalArgumentException
This method sets the "TYPE" to be used for data transfer on the data connection. The String parameter can specify "ASCII" for ascii data transfer and "BINARY" for binary data transfer.
Parameters:
type - data transfer type for the FTP connection.

site

public void site(java.lang.String s)
Sends a Site specific command to the FTP server
Parameters:
s - - String value of specific command .

status

public void status()
Execute the status command on FTP server. This method will execute the "STAT" command on the remote FTP server.

system

public void system()
Sends a SYST command to the FTP server