org.finj.profile
Class StrictFTPServerProfile

java.lang.Object
  extended by org.finj.profile.StrictFTPServerProfile
All Implemented Interfaces:
FTPServerProfile

public class StrictFTPServerProfile
extends java.lang.Object
implements FTPServerProfile

This implementation of the org.finj.FTPServerProfile interface is a strict, word by word transcription of RFC959: FTP servers that work with this profile are 100% compatible.

Copyright (C) 2000-2008 Javier Iglesias.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Version:
$Id: StrictFTPServerProfile.java 47 2008-01-11 23:09:46Z jiglesias $
Author:
Javier Iglesias -- jiglesias@users.sourceforge.net

Constructor Summary
StrictFTPServerProfile()
          Constructs a new instance of this class.
 
Method Summary
protected  boolean isABORCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isACCTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isALLOCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isAPPECommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isCDUPCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
 boolean isCommandCompleted(FTPCommand command, FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
 boolean isControlConnectionReady(FTPResponse response)
          Checks if the response is the last that one has to expect after establishing the control connection with a server.
protected  boolean isCWDCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isDELECommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isLISTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isMKDCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isMODECommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isNLSTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isNOOPCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isPASSCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isPASVCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isPORTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isPostAPPECommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.
 boolean isPostCommandCompleted(FTPCommand command, FTPResponse response)
          Checks if the response is the last that one has to expect to end a command that required a data connection setup and destruction.
protected  boolean isPostLISTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.
protected  boolean isPostNLSTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.
protected  boolean isPostRETRCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.
protected  boolean isPostSTORCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.
protected  boolean isPostSTOUCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.
protected  boolean isPWDCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isQUITCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isREINCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isRESTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isRETRCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isRMDCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isRNFRCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isRNTOCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isSITECommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isSMNTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isSTATCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isSTORCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isSTOUCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isSTRUCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isSYSTCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isTYPECommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
protected  boolean isUSERCommandCompleted(FTPResponse response)
          Checks if the response is the last that one has to expect for the command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrictFTPServerProfile

public StrictFTPServerProfile()
Constructs a new instance of this class.

Since:
v1.0
Method Detail

isControlConnectionReady

public boolean isControlConnectionReady(FTPResponse response)
                                 throws FTPException
Checks if the response is the last that one has to expect after establishing the control connection with a server.

Specified by:
isControlConnectionReady in interface FTPServerProfile
Parameters:
response -
Returns:
true if the response is the last to expect from server when establishing the control connection.
Throws:
FTPException - response is not a valid response when establishing a control connection.
Since:
v1.2

isCommandCompleted

public boolean isCommandCompleted(FTPCommand command,
                                  FTPResponse response)
                           throws FTPException
Checks if the response is the last that one has to expect for the command.

Specified by:
isCommandCompleted in interface FTPServerProfile
Parameters:
command - org.finj.FTPCommand sent to the server.
response - org.finj.FTPResponse returned by the server.
Returns:
true if the response is the last to expect from server for the command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isUSERCommandCompleted

protected boolean isUSERCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the USER command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPASSCommandCompleted

protected boolean isPASSCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the PASS command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isACCTCommandCompleted

protected boolean isACCTCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the ACCT command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isCWDCommandCompleted

protected boolean isCWDCommandCompleted(FTPResponse response)
                                 throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the CWD command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isCDUPCommandCompleted

protected boolean isCDUPCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the CDUP command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isSMNTCommandCompleted

protected boolean isSMNTCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the SMNT command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isREINCommandCompleted

protected boolean isREINCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the REIN command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isQUITCommandCompleted

protected boolean isQUITCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the QUIT command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPORTCommandCompleted

protected boolean isPORTCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the PORT command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPASVCommandCompleted

protected boolean isPASVCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the PASV command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isTYPECommandCompleted

protected boolean isTYPECommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the TYPE command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isSTRUCommandCompleted

protected boolean isSTRUCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the STRU command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isMODECommandCompleted

protected boolean isMODECommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the MODE command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isRETRCommandCompleted

protected boolean isRETRCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the RETR command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isSTORCommandCompleted

protected boolean isSTORCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the STOR command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isSTOUCommandCompleted

protected boolean isSTOUCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the STOU command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isAPPECommandCompleted

protected boolean isAPPECommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the APPE command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isALLOCommandCompleted

protected boolean isALLOCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the ALLO command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isRESTCommandCompleted

protected boolean isRESTCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the REST command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isRNFRCommandCompleted

protected boolean isRNFRCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the RNFR command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isRNTOCommandCompleted

protected boolean isRNTOCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the RNTO command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isABORCommandCompleted

protected boolean isABORCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the ABOR command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isDELECommandCompleted

protected boolean isDELECommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the DELE command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isRMDCommandCompleted

protected boolean isRMDCommandCompleted(FTPResponse response)
                                 throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the RMD command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isMKDCommandCompleted

protected boolean isMKDCommandCompleted(FTPResponse response)
                                 throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the MKD command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPWDCommandCompleted

protected boolean isPWDCommandCompleted(FTPResponse response)
                                 throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the PWD command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isLISTCommandCompleted

protected boolean isLISTCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the LIST command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isNLSTCommandCompleted

protected boolean isNLSTCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the NLST command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isSITECommandCompleted

protected boolean isSITECommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the SITE command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isSYSTCommandCompleted

protected boolean isSYSTCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the SYST command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isSTATCommandCompleted

protected boolean isSTATCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the STAT command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isNOOPCommandCompleted

protected boolean isNOOPCommandCompleted(FTPResponse response)
                                  throws FTPException
Checks if the response is the last that one has to expect for the command.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the NOOP command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPostCommandCompleted

public boolean isPostCommandCompleted(FTPCommand command,
                                      FTPResponse response)
                               throws FTPException
Checks if the response is the last that one has to expect to end a command that required a data connection setup and destruction. This method only applies to: and should be called AFTER a call to isCommandCompleted(org.finj.FTPCommand, org.finj.FTPResponse) which will be the one triggering the command execution and data connection opening.

Specified by:
isPostCommandCompleted in interface FTPServerProfile
Parameters:
command - org.finj.FTPCommand sent to the server.
response - org.finj.FTPResponse returned by the server.
Returns:
true if the response is the last to expect from server for the command.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0

isPostAPPECommandCompleted

protected boolean isPostAPPECommandCompleted(FTPResponse response)
                                      throws FTPException
Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the APPE.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPostLISTCommandCompleted

protected boolean isPostLISTCommandCompleted(FTPResponse response)
                                      throws FTPException
Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the LIST.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPostNLSTCommandCompleted

protected boolean isPostNLSTCommandCompleted(FTPResponse response)
                                      throws FTPException
Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the NLST.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPostRETRCommandCompleted

protected boolean isPostRETRCommandCompleted(FTPResponse response)
                                      throws FTPException
Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the RETR.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPostSTORCommandCompleted

protected boolean isPostSTORCommandCompleted(FTPResponse response)
                                      throws FTPException
Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the STOR.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"

isPostSTOUCommandCompleted

protected boolean isPostSTOUCommandCompleted(FTPResponse response)
                                      throws FTPException
Checks if the response is the last that one has to expect to end the command that required a data connection setup and destruction.

Parameters:
response - response from server to check.
Returns:
true if the response is the last to expect from server for the STOU.
Throws:
FTPException - response is not a valid answer for the command.
Since:
v1.0
See Also:
"RFC959-5:4:'Sequencing of Commands and Replies'"


Copyright © 2009. All Rights Reserved.