1/* 2 * Copyright 2008 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package org.mockftpserver.fake.command; 17 18/** 19 * CommandHandler for the APPE command. Handler logic: 20 * <ol> 21 * <li>If the user has not logged in, then reply with 530 and terminate</li> 22 * <li>If the required pathname parameter is missing, then reply with 501 and terminate</li> 23 * <li>If the pathname parameter does not specify a valid filename, then reply with 553 and terminate</li> 24 * <li>If the current user does not have write access to the named file, if it already exists, or else to its 25 * parent directory, then reply with 553 and terminate</li> 26 * <li>If the current user does not have execute access to the parent directory, then reply with 553 and terminate</li> 27 * <li>Send an initial reply of 150</li> 28 * <li>Read all available bytes from the data connection and append to the named file in the server file system</li> 29 * <li>If file write/store fails, then reply with 553 and terminate</li> 30 * <li>Send a final reply with 226</li> 31 * </ol> 32 * 33 * @author Chris Mair 34 * @version $Revision$ - $Date$ 35 */ 36public class AppeCommandHandler extends AbstractStoreFileCommandHandler { 37 38 /** 39 * @return the message key for the reply message sent with the final (226) reply 40 */ 41 protected String getMessageKey() { 42 return "appe"; 43 } 44 45 /** 46 * @return true if this command should append the transferred contents to the output file; false means 47 * overwrite an existing file. 48 */ 49 protected boolean appendToOutputFile() { 50 return true; 51 } 52 53}