chrismair | 00dc7bd | 2014-05-11 21:21:28 +0000 | [diff] [blame] | 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 | */
|
| 16 | package org.mockftpserver.fake.command;
|
| 17 |
|
| 18 | /**
|
| 19 | * CommandHandler for the STOR 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 write out 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 | */
|
| 36 | public class StorCommandHandler 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 "stor";
|
| 43 | }
|
| 44 |
|
| 45 | } |