org.ow2.petals.bc.ftp.connection
Class WrappedFTPClient

java.lang.Object
  extended by org.apache.commons.net.SocketClient
      extended by org.apache.commons.net.ftp.FTP
          extended by org.apache.commons.net.ftp.FTPClient
              extended by org.ow2.petals.bc.ftp.connection.WrappedFTPClient
All Implemented Interfaces:
org.apache.commons.net.ftp.Configurable

public class WrappedFTPClient
extends org.apache.commons.net.ftp.FTPClient

This class handles a connection to the FTP server with the specified configuration parameter.

Author:
Mathieu CARROLLE - EBM WebSourcing

Field Summary
 
Fields inherited from class org.apache.commons.net.ftp.FTPClient
ACTIVE_LOCAL_DATA_CONNECTION_MODE, ACTIVE_REMOTE_DATA_CONNECTION_MODE, PASSIVE_LOCAL_DATA_CONNECTION_MODE, PASSIVE_REMOTE_DATA_CONNECTION_MODE
 
Fields inherited from class org.apache.commons.net.ftp.FTP
_commandSupport_, _controlEncoding, _controlInput_, _controlOutput_, _newReplyString, _replyCode, _replyLines, _replyString, ASCII_FILE_TYPE, BINARY_FILE_TYPE, BLOCK_TRANSFER_MODE, CARRIAGE_CONTROL_TEXT_FORMAT, COMPRESSED_TRANSFER_MODE, DEFAULT_CONTROL_ENCODING, DEFAULT_DATA_PORT, DEFAULT_PORT, EBCDIC_FILE_TYPE, FILE_STRUCTURE, LOCAL_FILE_TYPE, NON_PRINT_TEXT_FORMAT, PAGE_STRUCTURE, RECORD_STRUCTURE, STREAM_TRANSFER_MODE, strictMultilineParsing, TELNET_TEXT_FORMAT
 
Fields inherited from class org.apache.commons.net.SocketClient
_defaultPort_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL
 
Constructor Summary
WrappedFTPClient(FTPConnectionInfo connectionInfo, java.util.logging.Logger logger)
           
 
Method Summary
 void configureConnection()
          This method sets : the working directory the data connection mode (Active or Passive) the type of transfer (ASCII or Binary)
 void connectAndLog()
          Connect and log the FTP client with the current configuration
 void del(java.lang.String remoteFile)
          Deleted the specified remote file.
 org.w3c.dom.Document get(java.lang.String filePattern)
          Get a file content from a FTP server.
 FTPConnectionInfo getConnectionInfo()
           
 javax.activation.DataHandler getFileAsAttachment(java.lang.String filePatternWildCard)
          Get a file content from a FTP server.
 java.util.List<java.lang.String> listFolderContent()
          List files from FTP server
 void mDel(java.util.List<java.lang.String> remoteFiles)
           
 java.util.Map<java.lang.String,javax.activation.DataHandler> mGet(java.util.List<java.lang.String> filePatternWildCardList)
          This method will only get files, it does not include subpath
 void mPut(java.util.Map<java.lang.String,javax.activation.DataHandler> attachments)
          Put files on the FTP server.
 void putString(java.lang.String fileName, java.lang.String content)
          Put the file on the FTP server.
 
Methods inherited from class org.apache.commons.net.ftp.FTPClient
_connectAction_, _openDataConnection_, abort, allocate, allocate, appendFile, appendFileStream, changeToParentDirectory, changeWorkingDirectory, completePendingCommand, configure, deleteFile, disconnect, enterLocalActiveMode, enterLocalPassiveMode, enterRemoteActiveMode, enterRemotePassiveMode, getBufferSize, getDataConnectionMode, getListArguments, getListHiddenFiles, getModificationTime, getPassiveHost, getPassivePort, getRestartOffset, getStatus, getStatus, getSystemName, initiateListParsing, initiateListParsing, initiateListParsing, isRemoteVerificationEnabled, listFiles, listFiles, listHelp, listHelp, listNames, listNames, login, login, logout, makeDirectory, printWorkingDirectory, remoteAppend, remoteRetrieve, remoteStore, remoteStoreUnique, remoteStoreUnique, removeDirectory, rename, retrieveFile, retrieveFileStream, sendNoOp, sendSiteCommand, setBufferSize, setDataTimeout, setFileStructure, setFileTransferMode, setFileType, setFileType, setListHiddenFiles, setParserFactory, setRemoteVerificationEnabled, setRestartOffset, storeFile, storeFileStream, storeUniqueFile, storeUniqueFile, storeUniqueFileStream, storeUniqueFileStream, structureMount
 
Methods inherited from class org.apache.commons.net.ftp.FTP
abor, acct, addProtocolCommandListener, allo, allo, appe, cdup, cwd, dele, getControlEncoding, getReply, getReplyCode, getReplyString, getReplyStrings, help, help, isStrictMultilineParsing, list, list, mdtm, mkd, mode, nlst, nlst, noop, pass, pasv, port, pwd, quit, rein, removeProtocolCommandListener, rest, retr, rmd, rnfr, rnto, sendCommand, sendCommand, sendCommand, sendCommand, setControlEncoding, setStrictMultilineParsing, site, smnt, stat, stat, stor, stou, stou, stru, syst, type, type, user
 
Methods inherited from class org.apache.commons.net.SocketClient
connect, connect, connect, connect, connect, connect, getConnectTimeout, getDefaultPort, getDefaultTimeout, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSoLinger, getSoTimeout, getTcpNoDelay, isConnected, setConnectTimeout, setDefaultPort, setDefaultTimeout, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedFTPClient

public WrappedFTPClient(FTPConnectionInfo connectionInfo,
                        java.util.logging.Logger logger)
Method Detail

configureConnection

public void configureConnection()
                         throws java.io.IOException
This method sets :

Throws:
java.io.IOException

del

public void del(java.lang.String remoteFile)
         throws java.io.IOException
Deleted the specified remote file.

Parameters:
remoteFile - Remote file to delete
Throws:
java.io.IOException
java.lang.InterruptedException

get

public org.w3c.dom.Document get(java.lang.String filePattern)
                         throws java.io.IOException
Get a file content from a FTP server.

Parameters:
server - the server
port - the port
login - the login
password - the password
filePattern - the remote file
Returns:
String
Throws:
java.lang.InterruptedException
org.xml.sax.SAXException
FTPBCException - impossible to get: The file does not exist
java.io.IOException

getConnectionInfo

public FTPConnectionInfo getConnectionInfo()

getFileAsAttachment

public javax.activation.DataHandler getFileAsAttachment(java.lang.String filePatternWildCard)
                                                 throws java.io.IOException
Get a file content from a FTP server.

Parameters:
server - the server
port - the port
login - the login
password - the password
filePatternWildCard - the remote file
Returns:
String
Throws:
java.lang.InterruptedException
FTPBCException - impossible to get: The file does not exist
java.io.IOException

connectAndLog

public void connectAndLog()
                   throws java.io.IOException
Connect and log the FTP client with the current configuration

Throws:
java.io.IOException

listFolderContent

public java.util.List<java.lang.String> listFolderContent()
                                                   throws java.io.IOException
List files from FTP server

Returns:
Throws:
java.io.IOException
java.lang.InterruptedException

mDel

public void mDel(java.util.List<java.lang.String> remoteFiles)
          throws java.io.IOException
Throws:
java.io.IOException

mGet

public java.util.Map<java.lang.String,javax.activation.DataHandler> mGet(java.util.List<java.lang.String> filePatternWildCardList)
                                                                  throws java.io.IOException
This method will only get files, it does not include subpath

Parameters:
filePatternWildCardList -
Returns:
Throws:
java.io.IOException
java.lang.InterruptedException

mPut

public void mPut(java.util.Map<java.lang.String,javax.activation.DataHandler> attachments)
          throws java.io.IOException
Put files on the FTP server.

Parameters:
attachments -
Throws:
java.io.IOException
java.lang.InterruptedException

putString

public void putString(java.lang.String fileName,
                      java.lang.String content)
               throws java.io.IOException
Put the file on the FTP server.

Parameters:
fileName -
content -
Throws:
java.io.IOException
java.lang.InterruptedException


Copyright © 2005-2012 Petals Link (EBM Websourcing). All Rights Reserved.