1 /**
2 This file is part of GoldenGate Project (named also GoldenGate or GG).
3
4 Copyright 2009, Frederic Bregier, and individual contributors by the @author
5 tags. See the COPYRIGHT.txt in the distribution for a full listing of
6 individual contributors.
7
8 All GoldenGate Project is free software: you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as published
10 by the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 GoldenGate is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GoldenGate . If not, see <http://www.gnu.org/licenses/>.
20 */
21 package goldengate.ftp.core.command.internal;
22
23 import goldengate.common.command.ReplyCode;
24 import goldengate.common.command.exception.Reply500Exception;
25 import goldengate.common.logging.GgInternalLogger;
26 import goldengate.common.logging.GgInternalLoggerFactory;
27 import goldengate.ftp.core.command.AbstractCommand;
28
29 /**
30 * Unrecognized command (unknown command)
31 *
32 * @author Frederic Bregier
33 *
34 */
35 public class UnknownCommand extends AbstractCommand {
36 /**
37 * Internal Logger
38 */
39 private static final GgInternalLogger logger = GgInternalLoggerFactory
40 .getLogger(UnknownCommand.class);
41
42 /*
43 * (non-Javadoc)
44 *
45 * @see goldengate.ftp.core.command.AbstractCommand#exec()
46 */
47 public void exec() throws Reply500Exception {
48 getSession().setReplyCode(
49 ReplyCode.REPLY_500_SYNTAX_ERROR_COMMAND_UNRECOGNIZED,
50 "Unknown Command: " + getCommand() + " with argument: " +
51 getArg());
52 logger.warn(getSession().getAnswer());
53 invalidCurrentCommand();
54 throw new Reply500Exception(getSession().getReplyCode().getMesg());
55 }
56 }