incubator-ftpserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r508621 - in /incubator/ftpserver/trunk: core/src/java/org/apache/ftpserver/ core/src/java/org/apache/ftpserver/command/ core/src/java/org/apache/ftpserver/interfaces/ core/src/java/org/apache/ftpserver/listener/ core/src/test/org/apache/ft...
Date Fri, 16 Feb 2007 22:19:11 GMT
Author: ngn
Date: Fri Feb 16 14:19:10 2007
New Revision: 508621

URL: http://svn.apache.org/viewvc?view=rev&rev=508621
Log:
Data connection config now moved to the listener

Removed:
    incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/AbstractFtpServerTestTemplate.java
    incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/FtpServerStartupTest.java
    incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/command/AbstractCommandTestTemplate.java
    incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/command/PASSTest.java
Modified:
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/ConfigurableFtpServerContext.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultDataConnectionConfig.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/interfaces/FtpServerContext.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/AbstractListener.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/Listener.java
    incubator/ftpserver/trunk/ssl-tests/src/test/org/apache/ftpserver/ssl/SSLTestTemplate.java

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/ConfigurableFtpServerContext.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/ConfigurableFtpServerContext.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/ConfigurableFtpServerContext.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/ConfigurableFtpServerContext.java
Fri Feb 16 14:19:10 2007
@@ -38,18 +38,15 @@
 import org.apache.ftpserver.ftplet.FtpletContainer;
 import org.apache.ftpserver.ftplet.UserManager;
 import org.apache.ftpserver.interfaces.CommandFactory;
-import org.apache.ftpserver.interfaces.DataConnectionConfig;
 import org.apache.ftpserver.interfaces.FtpServerContext;
 import org.apache.ftpserver.interfaces.IpRestrictor;
 import org.apache.ftpserver.interfaces.MessageResource;
-import org.apache.ftpserver.interfaces.SocketFactory;
 import org.apache.ftpserver.iprestrictor.FileIpRestrictor;
 import org.apache.ftpserver.listener.ConnectionManager;
 import org.apache.ftpserver.listener.ConnectionManagerImpl;
 import org.apache.ftpserver.listener.Listener;
 import org.apache.ftpserver.listener.mina.MinaListener;
 import org.apache.ftpserver.message.MessageResourceImpl;
-import org.apache.ftpserver.socketfactory.FtpSocketFactory;
 import org.apache.ftpserver.usermanager.BaseUser;
 import org.apache.ftpserver.usermanager.ConcurrentLoginPermission;
 import org.apache.ftpserver.usermanager.PropertiesUserManager;
@@ -63,8 +60,6 @@
 public class ConfigurableFtpServerContext implements FtpServerContext {
 
     private LogFactory logFactory;
-    private Bean socketFactoryBean;
-    private Bean dataConConfigBean;
     private Bean messageResourceBean;
     private Bean connectionManagerBean;
     private Bean ipRestrictorBean;
@@ -101,8 +96,6 @@
             listeners = createListeners(conf, "listeners");
             
             // create all the components
-            socketFactoryBean     = createComponent(conf, "socket-factory",      FtpSocketFactory.class.getName());
-            dataConConfigBean     = createComponent(conf, "data-connection",     DefaultDataConnectionConfig.class.getName());

             messageResourceBean   = createComponent(conf, "message",             MessageResourceImpl.class.getName());
             connectionManagerBean = createComponent(conf, "connection-manager",  ConnectionManagerImpl.class.getName());
             ipRestrictorBean      = createComponent(conf, "ip-restrictor",       FileIpRestrictor.class.getName());
@@ -256,13 +249,6 @@
     }
     
     /**
-     * Get socket factory.
-     */
-    public SocketFactory getSocketFactory() {
-        return (SocketFactory) socketFactoryBean.getBean();
-    }
-    
-    /**
      * Get user manager.
      */
     public UserManager getUserManager() {
@@ -310,13 +296,6 @@
     public Ftplet getFtpletContainer() {
         return (Ftplet) ftpletContainerBean.getBean();
     }
-
-    /**
-     * Get data connection config.
-     */
-    public DataConnectionConfig getDataConnectionConfig() {
-        return (DataConnectionConfig) dataConConfigBean.getBean();
-    }
     
     /**
      * Get the command factory.
@@ -345,10 +324,6 @@
         
         if(connectionManagerBean != null && connectionManagerBean.getBean() != null)
{
             connectionManagerBean.destroyBean();
-        }
-        
-        if(dataConConfigBean != null && dataConConfigBean.getBean() != null) {
-            dataConConfigBean.destroyBean();
         }
         
         if(ftpletContainerBean != null && ftpletContainerBean.getBean() != null)
{

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultDataConnectionConfig.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultDataConnectionConfig.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultDataConnectionConfig.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultDataConnectionConfig.java
Fri Feb 16 14:19:10 2007
@@ -210,10 +210,4 @@
     public Ssl getSSL() {
         return ssl;
     }
-    
-    /**
-     * Dispose it.
-     */
-    public void dispose() {
-    }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/FtpDataConnectionFactory.java
Fri Feb 16 14:19:10 2007
@@ -96,7 +96,7 @@
             FtpServerContext ctx = serverContext;
             
             if(ctx != null) {
-                DataConnectionConfig dcc = ctx.getDataConnectionConfig();
+                DataConnectionConfig dcc = session.getListener().getDataConnectionConfig();
                 if(dcc != null) {
                     dcc.releasePassivePort(port);
                 }
@@ -134,7 +134,7 @@
         closeDataSocket(); 
         
         // get the passive port
-        int passivePort = serverContext.getDataConnectionConfig().getPassivePort();
+        int passivePort = session.getListener().getDataConnectionConfig().getPassivePort();
         if(passivePort == -1) {
             log.warn("Cannot find an available passive port.");
             servSoc = null;
@@ -144,7 +144,7 @@
         // open passive server socket and get parameters
         boolean bRet = false;
         try {
-            DataConnectionConfig dataCfg = serverContext.getDataConnectionConfig();
+            DataConnectionConfig dataCfg = session.getListener().getDataConnectionConfig();
             address = dataCfg.getPassiveAddress();
             if(address == null) {
                 address = serverControlAddress;
@@ -206,7 +206,7 @@
 
         // get socket depending on the selection
         dataSoc = null;
-        DataConnectionConfig dataConfig = serverContext.getDataConnectionConfig();
+        DataConnectionConfig dataConfig = session.getListener().getDataConnectionConfig();
         try {
             if(isPort) {
                 int localPort = dataConfig.getActiveLocalPort();
@@ -297,7 +297,7 @@
         }
         
         // no idle time limit - not a timeout
-        int maxIdleTime = serverContext.getDataConnectionConfig().getMaxIdleTimeMillis();
+        int maxIdleTime = session.getListener().getDataConnectionConfig().getMaxIdleTimeMillis();
         if(maxIdleTime == 0) {
             return false;
         }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/EPRT.java Fri Feb
16 14:19:10 2007
@@ -61,7 +61,7 @@
         }
         
         // is port enabled
-        DataConnectionConfig dataCfg = connection.getServerContext().getDataConnectionConfig();
+        DataConnectionConfig dataCfg = session.getListener().getDataConnectionConfig();
         if(!dataCfg.isActiveEnabled()) {
             out.write(FtpReplyUtil.translate(session, 510, "EPRT.disabled", null));
             return;

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PORT.java Fri Feb
16 14:19:10 2007
@@ -77,7 +77,7 @@
         }
         
         // is port enabled
-        DataConnectionConfig dataCfg = connection.getServerContext().getDataConnectionConfig();
+        DataConnectionConfig dataCfg = session.getListener().getDataConnectionConfig();
         if(!dataCfg.isActiveEnabled()) {
             out.write(FtpReplyUtil.translate(session, 510, "PORT.disabled", null));
             return;

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PROT.java Fri Feb
16 14:19:10 2007
@@ -27,7 +27,6 @@
 import org.apache.ftpserver.ftplet.FtpReply;
 import org.apache.ftpserver.ftplet.FtpReplyOutput;
 import org.apache.ftpserver.ftplet.FtpRequest;
-import org.apache.ftpserver.interfaces.FtpServerContext;
 import org.apache.ftpserver.listener.Connection;
 import org.apache.ftpserver.util.FtpReplyUtil;
 
@@ -63,8 +62,7 @@
             out.write(FtpReplyUtil.translate(session, FtpReply.REPLY_200_COMMAND_OKAY, "PROT",
null));
         }
         else if(arg.equals("P")) {
-            FtpServerContext serverContext = connection.getServerContext();
-            if(serverContext.getDataConnectionConfig().getSSL() == null) {
+            if(session.getListener().getDataConnectionConfig().getSSL() == null) {
                 out.write(FtpReplyUtil.translate(session, 431, "PROT", null));
             }
             else {

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/interfaces/FtpServerContext.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/interfaces/FtpServerContext.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/interfaces/FtpServerContext.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/interfaces/FtpServerContext.java
Fri Feb 16 14:19:10 2007
@@ -56,16 +56,6 @@
     Listener[] getListeners();
     
     /**
-     * Get server socket factory.
-     */
-    SocketFactory getSocketFactory();
-        
-    /**
-     * Get data connection config.
-     */
-    DataConnectionConfig getDataConnectionConfig();
-    
-    /**
      * Get the command factory.
      */
     CommandFactory getCommandFactory();

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/AbstractListener.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/AbstractListener.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/AbstractListener.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/AbstractListener.java
Fri Feb 16 14:19:10 2007
@@ -21,6 +21,8 @@
 
 import java.net.InetAddress;
 
+import org.apache.ftpserver.DefaultDataConnectionConfig;
+import org.apache.ftpserver.interfaces.DataConnectionConfig;
 import org.apache.ftpserver.interfaces.Ssl;
 
 
@@ -33,6 +35,7 @@
     private int port = 21;
     private Ssl ssl;
     private boolean implicitSsl = false;
+    private DataConnectionConfig dataConnectionConfig = new DefaultDataConnectionConfig();
     
     public boolean isImplicitSsl() {
         return implicitSsl;
@@ -57,5 +60,14 @@
     }
     public void setSsl(Ssl ssl) {
         this.ssl = ssl;
+    }
+    public DataConnectionConfig getDataConnectionConfig() {
+        return dataConnectionConfig;
+    }
+    public void setDataConnectionConfig(DataConnectionConfig dataConnectionConfig) {
+        this.dataConnectionConfig = dataConnectionConfig;
+    }
+    public void setDataConnection(DataConnectionConfig dataConnectionConfig) {
+        setDataConnectionConfig(dataConnectionConfig);
     }
 }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/Listener.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/Listener.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/Listener.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/listener/Listener.java Fri
Feb 16 14:19:10 2007
@@ -19,6 +19,7 @@
 
 package org.apache.ftpserver.listener;
 
+import org.apache.ftpserver.interfaces.DataConnectionConfig;
 import org.apache.ftpserver.interfaces.FtpServerContext;
 import org.apache.ftpserver.interfaces.Ssl;
 
@@ -31,6 +32,8 @@
 public interface Listener {
     
     Ssl getSsl();
+    
+    DataConnectionConfig getDataConnectionConfig();
     
     /**
      * Start the listener, will initiate the listener waiting

Modified: incubator/ftpserver/trunk/ssl-tests/src/test/org/apache/ftpserver/ssl/SSLTestTemplate.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/ssl-tests/src/test/org/apache/ftpserver/ssl/SSLTestTemplate.java?view=diff&rev=508621&r1=508620&r2=508621
==============================================================================
--- incubator/ftpserver/trunk/ssl-tests/src/test/org/apache/ftpserver/ssl/SSLTestTemplate.java
(original)
+++ incubator/ftpserver/trunk/ssl-tests/src/test/org/apache/ftpserver/ssl/SSLTestTemplate.java
Fri Feb 16 14:19:10 2007
@@ -35,6 +35,7 @@
 import org.apache.commons.net.ftp.FTPConnectionClosedException;
 import org.apache.commons.net.ftp.FTPSClient;
 import org.apache.ftpserver.ConfigurableFtpServerContext;
+import org.apache.ftpserver.DefaultDataConnectionConfig;
 import org.apache.ftpserver.FtpServer;
 import org.apache.ftpserver.config.PropertiesConfiguration;
 import org.apache.ftpserver.interfaces.FtpServerContext;
@@ -99,8 +100,22 @@
         configProps.setProperty("config.listeners.default.ssl.key-password",
                 "password");
 
-        //configProps.setProperty("config.socket-factory.port", Integer
-        //        .toString(port));
+        configProps.setProperty("config.listeners.default.data-connection.class",
+                DefaultDataConnectionConfig.class.getName());
+        configProps.setProperty("config.listeners.default.data-connection.ssl.class",
+                DefaultSsl.class.getName());
+        configProps.setProperty("config.listeners.default.data-connection.ssl.keystore-file",
+                FTPSERVER_KEYSTORE.getAbsolutePath());
+        configProps.setProperty("config.listeners.default.data-connection.ssl.keystore-password",
+        "password");
+        configProps.setProperty("config.listeners.default.data-connection.ssl.ssl-protocol",
+                getAuthValue());
+        configProps.setProperty(
+                "config.listeners.default.data-connection.ssl.client-authentication", getClientAuth());
+        configProps.setProperty("config.listeners.default.data-connection.ssl.key-password",
+        "password");
+        
+        
         configProps.setProperty("config.user-manager.class",
                 "org.apache.ftpserver.usermanager.PropertiesUserManager");
         configProps.setProperty("config.user-manager.admin", "admin");
@@ -110,31 +125,6 @@
                 USERS_FILE.getAbsolutePath());
         configProps.setProperty("config.create-default-user", "false");
 
-        //configProps.setProperty("config.socket-factory.class",
-        //        "org.apache.ftpserver.socketfactory.FtpSocketFactory");
-//        configProps.setProperty("config.socket-factory.ssl.keystore-file",
-//                FTPSERVER_KEYSTORE.getAbsolutePath());
-//        configProps.setProperty("config.socket-factory.ssl.keystore-password",
-//                "password");
-//        configProps
-//                .setProperty("config.socket-factory.ssl.ssl-protocol", getAuthValue());
-//        configProps.setProperty(
-//                "config.socket-factory.ssl.client-authentication", getClientAuth());
-//        configProps.setProperty("config.socket-factory.ssl.key-password",
-//                "password");
-//
-        configProps.setProperty("config.data-connection.ssl.class",
-                DefaultSsl.class.getName());
-        configProps.setProperty("config.data-connection.ssl.keystore-file",
-                FTPSERVER_KEYSTORE.getAbsolutePath());
-        configProps.setProperty("config.data-connection.ssl.keystore-password",
-                "password");
-        configProps.setProperty("config.data-connection.ssl.ssl-protocol",
-                getAuthValue());
-        configProps.setProperty(
-                "config.data-connection.ssl.client-authentication", getClientAuth());
-        configProps.setProperty("config.data-connection.ssl.key-password",
-                "password");
 
         return configProps;
     }



Mime
View raw message