Source code: org/finj/FTPServerProfile.java
1 package org.finj;
2
3 import org.finj.FTPCommand;
4 import org.finj.FTPException;
5 import org.finj.FTPResponse;
6
7 /**
8 * The goal of this interface is to leave the possibility to
9 * handle servers that do not comply with the RFC959 strictly.
10 *
11 * Custom implementations of this interface will allow developpers
12 * to handle such non-conforming servers transparently.
13 *
14 * Copyright (C)
15 *
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * @author Javier Iglesias -- jiglesias@users.sourceforge.net
31 * @version $Id: FTPServerProfile.java,v 1.2 2003/05/27 15:50:24 jiglesia Exp $
32 */
33 public interface FTPServerProfile {
34
35 /**
36 * Checks if the <code>response</code> is the last that
37 * one has to expect after establishing the control
38 * connection with a server.
39 *
40 * @param response
41 * @return <code>true</code> if the <code>response</code> is the last
42 * to expect from server when establishing the control connection.
43 * @exception FTPException <code>response</code> is not a valid response
44 * when establishing a control connection.
45 * @since v1.2
46 */
47 public boolean isControlConnectionReady ( FTPResponse response ) throws FTPException;
48
49 /**
50 * Checks if the <code>response</code> is the last that
51 * one has to expect for the <code>command</code>.
52 *
53 * @param command <code>org.finj.FTPCommand</code> sent to the server.
54 * @param response <code>org.finj.FTPResponse</code> returned by the server.
55 * @return <code>true</code> if the <code>response</code> is the last
56 * to expect from server for the <code>command</code>.
57 * @exception FTPException <code>response</code> is not a valid answer
58 * for the <code>command</code>.
59 * @since v1.0
60 */
61 public boolean isCommandCompleted ( FTPCommand command, FTPResponse response ) throws FTPException;
62
63 /**
64 * Checks if the <code>response</code> is the last that
65 * one has to expect to end a <code>command</code> that
66 * required a data connection setup and destruction.
67 *
68 * This method only applies to:
69 * <ul>
70 * <li><code>org.finj.FTPCommand.APPEND_WITH_CREATE</code></li>
71 * <li><code>org.finj.FTPCommand.NAME_LIST</code></li>
72 * <li><code>org.finj.FTPCommand.STORE_FILE</code></li>
73 * <li><code>org.finj.FTPCommand.STORE_UNIQUE_FILE</code> FIXME:check that!</li>
74 * </ul>
75 *
76 * and should be called AFTER a call to
77 * <code>isCommandCompleted(org.finj.FTPCommand, org.finj.FTPResponse)</code>
78 * which will be the one triggering the command execution and
79 * data connection opening.
80 *
81 * @param command <code>org.finj.FTPCommand</code> sent to the server.
82 * @param response <code>org.finj.FTPResponse</code> returned by the server.
83 * @return <code>true</code> if the <code>response</code> is the last
84 * to expect from server for the <code>command</code>.
85 * @exception FTPException <code>response</code> is not a valid answer
86 * for the <code>command</code>.
87 * @since v1.0
88 */
89 public boolean isPostCommandCompleted ( FTPCommand command, FTPResponse response ) throws FTPException;
90 }