1b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair/* 2b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * Copyright 2007 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.stub.command; 17b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair 18b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismairimport org.mockftpserver.core.command.Command; 19b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismairimport org.mockftpserver.core.command.CommandHandler; 20b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismairimport org.mockftpserver.core.command.InvocationRecord; 21b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismairimport org.mockftpserver.core.command.ReplyCodes; 22b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismairimport org.mockftpserver.core.session.Session; 23b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair 24b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair/** 25b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * CommandHandler for the PASS (Password) command. Send back a reply code of 230. 26b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * <p/> 27b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * Each invocation record stored by this CommandHandler includes the following data element key/values: 28b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * <ul> 29b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * <li>"password" - the password submitted on the invocation (the first command parameter) 30b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * </ul> 31b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * 32b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * @author Chris Mair 33b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * @version $Revision$ - $Date$ 34b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair */ 35b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismairpublic class PassCommandHandler extends AbstractStubCommandHandler implements CommandHandler { 36b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair 37b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair public static final String PASSWORD_KEY = "password"; 38b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair 39b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair /** 40b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * Constructor. Initialize the replyCode. 41b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair */ 42b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair public PassCommandHandler() { 43b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair setReplyCode(ReplyCodes.PASS_OK); 44b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair } 45b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair 46b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair /** 47b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair * @see org.mockftpserver.core.command.CommandHandler#handleCommand(org.mockftpserver.core.command.Command, org.mockftpserver.core.session.Session) 48b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair */ 49b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair public void handleCommand(Command command, Session session, InvocationRecord invocationRecord) { 50b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair invocationRecord.set(PASSWORD_KEY, command.getRequiredParameter(0)); 51b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair sendReply(session); 52b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair } 53b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair 54b2f4a2dfc590c250e42b21eb40d9539ac135b495chrismair} 55