You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2008/08/17 21:52:49 UTC
svn commit: r686637 [16/16] - in /mina/ftpserver/trunk:
core/src/main/java/org/apache/ftpserver/
core/src/main/java/org/apache/ftpserver/command/
core/src/main/java/org/apache/ftpserver/config/spring/
core/src/main/java/org/apache/ftpserver/filesystem/...
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileObject.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileObject.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileObject.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileObject.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
@@ -25,80 +25,82 @@
/**
* This is the file abstraction used by the server.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface FileObject {
-
+public interface FileObject {
+
/**
* Get the fully qualified name.
*/
String getFullName();
-
+
/**
* Get the file short name.
*/
String getShortName();
-
+
/**
* Is a hidden file?
*/
boolean isHidden();
-
+
/**
* Is it a directory?
*/
boolean isDirectory();
-
+
/**
* Is it a file?
*/
boolean isFile();
-
+
/**
* Does this file exists?
*/
boolean doesExist();
-
+
/**
* Has read permission?
- */
+ */
boolean hasReadPermission();
-
+
/**
* Has write permission?
- */
- boolean hasWritePermission();
-
+ */
+ boolean hasWritePermission();
+
/**
* Has delete permission?
*/
boolean hasDeletePermission();
-
+
/**
* Get the owner name.
- */
+ */
String getOwnerName();
-
+
/**
* Get owner group name.
*/
- String getGroupName();
-
+ String getGroupName();
+
/**
* Get link count.
*/
int getLinkCount();
-
+
/**
* Get last modified time.
- */
+ */
long getLastModified();
-
+
/**
* Get file size.
*/
long getSize();
-
+
/**
* Create directory.
*/
@@ -108,30 +110,27 @@
* Delete file.
*/
boolean delete();
-
+
/**
* Move file.
*/
boolean move(FileObject destination);
-
+
/**
- * List file objects. If not a directory or does not exist,
- * null will be returned.
- * Files must be returned in alphabetical order.
+ * List file objects. If not a directory or does not exist, null will be
+ * returned. Files must be returned in alphabetical order.
*/
FileObject[] listFiles();
-
+
/**
- * Create output stream for writing. If the file is
- * not random accessible, any offset other than zero
- * will throw an exception.
+ * Create output stream for writing. If the file is not random accessible,
+ * any offset other than zero will throw an exception.
*/
OutputStream createOutputStream(long offset) throws IOException;
-
+
/**
- * Create input stream for reading. If the file is
- * not random accessible, any offset other than zero
- * will throw an exception.
+ * Create input stream for reading. If the file is not random accessible,
+ * any offset other than zero will throw an exception.
*/
InputStream createInputStream(long offset) throws IOException;
}
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemManager.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemManager.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemManager.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemManager.java Sun Aug 17 12:52:42 2008
@@ -15,20 +15,21 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
/**
- * This is the file system manager - it returns the file system
- * view for user.
+ * This is the file system manager - it returns the file system view for user.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface FileSystemManager {
-
+public interface FileSystemManager {
+
/**
* Create user specific file system view.
*/
FileSystemView createFileSystemView(User user) throws FtpException;
-
+
}
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemView.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemView.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemView.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FileSystemView.java Sun Aug 17 12:52:42 2008
@@ -15,42 +15,43 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
-
/**
* This is an abstraction over the user file system view.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface FileSystemView {
+public interface FileSystemView {
/**
* Get the user home directory.
*/
FileObject getHomeDirectory() throws FtpException;
-
+
/**
* Get user current directory.
*/
FileObject getCurrentDirectory() throws FtpException;
-
+
/**
* Change directory.
- */
+ */
boolean changeDirectory(String dir) throws FtpException;
-
+
/**
* Get file object.
*/
FileObject getFileObject(String file) throws FtpException;
-
+
/**
- * Does the file system support random file access?
+ * Does the file system support random file access?
*/
- boolean isRandomAccessible() throws FtpException;
-
+ boolean isRandomAccessible() throws FtpException;
+
/**
* Dispose file system view.
*/
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpException.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
@@ -24,12 +24,14 @@
/**
* Ftplet exception class.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-class FtpException extends Exception {
+public class FtpException extends Exception {
private static final long serialVersionUID = -1328383839915898987L;
-
+
private Throwable throwable = null;
/**
@@ -42,17 +44,19 @@
/**
* Constructs a <code>FtpException</code> object with a message.
*
- * @param msg a description of the exception
+ * @param msg
+ * a description of the exception
*/
public FtpException(String msg) {
super(msg);
}
/**
- * Constructs a <code>FtpException</code> object with a
+ * Constructs a <code>FtpException</code> object with a
* <code>Throwable</code> cause.
*
- * @param th the original cause
+ * @param th
+ * the original cause
*/
public FtpException(Throwable th) {
super(th.getMessage());
@@ -60,55 +64,53 @@
}
/**
- * Constructs a <code>BaseException</code> object with a
+ * Constructs a <code>BaseException</code> object with a
* <code>Throwable</code> cause.
*
- * @param th the original cause
+ * @param th
+ * the original cause
*/
public FtpException(String msg, Throwable th) {
super(msg);
throwable = th;
}
-
+
/**
* Get the root cause.
*/
public Throwable getRootCause() {
return throwable;
}
-
+
/**
* Print stack trace.
*/
public void printStackTrace(PrintWriter pw) {
- if(throwable == null) {
+ if (throwable == null) {
super.printStackTrace(pw);
- }
- else {
+ } else {
throwable.printStackTrace(pw);
}
}
-
+
/**
* Print stack trace.
*/
public void printStackTrace(PrintStream ps) {
- if(throwable == null) {
+ if (throwable == null) {
super.printStackTrace(ps);
- }
- else {
+ } else {
throwable.printStackTrace(ps);
}
}
-
+
/**
* Print stack trace.
*/
public void printStackTrace() {
- if(throwable == null) {
+ if (throwable == null) {
super.printStackTrace();
- }
- else {
+ } else {
throwable.printStackTrace();
}
}
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpReply.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpReply.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpReply.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpReply.java Sun Aug 17 12:52:42 2008
@@ -21,6 +21,9 @@
/**
* Interface for a reply to an FTP request.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public interface FtpReply {
@@ -231,19 +234,22 @@
/**
* The reply code
+ *
* @return The reply code
*/
int getCode();
/**
* The reply message, might be multiple lines
+ *
* @return The reply message
*/
String getMessage();
- /**
- * Must implement toString to format the reply as described in the RFC.
- * Most important is the handling of multi-line replies.
+ /**
+ * Must implement toString to format the reply as described in the RFC. Most
+ * important is the handling of multi-line replies.
+ *
* @return The formated reply
*/
String toString();
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpRequest.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpRequest.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpRequest.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpRequest.java Sun Aug 17 12:52:42 2008
@@ -15,13 +15,15 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
-
/**
- * One FtpRequest made by the client.
+ * One FtpRequest made by the client.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public interface FtpRequest {
@@ -29,7 +31,7 @@
* Get the client request string.
*/
String getRequestLine();
-
+
/**
* Returns the ftp request command.
*/
@@ -39,9 +41,10 @@
* Get the ftp request argument.
*/
String getArgument();
-
+
/**
* Check if request contains an argument
+ *
* @return true if an argument is available
*/
boolean hasArgument();
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpSession.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpSession.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpSession.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpSession.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
@@ -24,12 +24,14 @@
import java.util.Date;
/**
- * Defines an client session with the FTP server. The session is born
- * when the client connects and dies when the client disconnects.
- * Ftplet methods will always get the same session for one user and one
- * connection.
- * So the attributes set by <code>setAttribute()</code> will be always
- * available later unless that attribute is removed or the client disconnects.
+ * Defines an client session with the FTP server. The session is born when the
+ * client connects and dies when the client disconnects. Ftplet methods will
+ * always get the same session for one user and one connection. So the
+ * attributes set by <code>setAttribute()</code> will be always available later
+ * unless that attribute is removed or the client disconnects.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public interface FtpSession {
@@ -37,23 +39,23 @@
* Returns the IP address of the client that sent the request.
*/
InetAddress getClientAddress();
-
+
InetAddress getServerAddress();
-
+
int getServerPort();
-
+
/**
* Get FTP data connection.
*/
DataConnectionFactory getDataConnection();
-
+
Certificate[] getClientCertificates();
-
+
/**
* Get connection time.
*/
Date getConnectionTime();
-
+
/**
* Get the login time.
*/
@@ -63,7 +65,7 @@
* Get the number of failed logins. When login succeeds, this will return 0.
*/
int getFailedLogins();
-
+
/**
* Get last access time.
*/
@@ -75,7 +77,7 @@
* {@link User#getMaxIdleTime()} after user login.
*/
int getMaxIdleTime();
-
+
/**
* Set maximum idle time in seconds. This time equals to
* {@link ConnectionManagerImpl#getDefaultIdleSec()} until user login, and
@@ -94,12 +96,12 @@
* @return user name entered in USER command
*/
String getUserArgument();
-
+
/**
* Get the requested language.
*/
String getLanguage();
-
+
/**
* Is the user logged in?
*/
@@ -109,57 +111,59 @@
* Get user file system view.
*/
FileSystemView getFileSystemView();
-
+
/**
* Get file upload/download offset.
*/
long getFileOffset();
-
+
/**
* Get rename from file object.
*/
FileObject getRenameFrom();
-
+
/**
* Get the data type.
*/
DataType getDataType();
-
+
/**
* Get structure.
*/
Structure getStructure();
-
+
/**
- * Returns the value of the named attribute as an Object,
- * or null if no attribute of the given name exists.
+ * Returns the value of the named attribute as an Object, or null if no
+ * attribute of the given name exists.
*/
Object getAttribute(String name);
-
+
/**
- * Stores an attribute in this request. It will be available
- * until it was removed or when the connection ends.
+ * Stores an attribute in this request. It will be available until it was
+ * removed or when the connection ends.
*/
void setAttribute(String name, Object value);
-
+
/**
* Removes an attribute from this request.
*/
void removeAttribute(String name);
-
+
/**
* Write a reply to the client
- * @param reply The reply that will be sent to the client
+ *
+ * @param reply
+ * The reply that will be sent to the client
* @throws FtpException
*/
void write(FtpReply reply) throws FtpException;
-
+
/**
- * Indicates whether the control socket for this session is secure,
- * that is, running over SSL/TLS
+ * Indicates whether the control socket for this session is secure, that is,
+ * running over SSL/TLS
+ *
* @return true if the control socket is secured
*/
boolean isSecure();
-
-
+
}
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpStatistics.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpStatistics.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpStatistics.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpStatistics.java Sun Aug 17 12:52:42 2008
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
@@ -23,86 +23,88 @@
import java.util.Date;
/**
- * This interface holds all the ftp server statistical information.
+ * This interface holds all the ftp server statistical information.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface FtpStatistics {
+public interface FtpStatistics {
/**
* Get the server start time.
*/
Date getStartTime();
-
+
/**
* Get number of files uploaded.
*/
int getTotalUploadNumber();
-
+
/**
* Get number of files downloaded.
*/
int getTotalDownloadNumber();
-
+
/**
* Get number of files deleted.
*/
int getTotalDeleteNumber();
-
+
/**
* Get total number of bytes uploaded.
*/
long getTotalUploadSize();
-
+
/**
* Get total number of bytes downloaded.
*/
long getTotalDownloadSize();
-
+
/**
* Get total directory created.
*/
int getTotalDirectoryCreated();
-
+
/**
* Get total directory removed.
*/
int getTotalDirectoryRemoved();
-
+
/**
* Get total number of connections
*/
int getTotalConnectionNumber();
-
+
/**
* Get current number of connections.
*/
int getCurrentConnectionNumber();
-
+
/**
* Get total login number.
*/
int getTotalLoginNumber();
-
+
/**
* Get total failed login number.
*/
int getTotalFailedLoginNumber();
-
+
/**
* Get current login number
*/
int getCurrentLoginNumber();
-
+
/**
* Get total anonymous login number.
*/
int getTotalAnonymousLoginNumber();
-
+
/**
* Get current anonymous login number.
*/
int getCurrentAnonymousLoginNumber();
-
+
/**
* Get the login number for the specific user
*/
@@ -110,8 +112,11 @@
/**
* Get the login number for the specific user from the ipAddress
- * @param user login user account
- * @param ipAddress the ip address of the remote user
+ *
+ * @param user
+ * login user account
+ * @param ipAddress
+ * the ip address of the remote user
*/
int getCurrentUserLoginNumber(User user, InetAddress ipAddress);
}
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Ftplet.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Ftplet.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Ftplet.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Ftplet.java Sun Aug 17 12:52:42 2008
@@ -15,101 +15,119 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
import java.io.IOException;
/**
- * Defines methods that all ftplets must implement.
- *
- * A ftplet is a small Java program that runs within a FTP server.
- * Ftplets receive and respond to requests from FTP clients.
- *
- * This interface defines methods to initialize a ftplet, to service requests,
- * and to remove a ftplet from the server. These are known as life-cycle methods
- * and are called in the following sequence:
- *
+ * Defines methods that all ftplets must implement.
+ *
+ * A ftplet is a small Java program that runs within a FTP server. Ftplets
+ * receive and respond to requests from FTP clients.
+ *
+ * This interface defines methods to initialize a ftplet, to service requests,
+ * and to remove a ftplet from the server. These are known as life-cycle methods
+ * and are called in the following sequence:
+ *
* <ol>
- * <li>The ftplet is constructed.</li>
- * <li>Then initialized with the init method.</li>
- * <li>All the callback methods will be invoked.</li>
- * <li>The ftplet is taken out of service, then destroyed with the destroy method.</li>
- * <li>Then garbage collected and finalized.</li>
+ * <li>The ftplet is constructed.</li>
+ * <li>Then initialized with the init method.</li>
+ * <li>All the callback methods will be invoked.</li>
+ * <li>The ftplet is taken out of service, then destroyed with the destroy
+ * method.</li>
+ * <li>Then garbage collected and finalized.</li>
* </ol>
*
- * All the callback methods return FtpletEnum. If it returns null FtpletEnum.RET_DEFAULT
- * will be assumed. If any ftplet callback method throws exception, that particular connection
- * will be disconnected.
+ * All the callback methods return FtpletEnum. If it returns null
+ * FtpletEnum.RET_DEFAULT will be assumed. If any ftplet callback method throws
+ * exception, that particular connection will be disconnected.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface Ftplet {
-
- /**
- * Called by the ftplet container to indicate to a ftplet that the ftplet
- * is being placed into service.
- * The ftplet container calls the init method exactly once after instantiating
- * the ftplet. The init method must complete successfully before the ftplet can
- * receive any requests.
+public interface Ftplet {
+
+ /**
+ * Called by the ftplet container to indicate to a ftplet that the ftplet is
+ * being placed into service. The ftplet container calls the init method
+ * exactly once after instantiating the ftplet. The init method must
+ * complete successfully before the ftplet can receive any requests.
*/
void init(FtpletContext ftpletContext) throws FtpException;
-
+
/**
- * Called by the Ftplet container to indicate to a ftplet that the ftplet is
- * being taken out of service. This method is only called once all threads within
- * the ftplet's service method have exited. After the ftplet container calls this
- * method, callback methods will not be executed. If the ftplet initialization
- * method fails, this method will not be called.
+ * Called by the Ftplet container to indicate to a ftplet that the ftplet is
+ * being taken out of service. This method is only called once all threads
+ * within the ftplet's service method have exited. After the ftplet
+ * container calls this method, callback methods will not be executed. If
+ * the ftplet initialization method fails, this method will not be called.
*/
void destroy();
-
+
/**
- * Called by the ftplet container before a command is executed by the server.
- * The implementation should return based on the desired action to be taken by the server:
+ * Called by the ftplet container before a command is executed by the
+ * server. The implementation should return based on the desired action to
+ * be taken by the server:
* <ul>
- * <li>{@link FtpletEnum#RET_DEFAULT}: The server continues as normal and executes the command</li>
- * <li>{@link FtpletEnum#RET_NO_FTPLET}: The server does not call any more Ftplets before this command
- * but continues execution of the command as usual</li>
- * <li>{@link FtpletEnum#RET_SKIP}: The server skips over execution of the command. Note that the Ftplet is
- * responsible for returning the appropriate reply to the client, or the client might deadlock.</li>
- * <li>{@link FtpletEnum#RET_DISCONNECT}: The server will immediately disconnect the client.</li>
+ * <li>{@link FtpletEnum#RET_DEFAULT}: The server continues as normal and
+ * executes the command</li>
+ * <li>{@link FtpletEnum#RET_NO_FTPLET}: The server does not call any more
+ * Ftplets before this command but continues execution of the command as
+ * usual</li>
+ * <li>{@link FtpletEnum#RET_SKIP}: The server skips over execution of the
+ * command. Note that the Ftplet is responsible for returning the
+ * appropriate reply to the client, or the client might deadlock.</li>
+ * <li>{@link FtpletEnum#RET_DISCONNECT}: The server will immediately
+ * disconnect the client.</li>
* <li>Ftplet throws exception: Same as {@link FtpletEnum#RET_DISCONNECT}</li>
* </ul>
- * @param session The current session
- * @param request The current request
+ *
+ * @param session
+ * The current session
+ * @param request
+ * The current request
* @return The desired action to be performed by the server
* @throws FtpException
* @throws IOException
*/
- FtpletEnum beforeCommand(FtpSession session, FtpRequest request) throws FtpException, IOException;
+ FtpletEnum beforeCommand(FtpSession session, FtpRequest request)
+ throws FtpException, IOException;
/**
- * Called by the ftplet container after a command has been executed by the server.
- * The implementation should return based on the desired action to be taken by the server:
+ * Called by the ftplet container after a command has been executed by the
+ * server. The implementation should return based on the desired action to
+ * be taken by the server:
* <ul>
- * <li>{@link FtpletEnum#RET_DEFAULT}: The server continues as normal</li>
- * <li>{@link FtpletEnum#RET_NO_FTPLET}: The server does not call any more Ftplets before this command
- * but continues as normal</li>
- * <li>{@link FtpletEnum#RET_SKIP}: Same as {@link FtpletEnum#RET_DEFAULT}</li>
- * <li>{@link FtpletEnum#RET_DISCONNECT}: The server will immediately disconnect the client.</li>
+ * <li>{@link FtpletEnum#RET_DEFAULT}: The server continues as normal</li>
+ * <li>{@link FtpletEnum#RET_NO_FTPLET}: The server does not call any more
+ * Ftplets before this command but continues as normal</li>
+ * <li>{@link FtpletEnum#RET_SKIP}: Same as {@link FtpletEnum#RET_DEFAULT}</li>
+ * <li>{@link FtpletEnum#RET_DISCONNECT}: The server will immediately
+ * disconnect the client.</li>
* <li>Ftplet throws exception: Same as {@link FtpletEnum#RET_DISCONNECT}</li>
* </ul>
- * @param session The current session
- * @param request The current request
+ *
+ * @param session
+ * The current session
+ * @param request
+ * The current request
* @return The desired action to be performed by the server
* @throws FtpException
* @throws IOException
*/
- FtpletEnum afterCommand(FtpSession session, FtpRequest request) throws FtpException, IOException;
-
+ FtpletEnum afterCommand(FtpSession session, FtpRequest request)
+ throws FtpException, IOException;
+
/**
* Client connect notification method.
*/
FtpletEnum onConnect(FtpSession session) throws FtpException, IOException;
-
+
/**
* Client disconnect notification method. This is the last callback method.
*/
- FtpletEnum onDisconnect(FtpSession session) throws FtpException, IOException;
+ FtpletEnum onDisconnect(FtpSession session) throws FtpException,
+ IOException;
}
\ No newline at end of file
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletContext.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletContext.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletContext.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletContext.java Sun Aug 17 12:52:42 2008
@@ -15,34 +15,35 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
-
/**
- * A ftplet configuration object used by a ftplet container used to pass
- * information to a ftplet during initialization. The configuration information
+ * A ftplet configuration object used by a ftplet container used to pass
+ * information to a ftplet during initialization. The configuration information
* contains initialization parameters.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface FtpletContext {
-
+public interface FtpletContext {
+
/**
* Get the user manager.
*/
UserManager getUserManager();
-
+
/**
* Get file system manager
*/
FileSystemManager getFileSystemManager();
-
+
/**
* Get ftp statistics.
*/
FtpStatistics getFtpStatistics();
-
+
/**
* Get Ftplet.
*/
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletEnum.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletEnum.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletEnum.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/FtpletEnum.java Sun Aug 17 12:52:42 2008
@@ -15,75 +15,68 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
-
/**
- * This class encapsulates the return values of the ftplet methods.
+ * This class encapsulates the return values of the ftplet methods.
*
* RET_DEFAULT < RET_NO_FTPLET < RET_SKIP < RET_DISCONNECT
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-final class FtpletEnum {
-
+public final class FtpletEnum {
- /**
- * This return value indicates that the next ftplet method will
- * be called. If no other ftplet is available, the ftpserver will
- * process the request.
- */
- public static final FtpletEnum RET_DEFAULT = new FtpletEnum(0);
-
-
- /**
- * This return value indicates that the other ftplet methods will
- * not be called but the ftpserver will continue processing this
- * request.
- */
- public static final FtpletEnum RET_NO_FTPLET = new FtpletEnum(1);
-
-
- /**
- * It indicates that the ftpserver will skip everything. No further
- * processing (both ftplet and server) will be done for this request.
- */
- public static final FtpletEnum RET_SKIP = new FtpletEnum(2);
-
-
- /**
- * It indicates that the server will skip and disconnect the client.
- * No other request from the same client will be served.
- */
- public static final FtpletEnum RET_DISCONNECT = new FtpletEnum(3);
-
-
- private int type;
-
-
- /**
- * Private constructor - set the type
- */
- private FtpletEnum(int type) {
- this.type = type;
- }
-
- /**
- * Equality check
- */
- public boolean equals(Object obj) {
- if(obj instanceof FtpletEnum) {
- return type == ((FtpletEnum)obj).type;
- }
- return false;
- }
-
- /**
- * String representation
- */
- public String toString() {
- return String.valueOf(type);
- }
+ /**
+ * This return value indicates that the next ftplet method will be called.
+ * If no other ftplet is available, the ftpserver will process the request.
+ */
+ public static final FtpletEnum RET_DEFAULT = new FtpletEnum(0);
+
+ /**
+ * This return value indicates that the other ftplet methods will not be
+ * called but the ftpserver will continue processing this request.
+ */
+ public static final FtpletEnum RET_NO_FTPLET = new FtpletEnum(1);
+
+ /**
+ * It indicates that the ftpserver will skip everything. No further
+ * processing (both ftplet and server) will be done for this request.
+ */
+ public static final FtpletEnum RET_SKIP = new FtpletEnum(2);
+
+ /**
+ * It indicates that the server will skip and disconnect the client. No
+ * other request from the same client will be served.
+ */
+ public static final FtpletEnum RET_DISCONNECT = new FtpletEnum(3);
+
+ private int type;
+
+ /**
+ * Private constructor - set the type
+ */
+ private FtpletEnum(int type) {
+ this.type = type;
+ }
+
+ /**
+ * Equality check
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof FtpletEnum) {
+ return type == ((FtpletEnum) obj).type;
+ }
+ return false;
+ }
+
+ /**
+ * String representation
+ */
+ public String toString() {
+ return String.valueOf(type);
+ }
}
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Structure.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Structure.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Structure.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/Structure.java Sun Aug 17 12:52:42 2008
@@ -15,12 +15,15 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
/**
* Type safe enum for describing the structure
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
public class Structure {
@@ -28,19 +31,19 @@
* File structure
*/
public static final Structure FILE = new Structure("F");
-
+
/**
- * Parses the argument value from the STRU command into
- * the type safe class
+ * Parses the argument value from the STRU command into the type safe class
*
- * @param argument The argument value from the STRU command.
- * Not case sensitive
+ * @param argument
+ * The argument value from the STRU command. Not case sensitive
* @return The appropriate structure
- * @throws IllegalArgumentException If the structure is unknown
+ * @throws IllegalArgumentException
+ * If the structure is unknown
*/
public static Structure parseArgument(char argument) {
- switch(argument) {
+ switch (argument) {
case 'F':
case 'f':
return FILE;
@@ -48,7 +51,7 @@
throw new IllegalArgumentException("Unknown structure: " + argument);
}
}
-
+
private String structure;
/**
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/User.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/User.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/User.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/User.java Sun Aug 17 12:52:42 2008
@@ -15,28 +15,31 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
/**
* Basic user interface.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface User {
-
+public interface User {
+
/**
* Get the user name.
*/
String getName();
-
+
/**
* Get password.
*/
String getPassword();
-
+
/**
* Get all authorities granted to this user
+ *
* @return All authorities
*/
Authority[] getAuthorities();
@@ -45,42 +48,42 @@
/**
* Authorize a {@link AuthorizationRequest} for this user
- * @param request The {@link AuthorizationRequest} to authorize
- * @return A populated AuthorizationRequest if the user was
- * authorized, null otherwise.
+ *
+ * @param request
+ * The {@link AuthorizationRequest} to authorize
+ * @return A populated AuthorizationRequest if the user was authorized, null
+ * otherwise.
*/
AuthorizationRequest authorize(AuthorizationRequest request);
-
+
/**
- * Get the maximum idle time in seconds. Zero or less idle time means no limit.
+ * Get the maximum idle time in seconds. Zero or less idle time means no
+ * limit.
*/
int getMaxIdleTime();
-
+
/**
* Get the user enable status.
*/
boolean getEnabled();
-
+
/**
* Get maximum user upload rate in bytes/sec. Zero or less means no limit.
*/
- //int getMaxUploadRate();
-
+ // int getMaxUploadRate();
/**
* Get maximum user download rate in bytes/sec. Zero or less means no limit.
*/
- //int getMaxDownloadRate();
-
+ // int getMaxDownloadRate();
/**
* Get maximum login number allowed for this user account
*/
- //int getMaxLoginNumber();
-
+ // int getMaxLoginNumber();
/**
- * Get maximum login number allowed from the same IP address when using this user account
+ * Get maximum login number allowed from the same IP address when using this
+ * user account
*/
- //int getMaxLoginPerIP();
-
+ // int getMaxLoginPerIP();
/**
* get user home directory
*/
Modified: mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/UserManager.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/UserManager.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/UserManager.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/main/java/org/apache/ftpserver/ftplet/UserManager.java Sun Aug 17 12:52:42 2008
@@ -15,27 +15,28 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
-
/**
* User manager interface.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
*/
-public
-interface UserManager {
+public interface UserManager {
/**
* Get user by name.
*/
User getUserByName(String login) throws FtpException;
-
+
/**
* Get all user names in the system.
*/
String[] getAllUserNames() throws FtpException;
-
+
/**
* Delete the user from the system.
*
@@ -43,7 +44,7 @@
* if UserManager in read-only mode
*/
void delete(String login) throws FtpException;
-
+
/**
* Save user. If a new user, create it else update the existing user.
*
@@ -51,22 +52,23 @@
* if UserManager in read-only mode
*/
void save(User user) throws FtpException;
-
+
/**
* User existance check.
*/
boolean doesExist(String login) throws FtpException;
-
+
/**
* Authenticate user
*/
- User authenticate(Authentication authentication) throws AuthenticationFailedException;
-
+ User authenticate(Authentication authentication)
+ throws AuthenticationFailedException;
+
/**
* Get admin user name
*/
String getAdminName() throws FtpException;
-
+
/**
* @return true if user with this login is administrator
*/
Modified: mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/DataTypeTest.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/DataTypeTest.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/DataTypeTest.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/DataTypeTest.java Sun Aug 17 12:52:42 2008
@@ -15,14 +15,19 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
import junit.framework.TestCase;
+/**
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
public class DataTypeTest extends TestCase {
-
+
public void testParseA() {
assertSame(DataType.ASCII, DataType.parseArgument('A'));
assertSame(DataType.ASCII, DataType.parseArgument('a'));
@@ -34,12 +39,12 @@
}
public void testParseUnknown() {
- try{
+ try {
DataType.parseArgument('x');
fail("Exception must be thrown");
- } catch(IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
// ignore
- }
+ }
}
}
Modified: mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/ExampleFtplet.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/ExampleFtplet.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/ExampleFtplet.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/ExampleFtplet.java Sun Aug 17 12:52:42 2008
@@ -15,36 +15,33 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
-
+ */
package org.apache.ftpserver.ftplet;
import java.io.IOException;
-import org.apache.ftpserver.ftplet.DefaultFtpReply;
-import org.apache.ftpserver.ftplet.DefaultFtplet;
-import org.apache.ftpserver.ftplet.FtpException;
-import org.apache.ftpserver.ftplet.FtpRequest;
-import org.apache.ftpserver.ftplet.FtpSession;
-import org.apache.ftpserver.ftplet.FtpletEnum;
-
-public class ExampleFtplet extends DefaultFtplet{
+/**
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class ExampleFtplet extends DefaultFtplet {
@Override
- public FtpletEnum onMkdirEnd(FtpSession session, FtpRequest request) throws FtpException, IOException {
+ public FtpletEnum onMkdirEnd(FtpSession session, FtpRequest request)
+ throws FtpException, IOException {
session.write(new DefaultFtpReply(550, "Error!"));
return FtpletEnum.RET_SKIP;
}
@Override
- public FtpletEnum onMkdirStart(FtpSession session, FtpRequest request) throws FtpException, IOException {
- if(session.isSecure() && session.getDataConnection().isSecure()) {
+ public FtpletEnum onMkdirStart(FtpSession session, FtpRequest request)
+ throws FtpException, IOException {
+ if (session.isSecure() && session.getDataConnection().isSecure()) {
// all is good
}
return null;
}
-
-
}
Modified: mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/StructureTest.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/StructureTest.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/StructureTest.java (original)
+++ mina/ftpserver/trunk/ftplet-api/src/test/java/org/apache/ftpserver/ftplet/StructureTest.java Sun Aug 17 12:52:42 2008
@@ -15,12 +15,17 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
package org.apache.ftpserver.ftplet;
import junit.framework.TestCase;
+/**
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
public class StructureTest extends TestCase {
public void testParseF() {
assertSame(Structure.FILE, Structure.parseArgument('F'));
@@ -28,11 +33,11 @@
}
public void testParseUnknown() {
- try{
+ try {
Structure.parseArgument('x');
fail("Exception must be thrown");
- } catch(IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
// ignore
- }
+ }
}
}