1c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair/*
2c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * Copyright 2008 the original author or authors.
3c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair *
4c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * Licensed under the Apache License, Version 2.0 (the "License");
5c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * you may not use this file except in compliance with the License.
6c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * You may obtain a copy of the License at
7c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair *
8c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair *      http://www.apache.org/licenses/LICENSE-2.0
9c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair *
10c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * Unless required by applicable law or agreed to in writing, software
11c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * distributed under the License is distributed on an "AS IS" BASIS,
12c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * See the License for the specific language governing permissions and
14c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * limitations under the License.
15c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair */
16c1de24f1bfa6699e54b069e300af5e4246b34a34chrismairpackage org.mockftpserver.core.command;
17c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair
18c1de24f1bfa6699e54b069e300af5e4246b34a34chrismairimport org.mockftpserver.core.session.Session;
19c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair
20c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair/**
21c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * CommandHandler that encapsulates the sending of the reply for the initial connection from
22c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * the FTP client to the server. Send back a reply code of 220, indicating a successful connection.
23c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * <p>
24c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * Note that this is a "special" CommandHandler, in that it handles the initial connection from the
25c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * client, rather than an explicit FTP command.
26c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * <p>
27c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * Each invocation record stored by this CommandHandler contains no data elements.
28c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair *
29c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * @author Chris Mair
30c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair * @version $Revision$ - $Date$
31c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair */
32c1de24f1bfa6699e54b069e300af5e4246b34a34chrismairpublic final class ConnectCommandHandler extends AbstractStaticReplyCommandHandler implements CommandHandler {
33c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair
34c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair    /**
35c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair     * Constructor. Initiate the replyCode.
36c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair     */
37c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair    public ConnectCommandHandler() {
38c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair        setReplyCode(ReplyCodes.CONNECT_OK);
39c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair    }
40c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair
41c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair    /**
42c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair     * @see AbstractTrackingCommandHandler#handleCommand(Command, org.mockftpserver.core.session.Session, InvocationRecord)
43c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair     */
44c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair    public void handleCommand(Command command, Session session, InvocationRecord invocationRecord) {
45c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair        sendReply(session);
46c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair    }
47c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair
48c1de24f1bfa6699e54b069e300af5e4246b34a34chrismair}