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>Send an initial reply of 150</li>
25 * <li>Read all available bytes from the data connection and append to the named file in the server file system</li>
26 * <li>If file write/store fails, then reply with 553 and terminate</li>
27 * <li>Send a final reply with 226</li>
28 * </ol>
29 *
30 * @author Chris Mair
31 * @version $Revision: 81 $ - $Date: 2008-07-11 15:28:15 -0400 (Fri, 11 Jul 2008) $
32 */
33public class AppeCommandHandler extends AbstractStoreFileCommandHandler {
34
35    /**
36     * @return the message key for the reply message sent with the final (226) reply
37     */
38    protected String getMessageKey() {
39        return "appe";
40    }
41
42    /**
43     * @return true if this command should append the transferred contents to the output file; false means
44     *         overwrite an existing file.
45     */
46    protected boolean appendToOutputFile() {
47        return true;
48    }
49
50}