james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1049530 [2/2] - in /james/server/trunk: container-spring/src/main/config/examples/ container-spring/src/main/config/james/ container-spring/src/main/config/james/context/ core-api/src/main/java/org/apache/james/services/ core-function/src/...
Date Wed, 15 Dec 2010 12:54:22 GMT
Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
(original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
Wed Dec 15 12:54:20 2010
@@ -29,7 +29,6 @@ import org.apache.james.domainlist.api.D
 import org.apache.james.lifecycle.Configurable;
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.james.protocols.smtp.core.fastfail.AbstractValidRcptHandler;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.vut.api.VirtualUserTable;
 import org.apache.james.vut.api.VirtualUserTable.ErrorMappingException;
@@ -47,8 +46,6 @@ public class ValidRcptHandler extends Ab
 
     private boolean useVut = true;
 
-    private MailServer mailServer;
-
     private DomainList domains;
 
 	/**
@@ -87,11 +84,6 @@ public class ValidRcptHandler extends Ab
     public void setDomainList(DomainList domains) {
         this.domains = domains;
     }
-    
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
 
 	/**
 	 * @see org.apache.james.lifecycle.Configurable#configure(org.apache.commons.configuration.Configuration)
@@ -119,7 +111,7 @@ public class ValidRcptHandler extends Ab
 	    String username = recipient.toString();
 	    
 	    // check if the server use virtualhosting, if not use only the localpart as username
-	    if (mailServer.supportVirtualHosting() == false) {
+	    if (users.supportVirtualHosting() == false) {
 	        username = recipient.getLocalPart();
 	    }
 	    

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
(original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
Wed Dec 15 12:54:20 2010
@@ -27,7 +27,6 @@ import org.apache.commons.configuration.
 import org.apache.james.protocols.api.ProtocolHandlerChain;
 import org.apache.james.protocols.impl.AbstractSSLAwareChannelPipelineFactory;
 import org.apache.james.protocols.smtp.SMTPConfiguration;
-import org.apache.james.services.MailServer;
 import org.apache.james.socket.netty.AbstractConfigurableAsyncServer;
 import org.apache.james.socket.netty.ConnectionCountHandler;
 import org.apache.james.util.netmatcher.NetMatcher;
@@ -97,18 +96,10 @@ public class SMTPServer extends Abstract
 
     private boolean addressBracketsEnforcement = true;
 
-    private MailServer mailServer;
-
     private boolean verifyIdentity;
     
     private final ConnectionCountHandler countHandler = new ConnectionCountHandler();
-    
-
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
-    
+   
 
     public void setProtocolHandlerChain(ProtocolHandlerChain handlerChain) {
         this.handlerChain = handlerChain;
@@ -217,11 +208,7 @@ public class SMTPServer extends Abstract
          * @see org.apache.james.protocols.smtp.SMTPConfiguration#getHelloName()
          */
         public String getHelloName() {
-            if (SMTPServer.this.getHelloName() == null) {
-                return SMTPServer.this.mailServer.getHelloName();
-            } else {
-                return SMTPServer.this.getHelloName();
-            }
+            return SMTPServer.this.getHelloName();
         }
 
         /**

Modified: james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/AbstractSMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/AbstractSMTPServerTest.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/AbstractSMTPServerTest.java
(original)
+++ james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/AbstractSMTPServerTest.java
Wed Dec 15 12:54:20 2010
@@ -50,7 +50,6 @@ import org.apache.james.domainlist.api.S
 import org.apache.james.lifecycle.LifecycleUtil;
 import org.apache.james.mailstore.MockMailStore;
 import org.apache.james.services.MockFileSystem;
-import org.apache.james.services.MockMailServer;
 import org.apache.james.socket.JamesProtocolHandlerChain;
 import org.apache.james.user.lib.MockUsersRepository;
 import org.apache.james.util.TestUtil;
@@ -141,7 +140,6 @@ public abstract class AbstractSMTPServer
     }
 
     protected final int m_smtpListenerPort;
-    protected MockMailServer m_mailServer;
     //private SMTPServer m_smtpServer;
     protected SMTPTestConfiguration m_testConfiguration;
     protected MockUsersRepository m_usersRepository = new MockUsersRepository();
@@ -187,7 +185,6 @@ public abstract class AbstractSMTPServer
 
 
     protected void tearDown() throws Exception {
-        LifecycleUtil.dispose(m_mailServer);
         queue.clear();
         super.tearDown();
         
@@ -216,8 +213,6 @@ public abstract class AbstractSMTPServer
 
     protected void setUpFakeLoader() throws Exception {
         m_serviceManager = new MockJSR250Loader();
-        m_mailServer = new MockMailServer();
-        m_serviceManager.put("mailserver", m_mailServer);
         m_serviceManager.put("localusersrepository", m_usersRepository);
 
         m_dnsServer = new AlterableDNSServer();

Modified: james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
(original)
+++ james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
Wed Dec 15 12:54:20 2010
@@ -46,7 +46,6 @@ public class SMTPServerTest extends Abst
         m_smtpServer.setProtocolHandlerChain(chain);
         
         m_smtpServer.setLog(log);
-        m_smtpServer.setMailServer(m_mailServer);        
     }
 
     @Override

Modified: james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
(original)
+++ james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
Wed Dec 15 12:54:20 2010
@@ -30,12 +30,11 @@ import java.util.Map;
 
 import junit.framework.TestCase;
 
-import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.api.SimpleDomainList;
 import org.apache.james.protocols.smtp.BaseFakeSMTPSession;
 import org.apache.james.protocols.smtp.SMTPConfiguration;
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.james.protocols.smtp.hook.HookReturnCode;
-import org.apache.james.services.MailServer;
 import org.apache.james.smtpserver.fastfail.ValidRcptHandler;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.lib.MockUsersRepository;
@@ -60,55 +59,13 @@ public class ValidRcptHandlerTest extend
         handler = new ValidRcptHandler();
         handler.setUsers(users);
         handler.setVirtualUserTable(setUpVirtualUserTable());
-        handler.setMailServer(new MailServer() {
+       
+        handler.setDomainList(new SimpleDomainList() {
 
-            public String getDefaultDomain() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            public String getHelloName() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            public String getId() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            public boolean supportVirtualHosting() {
-                // TODO Auto-generated method stub
-                return false;
-            }
-
-            public MailAddress getPostmaster() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-            
-        });
-        handler.setDomainList(new DomainList() {
-
-            public boolean addDomain(String domain) {
-                // TODO Auto-generated method stub
-                return false;
-            }
 
             public boolean containsDomain(String domain) {
                 return domain.equals(VALID_DOMAIN);
             }
-
-            public String[] getDomains() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            public boolean removeDomain(String domain) {
-                // TODO Auto-generated method stub
-                return false;
-            }
-            
         });
     }
 

Modified: james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java
(original)
+++ james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java
Wed Dec 15 12:54:20 2010
@@ -149,4 +149,13 @@ public interface UserManagementMBean {
      * @return List<String> of repository names
      */
     List<String> getUserRepositoryNames();
+    
+    /**
+     * Return true if the UserRepository has VirtualHosting enabled
+     * 
+     * @param repositoryName The user repository, to which the operation should be applied.
If NULL, the LocalUsers
+     *        repository is used.
+     * @return virtual
+     */
+    public boolean getVirtualHostingEnabled(String repositoryName);
 }

Modified: james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UsersRepository.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UsersRepository.java
(original)
+++ james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UsersRepository.java
Wed Dec 15 12:54:20 2010
@@ -171,5 +171,14 @@ public interface UsersRepository {
      * @return Iterator over a collection of Strings, each being one user in the repository.
      */
     Iterator<String> list();
+    
+    
+    
+    /**
+     * Return true if virtualHosting support is enabled, otherwise false
+     * 
+     * @return true or false
+     */
+    boolean supportVirtualHosting();
 
 }

Modified: james/server/trunk/user-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
(original)
+++ james/server/trunk/user-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
Wed Dec 15 12:54:20 2010
@@ -60,6 +60,8 @@ public class JCRUsersRepository implemen
 	private String workspace;
 
 	private Log logger;
+
+    private boolean virtualHosting;
 	
     @Resource(name="jcrRepository")
     public void setRepository(Repository repository) {
@@ -79,6 +81,8 @@ public class JCRUsersRepository implemen
 		if (username != null && password != null) {
 			this.creds = new SimpleCredentials(username, password.toCharArray());
 		}
+        virtualHosting = config.getBoolean("enableVirtualHosting", false);
+
 	}
 
 
@@ -479,4 +483,12 @@ public class JCRUsersRepository implemen
         return userNames.iterator();
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UsersRepository#supportVirtualHosting()
+     */
+    public boolean supportVirtualHosting() {
+        return virtualHosting;
+    }
+
 }

Modified: james/server/trunk/user-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
(original)
+++ james/server/trunk/user-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
Wed Dec 15 12:54:20 2010
@@ -52,6 +52,8 @@ public class JPAUsersRepository implemen
 
     private Log logger;
 
+    private boolean virtualHosting;
+
 
     /**
      * Sets entity manager.
@@ -349,6 +351,8 @@ public class JPAUsersRepository implemen
      */
     public void configure(HierarchicalConfiguration config) throws ConfigurationException
{
         algo = config.getString("algorithm","MD5");
+        virtualHosting = config.getBoolean("enableVirtualHosting", false);
+
     }
 
     /*
@@ -368,4 +372,12 @@ public class JPAUsersRepository implemen
         return entityManagerFactory.createEntityManager();
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UsersRepository#supportVirtualHosting()
+     */
+    public boolean supportVirtualHosting() {
+        return virtualHosting;
+    }
+
 }

Modified: james/server/trunk/user-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepository.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepository.java
(original)
+++ james/server/trunk/user-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepository.java
Wed Dec 15 12:54:20 2010
@@ -607,4 +607,11 @@ public class ReadOnlyUsersLDAPRepository
         this.log = log;
     }
 
+    /**
+     * VirtualHosting not supported
+     */
+    public boolean supportVirtualHosting() {
+        return false;
+    }
+
 }

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/AbstractJamesUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/AbstractJamesUsersRepository.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/AbstractJamesUsersRepository.java
(original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/AbstractJamesUsersRepository.java
Wed Dec 15 12:54:20 2010
@@ -69,6 +69,8 @@ public abstract class AbstractJamesUsers
 
     private Log logger;
 
+    private boolean virtualHosting;
+
     public void setLog(Log logger) {
         this.logger = logger;
     }
@@ -77,7 +79,8 @@ public abstract class AbstractJamesUsers
         setIgnoreCase(configuration.getBoolean("ignoreCase", false));
         setEnableAliases(configuration.getBoolean("enableAliases", false));
         setEnableForwarding(configuration.getBoolean("enableForwarding", false));
-        
+        virtualHosting = configuration.getBoolean("enableVirtualHosting", false);
+
         doConfigure(configuration);
     }
     
@@ -85,6 +88,9 @@ public abstract class AbstractJamesUsers
         
     }
 
+    public void setEnableVirtualHosting(boolean virtualHosting) {
+        this.virtualHosting = virtualHosting;
+    }
     /**
      * Adds a user to the underlying Repository. The user name must not clash
      * with an existing user.
@@ -274,4 +280,13 @@ public abstract class AbstractJamesUsers
         return new ArrayList<String>();
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UsersRepository#supportVirtualHosting()
+     */
+    public boolean supportVirtualHosting() {
+        return virtualHosting;
+    }
+
+    
 }

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/LocalUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/LocalUsersRepository.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/LocalUsersRepository.java
(original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/LocalUsersRepository.java
Wed Dec 15 12:54:20 2010
@@ -141,4 +141,13 @@ public class LocalUsersRepository implem
         return users.list();
     }
 
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UsersRepository#supportVirtualHosting()
+     */
+    public boolean supportVirtualHosting() {
+        return users.supportVirtualHosting();
+    }
+
 }

Modified: james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java
(original)
+++ james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java
Wed Dec 15 12:54:20 2010
@@ -192,4 +192,12 @@ public class UserManagement extends Stan
         return result;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.user.api.UserManagementMBean#getVirtualHostingEnabled(java.lang.String)
+     */
+    public boolean getVirtualHostingEnabled(String repositoryName) {
+        return getUserRepository(repositoryName).supportVirtualHosting();
+    }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message