001: /*
002: * Copyright 2001-2005 The Apache Software Foundation
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.apache.commons.net.ftp;
017:
018: /***
019: * FTPCommand stores a set of constants for FTP command codes. To interpret
020: * the meaning of the codes, familiarity with RFC 959 is assumed.
021: * The mnemonic constant names are transcriptions from the code descriptions
022: * of RFC 959. For those who think in terms of the actual FTP commands,
023: * a set of constants such as {@link #USER USER } are provided
024: * where the constant name is the same as the FTP command.
025: * <p>
026: * <p>
027: * @author Daniel F. Savarese
028: ***/
029:
030: public final class FTPCommand {
031:
032: public static final int USER = 0;
033: public static final int PASS = 1;
034: public static final int ACCT = 2;
035: public static final int CWD = 3;
036: public static final int CDUP = 4;
037: public static final int SMNT = 5;
038: public static final int REIN = 6;
039: public static final int QUIT = 7;
040: public static final int PORT = 8;
041: public static final int PASV = 9;
042: public static final int TYPE = 10;
043: public static final int STRU = 11;
044: public static final int MODE = 12;
045: public static final int RETR = 13;
046: public static final int STOR = 14;
047: public static final int STOU = 15;
048: public static final int APPE = 16;
049: public static final int ALLO = 17;
050: public static final int REST = 18;
051: public static final int RNFR = 19;
052: public static final int RNTO = 20;
053: public static final int ABOR = 21;
054: public static final int DELE = 22;
055: public static final int RMD = 23;
056: public static final int MKD = 24;
057: public static final int PWD = 25;
058: public static final int LIST = 26;
059: public static final int NLST = 27;
060: public static final int SITE = 28;
061: public static final int SYST = 29;
062: public static final int STAT = 30;
063: public static final int HELP = 31;
064: public static final int NOOP = 32;
065:
066: public static final int USERNAME = USER;
067: public static final int PASSWORD = PASS;
068: public static final int ACCOUNT = ACCT;
069: public static final int CHANGE_WORKING_DIRECTORY = CWD;
070: public static final int CHANGE_TO_PARENT_DIRECTORY = CDUP;
071: public static final int STRUCTURE_MOUNT = SMNT;
072: public static final int REINITIALIZE = REIN;
073: public static final int LOGOUT = QUIT;
074: public static final int DATA_PORT = PORT;
075: public static final int PASSIVE = PASV;
076: public static final int REPRESENTATION_TYPE = TYPE;
077: public static final int FILE_STRUCTURE = STRU;
078: public static final int TRANSFER_MODE = MODE;
079: public static final int RETRIEVE = RETR;
080: public static final int STORE = STOR;
081: public static final int STORE_UNIQUE = STOU;
082: public static final int APPEND = APPE;
083: public static final int ALLOCATE = ALLO;
084: public static final int RESTART = REST;
085: public static final int RENAME_FROM = RNFR;
086: public static final int RENAME_TO = RNTO;
087: public static final int ABORT = ABOR;
088: public static final int DELETE = DELE;
089: public static final int REMOVE_DIRECTORY = RMD;
090: public static final int MAKE_DIRECTORY = MKD;
091: public static final int PRINT_WORKING_DIRECTORY = PWD;
092: // public static final int LIST = LIST;
093: public static final int NAME_LIST = NLST;
094: public static final int SITE_PARAMETERS = SITE;
095: public static final int SYSTEM = SYST;
096: public static final int STATUS = STAT;
097:
098: //public static final int HELP = HELP;
099: //public static final int NOOP = NOOP;
100:
101: // Cannot be instantiated
102: private FTPCommand() {
103: }
104:
105: static final String[] _commands = { "USER", "PASS", "ACCT", "CWD",
106: "CDUP", "SMNT", "REIN", "QUIT", "PORT", "PASV", "TYPE",
107: "STRU", "MODE", "RETR", "STOR", "STOU", "APPE", "ALLO",
108: "REST", "RNFR", "RNTO", "ABOR", "DELE", "RMD", "MKD",
109: "PWD", "LIST", "NLST", "SITE", "SYST", "STAT", "HELP",
110: "NOOP" };
111:
112: /**
113: * Retrieve the FTP protocol command string corresponding to a specified
114: * command code.
115: * <p>
116: * @param command The command code.
117: * @return The FTP protcol command string corresponding to a specified
118: * command code.
119: */
120: public static final String getCommand(int command) {
121: return _commands[command];
122: }
123: }
|