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 [4/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/core/src/main/java/org/apache/ftpserver/command/PASS.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PASS.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PASS.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PASS.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.command;
 
@@ -43,97 +43,127 @@
 
 /**
  * <code>PASS &lt;SP&gt; <password> &lt;CRLF&gt;</code><br>
+ * 
+ * The argument field is a Telnet string specifying the user's password. This
+ * command must be immediately preceded by the user name command.
  *
- * The argument field is a Telnet string specifying the user's
- * password.  This command must be immediately preceded by the
- * user name command.
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class PASS extends AbstractCommand {
-    
+public class PASS extends AbstractCommand {
+
     private final Logger LOG = LoggerFactory.getLogger(PASS.class);
-    
+
     /**
      * Execute command.
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-    
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         boolean success = false;
-        
-        ServerFtpStatistics stat = (ServerFtpStatistics)context.getFtpStatistics();
+
+        ServerFtpStatistics stat = (ServerFtpStatistics) context
+                .getFtpStatistics();
         try {
-            
+
             // reset state variables
             session.resetState();
-            
+
             // argument check
             String password = request.getArgument();
-            if(password == null) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "PASS", null));
-                return; 
+            if (password == null) {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                                        "PASS", null));
+                return;
             }
-            
+
             // check user name
             String userName = session.getUserArgument();
 
-            if(userName == null && session.getUser() == null) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "PASS", null));
+            if (userName == null && session.getUser() == null) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "PASS",
+                        null));
                 return;
             }
-            
+
             // already logged-in
-            if(session.isLoggedIn()) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_202_COMMAND_NOT_IMPLEMENTED, "PASS", null));
+            if (session.isLoggedIn()) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_202_COMMAND_NOT_IMPLEMENTED, "PASS",
+                        null));
                 return;
             }
-            
+
             // anonymous login limit check
-            
-            boolean anonymous = userName != null && userName.equals("anonymous");
-            if(anonymous) {
-	            int currAnonLogin = stat.getCurrentAnonymousLoginNumber();
-	            int maxAnonLogin = context.getConnectionConfig().getMaxAnonymousLogins();
-	            if( currAnonLogin >= maxAnonLogin ) {
-	                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION, "PASS.anonymous", null));
-	                return;
-	            }
+
+            boolean anonymous = userName != null
+                    && userName.equals("anonymous");
+            if (anonymous) {
+                int currAnonLogin = stat.getCurrentAnonymousLoginNumber();
+                int maxAnonLogin = context.getConnectionConfig()
+                        .getMaxAnonymousLogins();
+                if (currAnonLogin >= maxAnonLogin) {
+                    session
+                            .write(FtpReplyUtil
+                                    .translate(
+                                            session,
+                                            request,
+                                            context,
+                                            FtpReply.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION,
+                                            "PASS.anonymous", null));
+                    return;
+                }
             }
-	            
+
             // login limit check
             int currLogin = stat.getCurrentLoginNumber();
             int maxLogin = context.getConnectionConfig().getMaxLogins();
-            if(maxLogin != 0 && currLogin >= maxLogin) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION, "PASS.login", null));
+            if (maxLogin != 0 && currLogin >= maxLogin) {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_421_SERVICE_NOT_AVAILABLE_CLOSING_CONTROL_CONNECTION,
+                                        "PASS.login", null));
                 return;
             }
-            
+
             // authenticate user
             UserManager userManager = context.getUserManager();
             User authenticatedUser = null;
             try {
                 UserMetadata userMetadata = new UserMetadata();
-                
-                if(session.getRemoteAddress() instanceof InetSocketAddress) {
-                	userMetadata.setInetAddress(((InetSocketAddress)session.getRemoteAddress()).getAddress());
+
+                if (session.getRemoteAddress() instanceof InetSocketAddress) {
+                    userMetadata.setInetAddress(((InetSocketAddress) session
+                            .getRemoteAddress()).getAddress());
                 }
-                userMetadata.setCertificateChain(session.getClientCertificates());
-                
+                userMetadata.setCertificateChain(session
+                        .getClientCertificates());
+
                 Authentication auth;
-                if(anonymous) {
+                if (anonymous) {
                     auth = new AnonymousAuthentication(userMetadata);
-                }
-                else {
-                    auth = new UsernamePasswordAuthentication(userName, password, userMetadata);
+                } else {
+                    auth = new UsernamePasswordAuthentication(userName,
+                            password, userMetadata);
                 }
 
                 authenticatedUser = userManager.authenticate(auth);
-            } catch(AuthenticationFailedException e) { 
+            } catch (AuthenticationFailedException e) {
                 authenticatedUser = null;
-                LOG.warn("User failed to log in");                
-            }
-            catch(Exception e) {
+                LOG.warn("User failed to log in");
+            } catch (Exception e) {
                 authenticatedUser = null;
                 LOG.warn("PASS.execute()", e);
             }
@@ -144,7 +174,7 @@
             String oldUserArgument = session.getUserArgument();
             int oldMaxIdleTime = session.getMaxIdleTime();
 
-            if(authenticatedUser != null) {
+            if (authenticatedUser != null) {
                 session.setUser(authenticatedUser);
                 session.setUserArgument(null);
                 session.setMaxIdleTime(authenticatedUser.getMaxIdleTime());
@@ -152,61 +182,65 @@
             } else {
                 session.setUser(null);
             }
-            
-            if(!success) {
+
+            if (!success) {
                 // reset due to failure
                 session.setUser(oldUser);
                 session.setUserArgument(oldUserArgument);
                 session.setMaxIdleTime(oldMaxIdleTime);
 
-                delayAfterLoginFailure(context.getConnectionConfig().getLoginFailureDelay());
-                
+                delayAfterLoginFailure(context.getConnectionConfig()
+                        .getLoginFailureDelay());
+
                 LOG.warn("Login failure - " + userName);
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_530_NOT_LOGGED_IN, "PASS", userName));
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_530_NOT_LOGGED_IN, "PASS", userName));
                 stat.setLoginFail(session);
 
                 session.increaseFailedLogins();
 
                 // kick the user if the max number of failed logins is reached
-                int maxAllowedLoginFailues = context.getConnectionConfig().getMaxLoginFailures(); 
-                if(maxAllowedLoginFailues != 0 && 
-                        session.getFailedLogins() >= maxAllowedLoginFailues) {
+                int maxAllowedLoginFailues = context.getConnectionConfig()
+                        .getMaxLoginFailures();
+                if (maxAllowedLoginFailues != 0
+                        && session.getFailedLogins() >= maxAllowedLoginFailues) {
                     session.closeOnFlush().awaitUninterruptibly(10000);
                 }
-                
+
                 return;
             }
-            
+
             // update different objects
-            FileSystemManager fmanager = context.getFileSystemManager(); 
-            FileSystemView fsview = fmanager.createFileSystemView(authenticatedUser);
+            FileSystemManager fmanager = context.getFileSystemManager();
+            FileSystemView fsview = fmanager
+                    .createFileSystemView(authenticatedUser);
             session.setLogin(fsview);
             stat.setLogin(session);
 
             // everything is fine - send login ok message
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_230_USER_LOGGED_IN, "PASS", userName));
-            if(anonymous) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_230_USER_LOGGED_IN, "PASS", userName));
+            if (anonymous) {
                 LOG.info("Anonymous login success - " + password);
-            }
-            else {
+            } else {
                 LOG.info("Login success - " + userName);
             }
-            
-        }
-        finally {
-            
+
+        } finally {
+
             // if login failed - reset user
-            if(!success) {
+            if (!success) {
                 session.reinitialize();
             }
         }
     }
 
     private void delayAfterLoginFailure(final int loginFailureDelay) {
-        
-        if(loginFailureDelay > 0) {
-            LOG.debug("Waiting for " + loginFailureDelay + " milliseconds due to login failure");
-            
+
+        if (loginFailureDelay > 0) {
+            LOG.debug("Waiting for " + loginFailureDelay
+                    + " milliseconds due to login failure");
+
             try {
                 Thread.sleep(loginFailureDelay);
             } catch (InterruptedException e) {

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PASV.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PASV.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PASV.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PASV.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.command;
 
@@ -37,54 +37,62 @@
 
 /**
  * <code>PASV &lt;CRLF&gt;</code><br>
- *
- * This command requests the server-DTP to "listen" on a data
- * port (which is not its default data port) and to wait for a
- * connection rather than initiate one upon receipt of a
- * transfer command.  The response to this command includes the
+ * 
+ * This command requests the server-DTP to "listen" on a data port (which is not
+ * its default data port) and to wait for a connection rather than initiate one
+ * upon receipt of a transfer command. The response to this command includes the
  * host and port address this server is listening on.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class PASV extends AbstractCommand {
+public class PASV extends AbstractCommand {
 
     private final Logger LOG = LoggerFactory.getLogger(PASV.class);
-    
+
     /**
      * Execute command
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-        
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // reset state variables
         session.resetState();
-        
+
         // set data connection
         ServerDataConnectionFactory dataCon = session.getDataConnection();
-        InetAddress externalPassiveAddress = session.getListener().getDataConnectionConfiguration().getPassiveExernalAddress();
-        
+        InetAddress externalPassiveAddress = session.getListener()
+                .getDataConnectionConfiguration().getPassiveExernalAddress();
+
         try {
-            InetSocketAddress dataConAddress = dataCon.initPassiveDataConnection();
+            InetSocketAddress dataConAddress = dataCon
+                    .initPassiveDataConnection();
 
-            
             // get connection info
             InetAddress servAddr;
-            if(externalPassiveAddress != null) {
+            if (externalPassiveAddress != null) {
                 servAddr = externalPassiveAddress;
             } else {
                 servAddr = dataConAddress.getAddress();
             }
-            
+
             // send connection info to client
-            InetSocketAddress externalDataConAddress = new InetSocketAddress(servAddr, dataConAddress.getPort());
-            
-            String addrStr = SocketAddressEncoder.encode(externalDataConAddress);
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_227_ENTERING_PASSIVE_MODE, "PASV", addrStr));
-        } catch(DataConnectionException e) {
+            InetSocketAddress externalDataConAddress = new InetSocketAddress(
+                    servAddr, dataConAddress.getPort());
+
+            String addrStr = SocketAddressEncoder
+                    .encode(externalDataConAddress);
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_227_ENTERING_PASSIVE_MODE, "PASV", addrStr));
+        } catch (DataConnectionException e) {
             LOG.warn("Failed to open passive data connection", e);
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION, "PASV", null));
-            return;   
+            session
+                    .write(FtpReplyUtil.translate(session, request, context,
+                            FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION,
+                            "PASV", null));
+            return;
         }
-        
+
     }
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PBSZ.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PBSZ.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PBSZ.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PBSZ.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.command;
 
@@ -30,18 +30,21 @@
 
 /**
  * Protection buffer size.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class PBSZ extends AbstractCommand {
+public class PBSZ extends AbstractCommand {
 
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-        
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         session.resetState();
-        session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_200_COMMAND_OKAY, "PBSZ", null));
+        session.write(FtpReplyUtil.translate(session, request, context,
+                FtpReply.REPLY_200_COMMAND_OKAY, "PBSZ", null));
     }
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PORT.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PORT.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PORT.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PORT.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.command;
 
@@ -38,79 +38,101 @@
 
 /**
  * <code>PORT &lt;SP&gt; <host-port> &lt;CRLF&gt;</code><br>
- *
- * The argument is a HOST-PORT specification for the data port
- * to be used in data connection.  There are defaults for both
- * the user and server data ports, and under normal
- * circumstances this command and its reply are not needed.  If
- * this command is used, the argument is the concatenation of a
- * 32-bit internet host address and a 16-bit TCP port address.
- * This address information is broken into 8-bit fields and the
- * value of each field is transmitted as a decimal number (in
- * character string representation).  The fields are separated
- * by commas.  A port command would be:
- *
- *   PORT h1,h2,h3,h4,p1,p2
+ * 
+ * The argument is a HOST-PORT specification for the data port to be used in
+ * data connection. There are defaults for both the user and server data ports,
+ * and under normal circumstances this command and its reply are not needed. If
+ * this command is used, the argument is the concatenation of a 32-bit internet
+ * host address and a 16-bit TCP port address. This address information is
+ * broken into 8-bit fields and the value of each field is transmitted as a
+ * decimal number (in character string representation). The fields are separated
+ * by commas. A port command would be:
+ * 
+ * PORT h1,h2,h3,h4,p1,p2
  * 
  * where h1 is the high order 8 bits of the internet host address.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class PORT extends AbstractCommand {
+public class PORT extends AbstractCommand {
 
     private final Logger LOG = LoggerFactory.getLogger(PORT.class);
-    
+
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException {
-        
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException {
+
         // reset state variables
         session.resetState();
-        
+
         // argument check
-        if(!request.hasArgument()) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "PORT", null));
-            return;  
+        if (!request.hasArgument()) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                    "PORT", null));
+            return;
         }
 
         // is port enabled
-        DataConnectionConfiguration dataCfg = session.getListener().getDataConnectionConfiguration();
-        if(!dataCfg.isActiveEnabled()) {
-            session.write(FtpReplyUtil.translate(session, request, context, 510, "PORT.disabled", null));
+        DataConnectionConfiguration dataCfg = session.getListener()
+                .getDataConnectionConfiguration();
+        if (!dataCfg.isActiveEnabled()) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    510, "PORT.disabled", null));
             return;
-        } 
-        
+        }
+
         InetSocketAddress address;
         try {
             address = SocketAddressEncoder.decode(request.getArgument());
-        } catch(IllegalInetAddressException e) {
-            session.write(FtpReplyUtil.translate(session, request, context, 510, "PORT", null));
+        } catch (IllegalInetAddressException e) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    510, "PORT", null));
             return;
-        } catch(IllegalPortException e) {
+        } catch (IllegalPortException e) {
             LOG.debug("Invalid data port: " + request.getArgument(), e);
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_552_REQUESTED_FILE_ACTION_ABORTED_EXCEEDED_STORAGE, "PORT.invalid", null)); 
-            return; 
-        } catch(UnknownHostException e) {
+            session
+                    .write(FtpReplyUtil
+                            .translate(
+                                    session,
+                                    request,
+                                    context,
+                                    FtpReply.REPLY_552_REQUESTED_FILE_ACTION_ABORTED_EXCEEDED_STORAGE,
+                                    "PORT.invalid", null));
+            return;
+        } catch (UnknownHostException e) {
             LOG.debug("Unknown host", e);
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "PORT.host", null));
+            session
+                    .write(FtpReplyUtil
+                            .translate(
+                                    session,
+                                    request,
+                                    context,
+                                    FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED,
+                                    "PORT.host", null));
             return;
         }
-        
+
         // check IP
-        if(dataCfg.isActiveIpCheck()) {
-        	if(session.getRemoteAddress() instanceof InetSocketAddress) {
-        		InetAddress clientAddr = ((InetSocketAddress)session.getRemoteAddress()).getAddress();
-        		if(!address.getAddress().equals(clientAddr)) {
-        			session.write(FtpReplyUtil.translate(session, request, context, 510, "PORT.mismatch", null));
-        			return;
-        		}
-        	}
+        if (dataCfg.isActiveIpCheck()) {
+            if (session.getRemoteAddress() instanceof InetSocketAddress) {
+                InetAddress clientAddr = ((InetSocketAddress) session
+                        .getRemoteAddress()).getAddress();
+                if (!address.getAddress().equals(clientAddr)) {
+                    session.write(FtpReplyUtil.translate(session, request,
+                            context, 510, "PORT.mismatch", null));
+                    return;
+                }
+            }
         }
-        
+
         session.getDataConnection().initActiveDataConnection(address);
-        session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_200_COMMAND_OKAY, "PORT", null));
+        session.write(FtpReplyUtil.translate(session, request, context,
+                FtpReply.REPLY_200_COMMAND_OKAY, "PORT", null));
     }
-    
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PROT.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PROT.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PROT.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PROT.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.command;
 
@@ -31,46 +31,58 @@
 
 /**
  * Data channel protection level.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class PROT extends AbstractCommand {
+public class PROT extends AbstractCommand {
 
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-    
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // reset state variables
         session.resetState();
-        
+
         // check argument
         String arg = request.getArgument();
-        if(arg == null) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "PROT", null));
+        if (arg == null) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                    "PROT", null));
             return;
         }
-        
+
         // check argument
         arg = arg.toUpperCase();
         ServerDataConnectionFactory dcon = session.getDataConnection();
-        if(arg.equals("C")) {
+        if (arg.equals("C")) {
             dcon.setSecure(false);
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_200_COMMAND_OKAY, "PROT", null));
-        }
-        else if(arg.equals("P")) {
-            if(session.getListener().getDataConnectionConfiguration().getSslConfiguration() == null) {
-                session.write(FtpReplyUtil.translate(session, request, context, 431, "PROT", null));
-            }
-            else {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_200_COMMAND_OKAY, "PROT", null));
+        } else if (arg.equals("P")) {
+            if (session.getListener().getDataConnectionConfiguration()
+                    .getSslConfiguration() == null) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        431, "PROT", null));
+            } else {
                 dcon.setSecure(true);
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_200_COMMAND_OKAY, "PROT", null));
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_200_COMMAND_OKAY, "PROT", null));
             }
-        }
-        else {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER, "PROT", null));
+        } else {
+            session
+                    .write(FtpReplyUtil
+                            .translate(
+                                    session,
+                                    request,
+                                    context,
+                                    FtpReply.REPLY_504_COMMAND_NOT_IMPLEMENTED_FOR_THAT_PARAMETER,
+                                    "PROT", null));
         }
     }
-    
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PWD.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PWD.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PWD.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/PWD.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.command;
 
@@ -31,23 +31,26 @@
 
 /**
  * <code>PWD  &lt;CRLF&gt;</code><br>
+ * 
+ * This command causes the name of the current working directory to be returned
+ * in the reply.
  *
- * This command causes the name of the current working
- * directory to be returned in the reply.
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class PWD extends AbstractCommand {
+public class PWD extends AbstractCommand {
 
     /**
      * Execute command
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
         session.resetState();
         FileSystemView fsview = session.getFileSystemView();
         String currDir = fsview.getCurrentDirectory().getFullName();
-        session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_257_PATHNAME_CREATED, "PWD", currDir));
+        session.write(FtpReplyUtil.translate(session, request, context,
+                FtpReply.REPLY_257_PATHNAME_CREATED, "PWD", currDir));
     }
-    
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/QUIT.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/QUIT.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/QUIT.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/QUIT.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.command;
 
@@ -29,22 +29,25 @@
 
 /**
  * <code>QUIT &lt;CRLF&gt;</code><br>
+ * 
+ * This command terminates a USER and if file transfer is not in progress, the
+ * server closes the control connection.
  *
- * This command terminates a USER and if file transfer is not
- * in progress, the server closes the control connection.
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class QUIT extends AbstractCommand {
-    
+public class QUIT extends AbstractCommand {
+
     /**
      * Execute command
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException {
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException {
         session.resetState();
-        session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_221_CLOSING_CONTROL_CONNECTION, "QUIT", null));
-		
+        session.write(FtpReplyUtil.translate(session, request, context,
+                FtpReply.REPLY_221_CLOSING_CONTROL_CONNECTION, "QUIT", null));
+
         session.closeOnFlush().awaitUninterruptibly(10000);
     }
 

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REIN.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REIN.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REIN.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REIN.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.command;
 
@@ -28,23 +28,26 @@
 import org.apache.ftpserver.util.FtpReplyUtil;
 
 /**
-  * <code>REIN &lt;CRLF&gt;</code><br>
-  *
-  * This command flushes a USER, without affecting transfers in progress.
-  * The server state should otherwise be as when the user first connects.
-  */
-public 
-class REIN extends AbstractCommand {
+ * <code>REIN &lt;CRLF&gt;</code><br>
+ * 
+ * This command flushes a USER, without affecting transfers in progress. The
+ * server state should otherwise be as when the user first connects.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class REIN extends AbstractCommand {
 
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException {
-        
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException {
+
         session.reinitialize();
         session.setLanguage(null);
-        session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_220_SERVICE_READY, "REIN", null));
-    }   
+        session.write(FtpReplyUtil.translate(session, request, context,
+                FtpReply.REPLY_220_SERVICE_READY, "REIN", null));
+    }
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REST.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REST.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REST.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/REST.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.command;
 
@@ -31,54 +31,71 @@
 
 /**
  * <code>REST &lt;SP&gt; <marker> &lt;CRLF&gt;</code><br>
+ * 
+ * The argument field represents the server marker at which file transfer is to
+ * be restarted. This command does not cause file transfer but skips over the
+ * file to the specified data checkpoint. This command shall be immediately
+ * followed by the appropriate FTP service command which shall cause file
+ * transfer to resume.
  *
- * The argument field represents the server marker at which
- * file transfer is to be restarted.  This command does not
- * cause file transfer but skips over the file to the specified
- * data checkpoint.  This command shall be immediately followed
- * by the appropriate FTP service command which shall cause
- * file transfer to resume.
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class REST extends AbstractCommand {
+public class REST extends AbstractCommand {
 
     private final Logger LOG = LoggerFactory.getLogger(REST.class);
-    
+
     /**
      * Execute command
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException {
-        
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException {
+
         // argument check
         String argument = request.getArgument();
-        if(argument == null) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "REST", null));
-            return;  
+        if (argument == null) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                    "REST", null));
+            return;
         }
-        
+
         // get offset number
         session.resetState();
         long skipLen = 0L;
         try {
             skipLen = Long.parseLong(argument);
-            
+
             // check offset number
-            if(skipLen < 0L) {
+            if (skipLen < 0L) {
                 skipLen = 0L;
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "REST.negetive", null));
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                                        "REST.negetive", null));
+            } else {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_350_REQUESTED_FILE_ACTION_PENDING_FURTHER_INFORMATION,
+                                        "REST", null));
             }
-            else {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_350_REQUESTED_FILE_ACTION_PENDING_FURTHER_INFORMATION, "REST", null));
-            }
-        }
-        catch(NumberFormatException ex) {
+        } catch (NumberFormatException ex) {
             LOG.debug("Invalid restart position: " + argument, ex);
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "REST.invalid", null)); 
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                    "REST.invalid", null));
         }
-        
+
         session.setFileOffset(skipLen);
-    } 
-    
+    }
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RETR.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RETR.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RETR.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RETR.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.command;
 
@@ -44,82 +44,102 @@
 
 /**
  * <code>RETR &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
+ * 
+ * This command causes the server-DTP to transfer a copy of the file, specified
+ * in the pathname, to the server- or user-DTP at the other end of the data
+ * connection. The status and contents of the file at the server site shall be
+ * unaffected.
  *
- * This command causes the server-DTP to transfer a copy of the
- * file, specified in the pathname, to the server- or user-DTP
- * at the other end of the data connection.  The status and
- * contents of the file at the server site shall be unaffected.
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class RETR extends AbstractCommand {
-    
+public class RETR extends AbstractCommand {
+
     private final Logger LOG = LoggerFactory.getLogger(RETR.class);
 
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-        
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         try {
-        
+
             // get state variable
             long skipLen = session.getFileOffset();
-            
+
             // argument check
             String fileName = request.getArgument();
-            if(fileName == null) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RETR", null));
-                return;  
+            if (fileName == null) {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                                        "RETR", null));
+                return;
             }
-    
+
             // get file object
             FileObject file = null;
             try {
                 file = session.getFileSystemView().getFileObject(fileName);
-            }
-            catch(Exception ex) {
+            } catch (Exception ex) {
                 LOG.debug("Exception getting file object", ex);
             }
-            if(file == null) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.missing", fileName));
+            if (file == null) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
+                        "RETR.missing", fileName));
                 return;
             }
             fileName = file.getFullName();
-            
+
             // check file existance
-            if(!file.doesExist()) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.missing", fileName));
+            if (!file.doesExist()) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
+                        "RETR.missing", fileName));
                 return;
             }
-            
+
             // check valid file
-            if(!file.isFile()) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.invalid", fileName));
+            if (!file.isFile()) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
+                        "RETR.invalid", fileName));
                 return;
             }
-            
+
             // check permission
-            if(!file.hasReadPermission()) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RETR.permission", fileName));
+            if (!file.hasReadPermission()) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
+                        "RETR.permission", fileName));
                 return;
             }
 
-            // 24-10-2007 - added check if PORT or PASV is issued, see https://issues.apache.org/jira/browse/FTPSERVER-110
+            // 24-10-2007 - added check if PORT or PASV is issued, see
+            // https://issues.apache.org/jira/browse/FTPSERVER-110
             DataConnectionFactory connFactory = session.getDataConnection();
             if (connFactory instanceof IODataConnectionFactory) {
-                InetAddress address = ((IODataConnectionFactory)connFactory).getInetAddress();
+                InetAddress address = ((IODataConnectionFactory) connFactory)
+                        .getInetAddress();
                 if (address == null) {
-                    session.write(new DefaultFtpReply(FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "PORT or PASV must be issued first"));
+                    session.write(new DefaultFtpReply(
+                            FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS,
+                            "PORT or PASV must be issued first"));
                     return;
                 }
             }
-            
+
             // get data connection
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_150_FILE_STATUS_OKAY, "RETR", null));
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_150_FILE_STATUS_OKAY, "RETR", null));
 
-            
             // send file data to client
             boolean failure = false;
             InputStream is = null;
@@ -129,74 +149,83 @@
                 dataConnection = session.getDataConnection().openConnection();
             } catch (Exception e) {
                 LOG.debug("Exception getting the output data stream", e);
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION, "RETR", null));
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_425_CANT_OPEN_DATA_CONNECTION, "RETR",
+                        null));
                 return;
             }
-            
+
             try {
-                
+
                 // open streams
                 is = openInputStream(session, file, skipLen);
-                
+
                 // transfer data
                 long transSz = dataConnection.transferToClient(is);
-                
+
                 // log message
                 String userName = session.getUser().getName();
                 LOG.info("File download : " + userName + " - " + fileName);
-                
+
                 // notify the statistics component
-                ServerFtpStatistics ftpStat = (ServerFtpStatistics)context.getFtpStatistics();
-                if(ftpStat != null)  {
+                ServerFtpStatistics ftpStat = (ServerFtpStatistics) context
+                        .getFtpStatistics();
+                if (ftpStat != null) {
                     ftpStat.setDownload(session, file, transSz);
                 }
-            }
-            catch(SocketException ex) {
+            } catch (SocketException ex) {
                 LOG.debug("Socket exception during data transfer", ex);
                 failure = true;
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED, "RETR", fileName));
-            }
-            catch(IOException ex) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_426_CONNECTION_CLOSED_TRANSFER_ABORTED,
+                        "RETR", fileName));
+            } catch (IOException ex) {
                 LOG.debug("IOException during data transfer", ex);
                 failure = true;
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN, "RETR", fileName));
-            }
-            finally {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_551_REQUESTED_ACTION_ABORTED_PAGE_TYPE_UNKNOWN,
+                                        "RETR", fileName));
+            } finally {
                 IoUtils.close(is);
             }
-            
+
             // if data transfer ok - send transfer complete message
-            if(!failure) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_226_CLOSING_DATA_CONNECTION, "RETR", fileName));
-                
+            if (!failure) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_226_CLOSING_DATA_CONNECTION, "RETR",
+                        fileName));
+
             }
         } finally {
             session.resetState();
             session.getDataConnection().closeDataConnection();
         }
     }
-    
+
     /**
      * Skip length and open input stream.
      */
-    public InputStream openInputStream(FtpIoSession session, 
-                                       FileObject file, 
-                                       long skipLen) throws IOException {
+    public InputStream openInputStream(FtpIoSession session, FileObject file,
+            long skipLen) throws IOException {
         InputStream in;
-        if(session.getDataType() == DataType.ASCII) {
+        if (session.getDataType() == DataType.ASCII) {
             int c;
             long offset = 0L;
             in = new BufferedInputStream(file.createInputStream(0L));
             while (offset++ < skipLen) {
-                if ( (c=in.read()) == -1) {
+                if ((c = in.read()) == -1) {
                     throw new IOException("Cannot skip");
                 }
                 if (c == '\n') {
                     offset++;
                 }
             }
-        }
-        else {
+        } else {
             in = file.createInputStream(skipLen);
         }
         return in;

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RMD.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RMD.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RMD.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RMD.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.command;
 
@@ -34,74 +34,87 @@
 
 /**
  * <code>RMD  &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
+ * 
+ * This command causes the directory specified in the pathname to be removed as
+ * a directory (if the pathname is absolute) or as a subdirectory of the current
+ * working directory (if the pathname is relative).
  *
- * This command causes the directory specified in the pathname
- * to be removed as a directory (if the pathname is absolute)
- * or as a subdirectory of the current working directory (if
- * the pathname is relative).
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class RMD extends AbstractCommand {
-    
+public class RMD extends AbstractCommand {
+
     private final Logger LOG = LoggerFactory.getLogger(RMD.class);
 
     /**
      * Execute command.
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-        
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // reset state variables
         session.resetState();
-        
+
         // argument check
         String fileName = request.getArgument();
-        if(fileName == null) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RMD", null));
-            return;  
+        if (fileName == null) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                    "RMD", null));
+            return;
         }
-        
+
         // get file object
         FileObject file = null;
         try {
             file = session.getFileSystemView().getFileObject(fileName);
-        }
-        catch(Exception ex) {
+        } catch (Exception ex) {
             LOG.debug("Exception getting file object", ex);
         }
-        if(file == null) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RMD.permission", fileName));
+        if (file == null) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
+                    "RMD.permission", fileName));
             return;
         }
-        
+
         // check permission
         fileName = file.getFullName();
-        if( !file.hasDeletePermission() ) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RMD.permission", fileName));
+        if (!file.hasDeletePermission()) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
+                    "RMD.permission", fileName));
             return;
         }
-        
+
         // check file
-        if(!file.isDirectory()) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RMD.invalid", fileName));
+        if (!file.isDirectory()) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
+                    "RMD.invalid", fileName));
             return;
         }
-        
+
         // now delete directory
-        if(file.delete()) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RMD", fileName)); 
-            
+        if (file.delete()) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RMD",
+                    fileName));
+
             // write log message
             String userName = session.getUser().getName();
             LOG.info("Directory remove : " + userName + " - " + fileName);
-            
+
             // notify statistics object
-            ServerFtpStatistics ftpStat = (ServerFtpStatistics)context.getFtpStatistics();
+            ServerFtpStatistics ftpStat = (ServerFtpStatistics) context
+                    .getFtpStatistics();
             ftpStat.setRmdir(session, file);
-            
+
         } else {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "RMD", fileName));
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_450_REQUESTED_FILE_ACTION_NOT_TAKEN, "RMD",
+                    fileName));
         }
     }
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNFR.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNFR.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNFR.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNFR.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.command;
 
@@ -33,53 +33,63 @@
 
 /**
  * <code>RNFR &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
+ * 
+ * This command specifies the old pathname of the file which is to be renamed.
+ * This command must be immediately followed by a "rename to" command specifying
+ * the new file pathname.
  *
- * This command specifies the old pathname of the file which is
- * to be renamed.  This command must be immediately followed by
- * a "rename to" command specifying the new file pathname.
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class RNFR extends AbstractCommand {
+public class RNFR extends AbstractCommand {
 
-    
     private final Logger LOG = LoggerFactory.getLogger(RNFR.class);
-    
+
     /**
      * Execute command
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-        
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // reset state variable
         session.resetState();
-        
+
         // argument check
         String fileName = request.getArgument();
-        if(fileName == null) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RNFR", null));
-            return;  
+        if (fileName == null) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                    "RNFR", null));
+            return;
         }
-                
+
         // get filename
         FileObject renFr = null;
         try {
             System.out.println("######" + session.getFileSystemView());
             renFr = session.getFileSystemView().getFileObject(fileName);
-        }
-        catch(Exception ex) {
+        } catch (Exception ex) {
             LOG.debug("Exception getting file object", ex);
         }
-            
+
         // check file
-        if(renFr == null) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RNFR", fileName));
-        }
-        else {
+        if (renFr == null) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "RNFR",
+                    fileName));
+        } else {
             session.setRenameFrom(renFr);
             fileName = renFr.getFullName();
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_350_REQUESTED_FILE_ACTION_PENDING_FURTHER_INFORMATION, "RNFR", fileName));    
+            session
+                    .write(FtpReplyUtil
+                            .translate(
+                                    session,
+                                    request,
+                                    context,
+                                    FtpReply.REPLY_350_REQUESTED_FILE_ACTION_PENDING_FURTHER_INFORMATION,
+                                    "RNFR", fileName));
         }
     }
-    
+
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNTO.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNTO.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNTO.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/RNTO.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.command;
 
@@ -33,79 +33,118 @@
 
 /**
  * <code>RNTO &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;</code><br>
+ * 
+ * This command specifies the new pathname of the file specified in the
+ * immediately preceding "rename from" command. Together the two commands cause
+ * a file to be renamed.
  *
- * This command specifies the new pathname of the file
- * specified in the immediately preceding "rename from"
- * command.  Together the two commands cause a file to be
- * renamed.
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class RNTO extends AbstractCommand {
-    
+public class RNTO extends AbstractCommand {
+
     private final Logger LOG = LoggerFactory.getLogger(RNTO.class);
 
     /**
      * Execute command.
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
         try {
-            
+
             // argument check
             String toFileStr = request.getArgument();
-            if(toFileStr == null) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "RNTO", null));
-                return;  
+            if (toFileStr == null) {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                                        "RNTO", null));
+                return;
             }
-            
+
             // get the "rename from" file object
             FileObject frFile = session.getRenameFrom();
-            if( frFile == null ) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "RNTO", null));
+            if (frFile == null) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "RNTO",
+                        null));
                 return;
             }
-            
+
             // get target file
             FileObject toFile = null;
             try {
                 toFile = session.getFileSystemView().getFileObject(toFileStr);
-            }
-            catch(Exception ex) {
+            } catch (Exception ex) {
                 LOG.debug("Exception getting file object", ex);
             }
-            if(toFile == null) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO.invalid", null));
+            if (toFile == null) {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED,
+                                        "RNTO.invalid", null));
                 return;
             }
             toFileStr = toFile.getFullName();
-            
+
             // check permission
-            if( !toFile.hasWritePermission() ) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO.permission", null));
+            if (!toFile.hasWritePermission()) {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED,
+                                        "RNTO.permission", null));
                 return;
             }
-            
+
             // check file existance
-            if( !frFile.doesExist() ) {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO.missing", null));
+            if (!frFile.doesExist()) {
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED,
+                                        "RNTO.missing", null));
                 return;
             }
-            
+
             // now rename
-            if( frFile.move(toFile) ) { 
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RNTO", toFileStr));
+            if (frFile.move(toFile)) {
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_250_REQUESTED_FILE_ACTION_OKAY, "RNTO",
+                        toFileStr));
+
+                LOG.info("File rename (" + session.getUser().getName() + ") "
+                        + frFile.getFullName() + " -> " + toFile.getFullName());
 
-                LOG.info("File rename (" + session.getUser().getName() + ") " 
-                                         + frFile.getFullName() + " -> " + toFile.getFullName());
-                
             } else {
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED, "RNTO", toFileStr));
+                session
+                        .write(FtpReplyUtil
+                                .translate(
+                                        session,
+                                        request,
+                                        context,
+                                        FtpReply.REPLY_553_REQUESTED_ACTION_NOT_TAKEN_FILE_NAME_NOT_ALLOWED,
+                                        "RNTO", toFileStr));
             }
-        
+
         } finally {
-            session.resetState(); 
+            session.resetState();
         }
-    } 
+    }
 
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE.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.command;
 
@@ -32,68 +32,77 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * Handle SITE command.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class SITE extends AbstractCommand {
+public class SITE extends AbstractCommand {
 
     private final Logger LOG = LoggerFactory.getLogger(SITE.class);
-    
-    private static final HashMap<String, Command> COMMAND_MAP = new HashMap<String, Command>(16);
-    
-    
+
+    private static final HashMap<String, Command> COMMAND_MAP = new HashMap<String, Command>(
+            16);
+
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-        
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // get request name
         String argument = request.getArgument();
-        if(argument != null) {
+        if (argument != null) {
             int spaceIndex = argument.indexOf(' ');
-            if(spaceIndex != -1) {
+            if (spaceIndex != -1) {
                 argument = argument.substring(0, spaceIndex);
             }
             argument = argument.toUpperCase();
         }
-        
+
         // no params
-        if(argument == null) {
+        if (argument == null) {
             session.resetState();
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_200_COMMAND_OKAY, "SITE", null));
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_200_COMMAND_OKAY, "SITE", null));
             return;
         }
-        
+
         // call appropriate command method
-        String siteRequest = "SITE_" + argument; 
-        Command command = (Command)COMMAND_MAP.get( siteRequest );
+        String siteRequest = "SITE_" + argument;
+        Command command = (Command) COMMAND_MAP.get(siteRequest);
         try {
-            if(command != null) {
+            if (command != null) {
                 command.execute(session, context, request);
-            }
-            else {
+            } else {
                 session.resetState();
-                session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_502_COMMAND_NOT_IMPLEMENTED, "SITE", argument));
+                session.write(FtpReplyUtil.translate(session, request, context,
+                        FtpReply.REPLY_502_COMMAND_NOT_IMPLEMENTED, "SITE",
+                        argument));
             }
-        }
-        catch(Exception ex) {
+        } catch (Exception ex) {
             LOG.warn("SITE.execute()", ex);
             session.resetState();
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_500_SYNTAX_ERROR_COMMAND_UNRECOGNIZED, "SITE", null));
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_500_SYNTAX_ERROR_COMMAND_UNRECOGNIZED,
+                    "SITE", null));
         }
-    
+
     }
-    
+
     // initialize all the SITE command handlers
     static {
-        COMMAND_MAP.put("SITE_DESCUSER", new org.apache.ftpserver.command.SITE_DESCUSER());
-        COMMAND_MAP.put("SITE_HELP",     new org.apache.ftpserver.command.SITE_HELP());
-        COMMAND_MAP.put("SITE_STAT",     new org.apache.ftpserver.command.SITE_STAT());
-        COMMAND_MAP.put("SITE_WHO",      new org.apache.ftpserver.command.SITE_WHO());
-        COMMAND_MAP.put("SITE_ZONE",     new org.apache.ftpserver.command.SITE_ZONE());
+        COMMAND_MAP.put("SITE_DESCUSER",
+                new org.apache.ftpserver.command.SITE_DESCUSER());
+        COMMAND_MAP.put("SITE_HELP",
+                new org.apache.ftpserver.command.SITE_HELP());
+        COMMAND_MAP.put("SITE_STAT",
+                new org.apache.ftpserver.command.SITE_STAT());
+        COMMAND_MAP
+                .put("SITE_WHO", new org.apache.ftpserver.command.SITE_WHO());
+        COMMAND_MAP.put("SITE_ZONE",
+                new org.apache.ftpserver.command.SITE_ZONE());
     }
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_DESCUSER.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_DESCUSER.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_DESCUSER.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_DESCUSER.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.command;
 
@@ -37,78 +37,91 @@
 
 /**
  * This SITE command returns the specified user information.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class SITE_DESCUSER extends AbstractCommand {
+public class SITE_DESCUSER extends AbstractCommand {
 
     private final Logger LOG = LoggerFactory.getLogger(SITE_DESCUSER.class);
-    
+
     /**
      * Execute command.
      */
-    public void execute(final FtpIoSession session, 
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-    
+    public void execute(final FtpIoSession session,
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // reset state variables
         session.resetState();
-        
+
         // only administrator can execute this
-        UserManager userManager = context.getUserManager(); 
+        UserManager userManager = context.getUserManager();
         boolean isAdmin = userManager.isAdmin(session.getUser().getName());
-        if(!isAdmin) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_530_NOT_LOGGED_IN, "SITE", null));
+        if (!isAdmin) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_530_NOT_LOGGED_IN, "SITE", null));
             return;
         }
-        
+
         // get the user name
         String argument = request.getArgument();
         int spIndex = argument.indexOf(' ');
-        if(spIndex == -1) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS, "SITE.DESCUSER", null));
+        if (spIndex == -1) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS,
+                    "SITE.DESCUSER", null));
             return;
         }
         String userName = argument.substring(spIndex + 1);
-        
+
         // check the user existance
         UserManager usrManager = context.getUserManager();
         User user = null;
         try {
-            if(usrManager.doesExist(userName)) {
+            if (usrManager.doesExist(userName)) {
                 user = usrManager.getUserByName(userName);
             }
-        }
-        catch(FtpException ex) {
+        } catch (FtpException ex) {
             LOG.debug("Exception trying to get user from user manager", ex);
             user = null;
         }
-        if(user == null) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS, "SITE.DESCUSER", userName));
+        if (user == null) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_501_SYNTAX_ERROR_IN_PARAMETERS_OR_ARGUMENTS,
+                    "SITE.DESCUSER", userName));
             return;
         }
-        
+
         // send the user information
         StringBuffer sb = new StringBuffer(128);
         sb.append("\n");
         sb.append("userid          : ").append(user.getName()).append("\n");
         sb.append("userpassword    : ********\n");
-        sb.append("homedirectory   : ").append(user.getHomeDirectory()).append("\n");
-        sb.append("writepermission : ").append(user.authorize(new WriteRequest())).append("\n");
+        sb.append("homedirectory   : ").append(user.getHomeDirectory()).append(
+                "\n");
+        sb.append("writepermission : ").append(
+                user.authorize(new WriteRequest())).append("\n");
         sb.append("enableflag      : ").append(user.getEnabled()).append("\n");
-        sb.append("idletime        : ").append(user.getMaxIdleTime()).append("\n");
-        
+        sb.append("idletime        : ").append(user.getMaxIdleTime()).append(
+                "\n");
+
         TransferRateRequest transferRateRequest = new TransferRateRequest();
-        transferRateRequest = (TransferRateRequest) session.getUser().authorize(transferRateRequest);
-        
-        if(transferRateRequest != null) {
-            sb.append("uploadrate      : ").append(transferRateRequest.getMaxUploadRate()).append("\n");
-            sb.append("downloadrate    : ").append(transferRateRequest.getMaxDownloadRate()).append("\n");
+        transferRateRequest = (TransferRateRequest) session.getUser()
+                .authorize(transferRateRequest);
+
+        if (transferRateRequest != null) {
+            sb.append("uploadrate      : ").append(
+                    transferRateRequest.getMaxUploadRate()).append("\n");
+            sb.append("downloadrate    : ").append(
+                    transferRateRequest.getMaxDownloadRate()).append("\n");
         } else {
             sb.append("uploadrate      : 0\n");
             sb.append("downloadrate    : 0\n");
         }
         sb.append('\n');
-        session.write(new DefaultFtpReply(FtpReply.REPLY_200_COMMAND_OKAY, sb.toString()));
+        session.write(new DefaultFtpReply(FtpReply.REPLY_200_COMMAND_OKAY, sb
+                .toString()));
     }
 
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_HELP.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_HELP.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_HELP.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_HELP.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.command;
 
@@ -28,25 +28,27 @@
 import org.apache.ftpserver.interfaces.FtpServerContext;
 import org.apache.ftpserver.util.FtpReplyUtil;
 
-
 /**
  * Show SITE help message.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class SITE_HELP extends AbstractCommand {
-    
+public class SITE_HELP extends AbstractCommand {
+
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-        
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // reset state variables
         session.resetState();
-        
+
         // print help message
-        session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_200_COMMAND_OKAY, "SITE.HELP", null));
+        session.write(FtpReplyUtil.translate(session, request, context,
+                FtpReply.REPLY_200_COMMAND_OKAY, "SITE.HELP", null));
     }
 
 }

Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_STAT.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_STAT.java?rev=686637&r1=686636&r2=686637&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_STAT.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/command/SITE_STAT.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.command;
 
@@ -34,48 +34,67 @@
 
 /**
  * Show all statistics information.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
  */
-public 
-class SITE_STAT extends AbstractCommand {
+public class SITE_STAT extends AbstractCommand {
 
     /**
      * Execute command.
      */
     public void execute(final FtpIoSession session,
-            final FtpServerContext context,
-            final FtpRequest request) throws IOException, FtpException {
-    
+            final FtpServerContext context, final FtpRequest request)
+            throws IOException, FtpException {
+
         // reset state variables
         session.resetState();
-        
+
         // only administrator can execute this
-        UserManager userManager = context.getUserManager(); 
+        UserManager userManager = context.getUserManager();
         boolean isAdmin = userManager.isAdmin(session.getUser().getName());
-        if(!isAdmin) {
-            session.write(FtpReplyUtil.translate(session, request, context, FtpReply.REPLY_530_NOT_LOGGED_IN, "SITE", null));
+        if (!isAdmin) {
+            session.write(FtpReplyUtil.translate(session, request, context,
+                    FtpReply.REPLY_530_NOT_LOGGED_IN, "SITE", null));
             return;
         }
-        
+
         // get statistics information
         FtpStatistics stat = context.getFtpStatistics();
         StringBuffer sb = new StringBuffer(256);
         sb.append('\n');
-        sb.append("Start Time               : ").append( DateUtils.getISO8601Date(stat.getStartTime().getTime()) ).append('\n');
-        sb.append("File Upload Number       : ").append( stat.getTotalUploadNumber() ).append('\n');
-        sb.append("File Download Number     : ").append( stat.getTotalDownloadNumber() ).append('\n');
-        sb.append("File Delete Number       : ").append( stat.getTotalDeleteNumber() ).append('\n');
-        sb.append("File Upload Bytes        : ").append( stat.getTotalUploadSize() ).append('\n');
-        sb.append("File Download Bytes      : ").append( stat.getTotalDownloadSize() ).append('\n');
-        sb.append("Directory Create Number  : ").append( stat.getTotalDirectoryCreated() ).append('\n');
-        sb.append("Directory Remove Number  : ").append( stat.getTotalDirectoryRemoved() ).append('\n');
-        sb.append("Current Logins           : ").append( stat.getCurrentLoginNumber() ).append('\n');
-        sb.append("Total Logins             : ").append( stat.getTotalLoginNumber() ).append('\n');
-        sb.append("Current Anonymous Logins : ").append( stat.getCurrentAnonymousLoginNumber() ).append('\n');
-        sb.append("Total Anonymous Logins   : ").append( stat.getTotalAnonymousLoginNumber() ).append('\n');
-        sb.append("Current Connections      : ").append( stat.getCurrentConnectionNumber() ).append('\n');
-        sb.append("Total Connections        : ").append( stat.getTotalConnectionNumber() ).append('\n');
+        sb.append("Start Time               : ").append(
+                DateUtils.getISO8601Date(stat.getStartTime().getTime()))
+                .append('\n');
+        sb.append("File Upload Number       : ").append(
+                stat.getTotalUploadNumber()).append('\n');
+        sb.append("File Download Number     : ").append(
+                stat.getTotalDownloadNumber()).append('\n');
+        sb.append("File Delete Number       : ").append(
+                stat.getTotalDeleteNumber()).append('\n');
+        sb.append("File Upload Bytes        : ").append(
+                stat.getTotalUploadSize()).append('\n');
+        sb.append("File Download Bytes      : ").append(
+                stat.getTotalDownloadSize()).append('\n');
+        sb.append("Directory Create Number  : ").append(
+                stat.getTotalDirectoryCreated()).append('\n');
+        sb.append("Directory Remove Number  : ").append(
+                stat.getTotalDirectoryRemoved()).append('\n');
+        sb.append("Current Logins           : ").append(
+                stat.getCurrentLoginNumber()).append('\n');
+        sb.append("Total Logins             : ").append(
+                stat.getTotalLoginNumber()).append('\n');
+        sb.append("Current Anonymous Logins : ").append(
+                stat.getCurrentAnonymousLoginNumber()).append('\n');
+        sb.append("Total Anonymous Logins   : ").append(
+                stat.getTotalAnonymousLoginNumber()).append('\n');
+        sb.append("Current Connections      : ").append(
+                stat.getCurrentConnectionNumber()).append('\n');
+        sb.append("Total Connections        : ").append(
+                stat.getTotalConnectionNumber()).append('\n');
         sb.append('\n');
-        session.write(new DefaultFtpReply(FtpReply.REPLY_200_COMMAND_OKAY, sb.toString()));
+        session.write(new DefaultFtpReply(FtpReply.REPLY_200_COMMAND_OKAY, sb
+                .toString()));
     }
-    
+
 }