org.archive.net
Class ClientFTP

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.archive.net.ClientFTP
All Implemented Interfaces:
java.util.EventListener, org.apache.commons.net.ftp.Configurable, org.apache.commons.net.ProtocolCommandListener

public class ClientFTP
extends org.apache.commons.net.ftp.FTPClient
implements org.apache.commons.net.ProtocolCommandListener

Client for FTP operations. Saves the commands sent to the server and replies received, which can be retrieved with getControlConversation().

Author:
pjack, nlevitt

Field Summary
protected  java.lang.StringBuilder controlConversation
           
protected  java.net.Socket dataSocket
           
 
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
ClientFTP()
          Constructs a new ClientFTP.
 
Method Summary
protected  void _connectAction_()
           
 void closeDataConnection()
           
 void disconnect()
           
 java.lang.String getControlConversation()
           
 java.lang.String[] getReplyStrings()
           
 java.net.Socket openDataConnection(int command, java.lang.String path)
          Opens a data connection.
 void protocolCommandSent(org.apache.commons.net.ProtocolCommandEvent event)
           
 void protocolReplyReceived(org.apache.commons.net.ProtocolCommandEvent event)
           
protected  void recordControlMessage(java.lang.String linePrefix, java.lang.String message)
           
 
Methods inherited from class org.apache.commons.net.ftp.FTPClient
_openDataConnection_, abort, allocate, allocate, appendFile, appendFileStream, changeToParentDirectory, changeWorkingDirectory, completePendingCommand, configure, deleteFile, 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, 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
 

Field Detail

controlConversation

protected java.lang.StringBuilder controlConversation

dataSocket

protected java.net.Socket dataSocket
Constructor Detail

ClientFTP

public ClientFTP()
Constructs a new ClientFTP.

Method Detail

openDataConnection

public java.net.Socket openDataConnection(int command,
                                          java.lang.String path)
                                   throws java.io.IOException
Opens a data connection.

Parameters:
command - the data command (eg, RETR or LIST)
path - the path of the file to retrieve
Returns:
the socket to read data from, or null if server says not found, permission denied, etc
Throws:
java.io.IOException - if a network error occurs

closeDataConnection

public void closeDataConnection()

_connectAction_

protected void _connectAction_()
                        throws java.io.IOException
Overrides:
_connectAction_ in class org.apache.commons.net.ftp.FTPClient
Throws:
java.io.IOException

disconnect

public void disconnect()
                throws java.io.IOException
Overrides:
disconnect in class org.apache.commons.net.ftp.FTPClient
Throws:
java.io.IOException

getControlConversation

public java.lang.String getControlConversation()

recordControlMessage

protected void recordControlMessage(java.lang.String linePrefix,
                                    java.lang.String message)

protocolCommandSent

public void protocolCommandSent(org.apache.commons.net.ProtocolCommandEvent event)
Specified by:
protocolCommandSent in interface org.apache.commons.net.ProtocolCommandListener

protocolReplyReceived

public void protocolReplyReceived(org.apache.commons.net.ProtocolCommandEvent event)
Specified by:
protocolReplyReceived in interface org.apache.commons.net.ProtocolCommandListener

getReplyStrings

public java.lang.String[] getReplyStrings()
Overrides:
getReplyStrings in class org.apache.commons.net.ftp.FTP


Copyright © 2003-2011 Internet Archive. All Rights Reserved.