Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.finj
Class FTPReply  view FTPReply download FTPReply.java

java.lang.Object
  extended byorg.finj.FTPReply

public class FTPReply
extends java.lang.Object

This class contains constants and methods that simplify handling and internationalization of FTP server replies. Codes according to RFC959-4.2 http://www.cis.ohio-state.edu/htbin/rfc/rfc959.html (October 1995).

Version:
$Id$

Field Summary
static int BAD_COMMAND_SEQUENCE_CODE
          Bad sequence of commands.
static int CAN_T_OPEN_DATA_CONNECTION_CODE
          Can't open data connection.
private  int code
           
static int COMMAND_NOT_IMPLEMENTED_CODE
          Command not implemented.
static int COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER_CODE
          Command not implemented for that parameter.
static int CONTROL_CONNECTION_CLOSED_CODE
          Service closing control connection.
static int CONTROL_CONNECTION_OPENED_CODE
          Service ready for new user.
static int DATA_CONNECTION_ABORTED_CODE
          Connection closed; transfer aborted.
static int DATA_CONNECTION_ABOUT_TO_BE_OPENED_CODE
          File status okay; about to open data connection.
static int DATA_CONNECTION_ALREADY_OPENED_CODE
          Data Connection already open; transfer starting.
static int DATA_CONNECTION_CLOSED_CODE
          Closing data connection.
static int DATA_CONNECTION_OPENED_CODE
          Data connection open; no transfer in progress.
private static java.lang.String DEFAULT_MESSAGE_NAME
           
static int DIRECTORY_STATUS_CODE
          Directory status
static int ENTERING_PASSIVE_MODE_CODE
          Entering Passive Mode (h1,h2,h3,h4,p1,p2).
static int EXCEEDED_STORAGE_ALLOCATION_CODE
          Requested file action aborted.
static int FILE_STATUS_CODE
          File status.
static int FINE_NAME_NOT_ALLOWED_CODE
          Requested action not taken.
static int HELP_MESSAGE_CODE
          Help message.
private static java.lang.String MESSAGE_BUNDLE_NAME
           
private static java.lang.String MESSAGE_NAME_PREFIX
           
private  boolean multi
           
static int NEED_ACCOUNT_FOR_LOGIN_CODE
          Need account for login.
static int NEED_ACCOUNT_FOR_STORING_FILES_CODE
          Need account for storing files.
static int NOT_LOGGED_IN_CODE
          Not logged in.
static int PAGE_TYPE_UNKNOWN_CODE
          Requested action aborted: page type unknown.
static int PATHNAME_CREATED_CODE
          "PATHNAME" created.
static int PERMANENT_NEGATIVE_COMPLETION_REPLY_CODE
          Syntax error, command unrecognized.
static int PERMANENTLY_UNAVAILABLE_FILE_CODE
          Requested action not taken.
static int POSITIVE_COMPLETION_REPLY_CODE
          Command okay.
static int REQUESTED_FILE_ACTION_OK_CODE
          Requested file action okay, completed.
static int REQUESTED_FILE_ACTION_PENDING_CODE
          Requested file action pending further information.
private  java.util.ResourceBundle resources
           
static int RESTART_MARKER_REPLY_CODE
          Restart marker reply.
static int SERVICE_NOT_AVAILABLE_CODE
          Service not available, closing control connection.
static int SUPERFLOUS_COMMAND_CODE
          Command not implemented, superfluous at this site.
static int SYNTAX_ERROR_IN_ARGUMENTS_CODE
          Syntax error n parameters or arguments.
static int SYSTEM_STATUS_OR_HELP_REPLY_CODE
          System status, or system help reply.
static int SYSTEM_TYPE_NAME_CODE
          NAME system type.
private  java.lang.String text
           
static int TRANSIENT_INSUFFICIENT_STORAGE_SPACE_CODE
          Requested action not taken.
static int TRANSIENT_LOCAL_PROCESSING_ERROR_CODE
          Requested action aborted: local error in processing.
static int TRANSIENT_UNAVAILABLE_FILE_CODE
          Requested file action not taken.
static int USER_LOGGED_IN_CODE
          User logged in, proceed.
static int USERNAME_OK_NEED_PASSWORD_CODE
          User name okay, need password.
static int WILL_BE_READY_IN_MINUTES_CODE
          Service ready in nnn minutes.
 
Constructor Summary
private FTPReply()
          Defeat parameterless constructor.
  FTPReply(java.lang.String text)
          Constructs a new instance of this class that will use Locale.US as default locale.
  FTPReply(java.lang.String text, java.util.Locale locale)
          Constructs a new instance of this class that will use locale as message language.
 
Method Summary
 int getCode()
          Returns the FTP code of this reply.
static int getCodeFromMessage(java.lang.String reply)
          Returns the code contained in the reply passed as parameter.
 java.lang.String getMessage()
          Returns a localized version of the message corresponding to the original one's code.
protected  java.lang.String getMessageFromCode(int code)
          Returns the message that corresponds to the code given as parameter.
 java.lang.String getOriginalMessage()
          Returns the original message received from the FTP server and passed at construction time.
 boolean isMultiline()
          Returns true if this reply anounces a multi line reply, e.g., STAT command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESTART_MARKER_REPLY_CODE

public static final int RESTART_MARKER_REPLY_CODE
Restart marker reply. In this case, the text is exact and not left to the particular implementation; it must read : MARK yyyy = mmmm Where yyyy is User-process data stream marker, and mmmm server's equivalent marker (note the spaces between markers and '=`).

Since:
v1.0
See Also:
"RFC959-4:2:'110'", Constant Field Values

WILL_BE_READY_IN_MINUTES_CODE

public static final int WILL_BE_READY_IN_MINUTES_CODE
Service ready in nnn minutes.

Since:
v1.0
See Also:
"RFC959-4:2:'120'", Constant Field Values

DATA_CONNECTION_ALREADY_OPENED_CODE

public static final int DATA_CONNECTION_ALREADY_OPENED_CODE
Data Connection already open; transfer starting.

Since:
v1.0
See Also:
"RFC959-4:2:'125'", Constant Field Values

DATA_CONNECTION_ABOUT_TO_BE_OPENED_CODE

public static final int DATA_CONNECTION_ABOUT_TO_BE_OPENED_CODE
File status okay; about to open data connection.

Since:
v1.0
See Also:
"RFC959-4:2:'150'", Constant Field Values

POSITIVE_COMPLETION_REPLY_CODE

public static final int POSITIVE_COMPLETION_REPLY_CODE
Command okay.

Since:
v1.0
See Also:
"RFC959-4:2:'200'", Constant Field Values

SUPERFLOUS_COMMAND_CODE

public static final int SUPERFLOUS_COMMAND_CODE
Command not implemented, superfluous at this site.

Since:
v1.0
See Also:
"RFC959-4:2:'202'", Constant Field Values

SYSTEM_STATUS_OR_HELP_REPLY_CODE

public static final int SYSTEM_STATUS_OR_HELP_REPLY_CODE
System status, or system help reply.

Since:
v1.0
See Also:
"RFC959-4:2:'211'", Constant Field Values

DIRECTORY_STATUS_CODE

public static final int DIRECTORY_STATUS_CODE
Directory status

Since:
v1.0
See Also:
"RFC959-4:2:'212'", Constant Field Values

FILE_STATUS_CODE

public static final int FILE_STATUS_CODE
File status.

Since:
v1.0
See Also:
"RFC959-4:2:'213'", Constant Field Values

HELP_MESSAGE_CODE

public static final int HELP_MESSAGE_CODE
Help message. On how to use the server or the meaning of a particular non-standard command. This reply is useful only to the human user.

Since:
v1.0
See Also:
"RFC959-4:2:'214'", Constant Field Values

SYSTEM_TYPE_NAME_CODE

public static final int SYSTEM_TYPE_NAME_CODE
NAME system type. Where NAME is an official system name from the list in the Assigned Numbers document.

Since:
v1.0
See Also:
"RFC959-4:2:'215'", "RFC1700", Constant Field Values

CONTROL_CONNECTION_OPENED_CODE

public static final int CONTROL_CONNECTION_OPENED_CODE
Service ready for new user.

Since:
v1.0
See Also:
"RFC959-4:2:'220'", Constant Field Values

CONTROL_CONNECTION_CLOSED_CODE

public static final int CONTROL_CONNECTION_CLOSED_CODE
Service closing control connection. Logged out if appropriate.

Since:
v1.0
See Also:
"RFC959-4:2:'221'", Constant Field Values

DATA_CONNECTION_OPENED_CODE

public static final int DATA_CONNECTION_OPENED_CODE
Data connection open; no transfer in progress.

Since:
v1.0
See Also:
"RFC959-4:2:'225'", Constant Field Values

DATA_CONNECTION_CLOSED_CODE

public static final int DATA_CONNECTION_CLOSED_CODE
Closing data connection. Requested file action successful (e.g., file transfer or file abort).

Since:
v1.0
See Also:
"RFC959-4:2:'226'", Constant Field Values

ENTERING_PASSIVE_MODE_CODE

public static final int ENTERING_PASSIVE_MODE_CODE
Entering Passive Mode (h1,h2,h3,h4,p1,p2).

Since:
v1.0
See Also:
"RFC959-4:2:'227'", Constant Field Values

USER_LOGGED_IN_CODE

public static final int USER_LOGGED_IN_CODE
User logged in, proceed.

Since:
v1.0
See Also:
"RFC959-4:2:'230'", Constant Field Values

REQUESTED_FILE_ACTION_OK_CODE

public static final int REQUESTED_FILE_ACTION_OK_CODE
Requested file action okay, completed.

Since:
v1.0
See Also:
"RFC959-4:2:'250'", Constant Field Values

PATHNAME_CREATED_CODE

public static final int PATHNAME_CREATED_CODE
"PATHNAME" created.

Since:
v1.0
See Also:
"RFC959-4:2:'257'", Constant Field Values

USERNAME_OK_NEED_PASSWORD_CODE

public static final int USERNAME_OK_NEED_PASSWORD_CODE
User name okay, need password.

Since:
v1.0
See Also:
"RFC959-4:2;'331'", Constant Field Values

NEED_ACCOUNT_FOR_LOGIN_CODE

public static final int NEED_ACCOUNT_FOR_LOGIN_CODE
Need account for login.

Since:
v1.0
See Also:
"RFC959-4:2:'332'", Constant Field Values

REQUESTED_FILE_ACTION_PENDING_CODE

public static final int REQUESTED_FILE_ACTION_PENDING_CODE
Requested file action pending further information.

Since:
v1.0
See Also:
"RFC959-4:2:'350'", Constant Field Values

SERVICE_NOT_AVAILABLE_CODE

public static final int SERVICE_NOT_AVAILABLE_CODE
Service not available, closing control connection. This may be a reply to any command if the service knows it must shut down.

Since:
v1.0
See Also:
"RFC959-4:2:'421'", Constant Field Values

CAN_T_OPEN_DATA_CONNECTION_CODE

public static final int CAN_T_OPEN_DATA_CONNECTION_CODE
Can't open data connection.

Since:
v1.0
See Also:
"RFC959-4:2:'425'", Constant Field Values

DATA_CONNECTION_ABORTED_CODE

public static final int DATA_CONNECTION_ABORTED_CODE
Connection closed; transfer aborted.

Since:
v1.0
See Also:
"RFC959-4:2:'426'", Constant Field Values

TRANSIENT_UNAVAILABLE_FILE_CODE

public static final int TRANSIENT_UNAVAILABLE_FILE_CODE
Requested file action not taken. File unavailable (e.g., file busy).

Since:
v1.0
See Also:
"RFC959-4:2:'450'", Constant Field Values

TRANSIENT_LOCAL_PROCESSING_ERROR_CODE

public static final int TRANSIENT_LOCAL_PROCESSING_ERROR_CODE
Requested action aborted: local error in processing.

Since:
v1.0
See Also:
"RFC959-4:2:'451'", Constant Field Values

TRANSIENT_INSUFFICIENT_STORAGE_SPACE_CODE

public static final int TRANSIENT_INSUFFICIENT_STORAGE_SPACE_CODE
Requested action not taken. Insufficient storage space in system.

Since:
v1.0
See Also:
"RFC959-4:2:'452'", Constant Field Values

PERMANENT_NEGATIVE_COMPLETION_REPLY_CODE

public static final int PERMANENT_NEGATIVE_COMPLETION_REPLY_CODE
Syntax error, command unrecognized. This may include errors such as command line too long.

Since:
v1.0
See Also:
"RFC959-4:2:'500'", Constant Field Values

SYNTAX_ERROR_IN_ARGUMENTS_CODE

public static final int SYNTAX_ERROR_IN_ARGUMENTS_CODE
Syntax error n parameters or arguments.

Since:
v1.0
See Also:
"RFC959-4:2:'501'", Constant Field Values

COMMAND_NOT_IMPLEMENTED_CODE

public static final int COMMAND_NOT_IMPLEMENTED_CODE
Command not implemented.

Since:
v1.0
See Also:
"RFC959-4:2:'502'", Constant Field Values

BAD_COMMAND_SEQUENCE_CODE

public static final int BAD_COMMAND_SEQUENCE_CODE
Bad sequence of commands.

Since:
v1.0
See Also:
"RFC959-4:2:'503'", Constant Field Values

COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER_CODE

public static final int COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER_CODE
Command not implemented for that parameter.

Since:
v1.0
See Also:
"RFC959-4:2:'504'", Constant Field Values

NOT_LOGGED_IN_CODE

public static final int NOT_LOGGED_IN_CODE
Not logged in.

Since:
v1.0
See Also:
"RFC959-4:2:'530'", Constant Field Values

NEED_ACCOUNT_FOR_STORING_FILES_CODE

public static final int NEED_ACCOUNT_FOR_STORING_FILES_CODE
Need account for storing files.

Since:
v1.0
See Also:
"RFC959-4:2:'532'", Constant Field Values

PERMANENTLY_UNAVAILABLE_FILE_CODE

public static final int PERMANENTLY_UNAVAILABLE_FILE_CODE
Requested action not taken. File unavailable (e.g., file not found, no access).

Since:
v1.0
See Also:
"RFC959-4:2:'550'", Constant Field Values

PAGE_TYPE_UNKNOWN_CODE

public static final int PAGE_TYPE_UNKNOWN_CODE
Requested action aborted: page type unknown.

Since:
v1.0
See Also:
"RFC959-4:2:'551'", Constant Field Values

EXCEEDED_STORAGE_ALLOCATION_CODE

public static final int EXCEEDED_STORAGE_ALLOCATION_CODE
Requested file action aborted. Exceed storage allocation (for current directory or dataset).

Since:
v1.0
See Also:
"RFC959-4:2:'552'", Constant Field Values

FINE_NAME_NOT_ALLOWED_CODE

public static final int FINE_NAME_NOT_ALLOWED_CODE
Requested action not taken. File name not allowed.

Since:
v1.0
See Also:
"RFC959-4:2:'553'", Constant Field Values

MESSAGE_BUNDLE_NAME

private static final java.lang.String MESSAGE_BUNDLE_NAME
See Also:
Constant Field Values

MESSAGE_NAME_PREFIX

private static final java.lang.String MESSAGE_NAME_PREFIX
See Also:
Constant Field Values

DEFAULT_MESSAGE_NAME

private static final java.lang.String DEFAULT_MESSAGE_NAME
See Also:
Constant Field Values

resources

private java.util.ResourceBundle resources

code

private int code

text

private java.lang.String text

multi

private boolean multi
Constructor Detail

FTPReply

private FTPReply()
Defeat parameterless constructor.

Since:
v1.0

FTPReply

public FTPReply(java.lang.String text)
Constructs a new instance of this class that will use Locale.US as default locale.

Since:
v1.0

FTPReply

public FTPReply(java.lang.String text,
                java.util.Locale locale)
         throws java.lang.IllegalArgumentException
Constructs a new instance of this class that will use locale as message language. If not available, messages for default language (Locale.US) will be used.

Since:
v1.0
Method Detail

getCode

public int getCode()
Returns the FTP code of this reply.

Since:
v1.0

getMessage

public java.lang.String getMessage()
Returns a localized version of the message corresponding to the original one's code. This will only work if a localized version of the messages are provided.

Since:
v1.0

getOriginalMessage

public java.lang.String getOriginalMessage()
Returns the original message received from the FTP server and passed at construction time.

Since:
v1.0

isMultiline

public boolean isMultiline()
Returns true if this reply anounces a multi line reply, e.g., STAT command.

Since:
v1.0

getMessageFromCode

protected java.lang.String getMessageFromCode(int code)
Returns the message that corresponds to the code given as parameter.

Since:
v1.0

getCodeFromMessage

public static int getCodeFromMessage(java.lang.String reply)
                              throws java.lang.IllegalArgumentException
Returns the code contained in the reply passed as parameter. This code are in fact the 3 first characters of the reply.

Since:
v1.0