toolbox.ftp
Class FTPGetClientCommonsImpl

Package class diagram package FTPGetClientCommonsImpl
java.lang.Object
  extended by toolbox.ftp.FTPGetClientCommonsImpl
All Implemented Interfaces:
FTPGetClient

public class FTPGetClientCommonsImpl
extends java.lang.Object
implements FTPGetClient

Implementation of the FTPGetClient interface that employs the Apache Commons Net FTP package.


Constructor Summary
FTPGetClientCommonsImpl()
          Default constructor.
 
Method Summary
 void destroy()
          Destroy this client.
 java.lang.String getName()
          Return the name of this client.
 void getRemoteFile(java.lang.String fileName)
          Retrieve a single file from the configured remote directory and place the file in the configured local directory.
 void getRemoteFiles()
          Retrieve all the files from the configured remote directory and place them in the configured local directory.
 void getRemoteFiles(int fileCount)
          Retrieve n number of files from the configured remote directory and place them in the configured local directory.
 void init(java.lang.String name, java.util.Map props, FTPManager manager)
          Initialise this client with a reference to the manager that created it.
 void setFTPGetListener(FTPGetListener listener)
          Set the listener that must be used by this client to process downloaded files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FTPGetClientCommonsImpl

public FTPGetClientCommonsImpl()
Default constructor.

Method Detail

init

public void init(java.lang.String name,
                 java.util.Map props,
                 FTPManager manager)
Initialise this client with a reference to the manager that created it.

Specified by:
init in interface FTPGetClient
Parameters:
name - Sting containing the name of this client.
props - Map instance containing the client configuration properties.
manager - FTPManager instance that created this client.

getName

public java.lang.String getName()
Return the name of this client.

Specified by:
getName in interface FTPGetClient
Returns:
String containing the name of this client.

setFTPGetListener

public void setFTPGetListener(FTPGetListener listener)
Set the listener that must be used by this client to process downloaded files.

Specified by:
setFTPGetListener in interface FTPGetClient
Parameters:
listener - FTPGetListener implementation that must be used to process downloaded files.

getRemoteFile

public void getRemoteFile(java.lang.String fileName)
                   throws FTPException
Retrieve a single file from the configured remote directory and place the file in the configured local directory.

A FTPGetEvent is delivered to the configured listener.

Specified by:
getRemoteFile in interface FTPGetClient
Parameters:
fileName - String containing the name of the remote file.
Throws:
FTPException - if the file cannot be retrieved.

getRemoteFiles

public void getRemoteFiles()
                    throws FTPException
Retrieve all the files from the configured remote directory and place them in the configured local directory.

The FTPGetEvent(s) is delivered to the configured listener depending on the configured event mode.

Specified by:
getRemoteFiles in interface FTPGetClient
Throws:
FTPException - if the files cannot be retrieved.

getRemoteFiles

public void getRemoteFiles(int fileCount)
                    throws FTPException
Retrieve n number of files from the configured remote directory and place them in the configured local directory.

The FTPGetEvent(s) is delivered to the configured listener depending on the configured event mode.

Specified by:
getRemoteFiles in interface FTPGetClient
Parameters:
fileCount - int indicating the maximum number of files that may be retrieved. Pass -1 to retrieve all files.
Throws:
FTPException - if the files cannot be retrieved.

destroy

public void destroy()
Destroy this client.

Specified by:
destroy in interface FTPGetClient