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