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 [1/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
Author: norman
Date: Wed Dec 15 12:54:20 2010
New Revision: 1049530

URL: http://svn.apache.org/viewvc?rev=1049530&view=rev
Log:
Remove MailServer interface and implementation. See JAMES-1147

Removed:
    james/server/trunk/container-spring/src/main/config/examples/mailserver.xml
    james/server/trunk/container-spring/src/main/config/james/mailserver.xml
    james/server/trunk/core-api/src/main/java/org/apache/james/services/MailServer.java
    james/server/trunk/core-function/src/main/java/org/apache/james/JamesMailServer.java
    james/server/trunk/core-library/src/test/java/org/apache/james/services/MailServerTestAllImplementations.java
    james/server/trunk/core-library/src/test/java/org/apache/james/services/MockMailServer.java
Modified:
    james/server/trunk/container-spring/src/main/config/examples/domainlist.xml
    james/server/trunk/container-spring/src/main/config/examples/mailetcontainer.xml
    james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml
    james/server/trunk/container-spring/src/main/config/james/context/james-mailbox-maildir-context.xml
    james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
    james/server/trunk/container-spring/src/main/config/james/domainlist.xml
    james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml
    james/server/trunk/container-spring/src/main/config/james/usersrepository.xml
    james/server/trunk/core-library/src/main/java/org/apache/james/core/MailImpl.java
    james/server/trunk/domainlist-api/src/main/java/org/apache/james/domainlist/api/DomainList.java
    james/server/trunk/domainlist-api/src/test/java/org/apache/james/domainlist/api/SimpleDomainList.java
    james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java
    james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/DomainListManagement.java
    james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/JamesDomainList.java
    james/server/trunk/domainlist-xml/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
    james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
    james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java
    james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
    james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ParsedConfiguration.java
    james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ProcessorAbstract.java
    james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/DataLineLMTPMessageHookHandler.java
    james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
    james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java
    james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailetContext.java
    james/server/trunk/mailets/pom.xml
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
    james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java
    james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
    james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/AbstractAsyncPOP3ServerTest.java
    james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java
    james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/netty/RemoteManager.java
    james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java
    james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesDataCmdHandler.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
    james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/AbstractSMTPServerTest.java
    james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
    james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
    james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UserManagementMBean.java
    james/server/trunk/user-api/src/main/java/org/apache/james/user/api/UsersRepository.java
    james/server/trunk/user-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
    james/server/trunk/user-jpa/src/main/java/org/apache/james/user/jpa/JPAUsersRepository.java
    james/server/trunk/user-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepository.java
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/AbstractJamesUsersRepository.java
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/LocalUsersRepository.java
    james/server/trunk/user-library/src/main/java/org/apache/james/user/lib/UserManagement.java

Modified: james/server/trunk/container-spring/src/main/config/examples/domainlist.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/examples/domainlist.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/examples/domainlist.xml (original)
+++ james/server/trunk/container-spring/src/main/config/examples/domainlist.xml Wed Dec 15 12:54:20 2010
@@ -45,6 +45,7 @@
     </domainnames>
     <autodetect>true</autodetect>
     <autodetectIP>true</autodetectIP>
+    <defaultDomain>localhost</defaultDomain>
   </domainlist>
   
   <!-- JPA implementation for DomainList -->
@@ -52,6 +53,7 @@
   <domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
     <autodetect>true</autodetect>
     <autodetectIP>true</autodetectIP>
+    <defaultDomain>localhost</defaultDomain>
   </domainlist>
   -->
   
@@ -63,6 +65,7 @@
     <sqlFile>file://conf/sqlResources.xml</sqlFile>
     <autodetect>true</autodetect>
     <autodetectIP>true</autodetectIP>
+    <defaultDomain>localhost</defaultDomain>
   </domainlist>  
   -->
 </domainlists>

Modified: james/server/trunk/container-spring/src/main/config/examples/mailetcontainer.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/examples/mailetcontainer.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/examples/mailetcontainer.xml (original)
+++ james/server/trunk/container-spring/src/main/config/examples/mailetcontainer.xml Wed Dec 15 12:54:20 2010
@@ -19,6 +19,9 @@
  --> 
 <!-- This block is responsible for processing messages on the spool. -->
  <mailetcontainer>
+      <!-- MailAddress used for PostMaster -->
+      <postmaster>Postmaster@localhost</postmaster>
+
       <!-- Number of spool threads -->
       <threads> 20 </threads>
 

Modified: james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml (original)
+++ james/server/trunk/container-spring/src/main/config/examples/usersrepository.xml Wed Dec 15 12:54:20 2010
@@ -42,6 +42,7 @@
      -->
     <repository name="LocalUsers" class="org.apache.james.user.jpa.JPAUsersRepository">
         <algorithm>MD5</algorithm>
+        <enableVirtualHosting>false</enableVirtualHosting>     
     </repository>
 
 
@@ -57,6 +58,7 @@
         <ignoreCase>true</ignoreCase>
         <enableAliases>true</enableAliases>
         <enableForwarding>true</enableForwarding>
+        <enableVirtualHosting>false</enableVirtualHosting>     
     </repository>
     -->
 
@@ -74,6 +76,7 @@
         <ignoreCase>true</ignoreCase>
         <enableAliases>true</enableAliases>
         <enableForwarding>true</enableForwarding>
+        <enableVirtualHosting>false</enableVirtualHosting>     
     </repository>
     -->
         

Modified: james/server/trunk/container-spring/src/main/config/james/context/james-mailbox-maildir-context.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/context/james-mailbox-maildir-context.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/context/james-mailbox-maildir-context.xml (original)
+++ james/server/trunk/container-spring/src/main/config/james/context/james-mailbox-maildir-context.xml Wed Dec 15 12:54:20 2010
@@ -41,7 +41,7 @@
     </bean>
     <bean id="maildirStore" name="maildir-uidProvider" class="org.apache.james.adapter.mailbox.maildir.MaildirStoreUtil" factory-method="create">
         <constructor-arg index="0" ref="filesystem"/>
-        <constructor-arg index="1" ref="mailserver"/>
+        <constructor-arg index="1" ref="localusersrepository"/>
         <constructor-arg index="2" value="file://var/store/maildir/"/>
     </bean>
 

Modified: james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml (original)
+++ james/server/trunk/container-spring/src/main/config/james/context/james-server-context.xml Wed Dec 15 12:54:20 2010
@@ -60,6 +60,7 @@
                 <entry key="spoolmanager" value="mailetcontainer"/>
                 <entry key="mailetloader" value="mailetcontainer"/>
                 <entry key="matcherloader" value="mailetcontainer"/>
+                <entry key="mailetcontext" value="mailetcontainer"/>
                 <entry key="usersstore" value="usersrepository"/>
              </map>
         </property>
@@ -147,9 +148,8 @@
     </camel:camelContext>
 
     <!-- 
-      Mail Server / Queue / Spool / Mailet / Matcher
+      Queue / Spool / Mailet / Matcher
      -->
-    <bean id="mailserver" class="org.apache.james.JamesMailServer"/>
     <bean id="mailQueueFactory" class="org.apache.james.queue.activemq.ActiveMQMailQueueFactory" depends-on="broker"/>
     <bean id="mailProcessor" name="processorRoute" class="org.apache.james.mailetcontainer.camel.CamelMailProcessorList"/>
     <bean id="spoolmanager" class="org.apache.james.transport.JamesSpoolManager"/>

Modified: james/server/trunk/container-spring/src/main/config/james/domainlist.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/domainlist.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/domainlist.xml (original)
+++ james/server/trunk/container-spring/src/main/config/james/domainlist.xml Wed Dec 15 12:54:20 2010
@@ -27,5 +27,6 @@
     </domainnames>
     <autodetect>true</autodetect>
     <autodetectIP>true</autodetectIP>
+    <defaultDomain>localhost</defaultDomain>
   </domainlist>
 </domainlists>

Modified: james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml (original)
+++ james/server/trunk/container-spring/src/main/config/james/mailetcontainer.xml Wed Dec 15 12:54:20 2010
@@ -21,7 +21,8 @@
 <!-- See http://james.apache.org/server/3/config.html for usage -->
 
 <mailetcontainer>
-
+    <postmaster>Postmaster@localhost</postmaster>
+    
     <threads> 20 </threads>
 
     <mailetpackages>

Modified: james/server/trunk/container-spring/src/main/config/james/usersrepository.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/config/james/usersrepository.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/config/james/usersrepository.xml (original)
+++ james/server/trunk/container-spring/src/main/config/james/usersrepository.xml Wed Dec 15 12:54:20 2010
@@ -22,6 +22,7 @@
 
 <usersrepository>
   <repository name="LocalUsers" class="org.apache.james.user.jpa.JPAUsersRepository">
-      <algorithm>MD5</algorithm>
+    <enableVirtualHosting>false</enableVirtualHosting>     
+    <algorithm>MD5</algorithm>
   </repository>
 </usersrepository>

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/core/MailImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/core/MailImpl.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/core/MailImpl.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/core/MailImpl.java Wed Dec 15 12:54:20 2010
@@ -44,6 +44,7 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.UUID;
 
 /**
  * <P>Wraps a MimeMessage adding routing information (from SMTP) and some simple
@@ -634,5 +635,20 @@ public class MailImpl implements Disposa
                                  .append(random.nextInt(1048576));
         return nameBuffer.toString();
     }
+    
+    /**
+     * Generate a new identifier/name for a mail being processed by this server.
+     *
+     * @return the new identifier
+     */
+    public static String getId() {
+        StringBuilder idBuffer = new StringBuilder()
+                    .append("Mail")
+                    .append(System.currentTimeMillis())
+                    .append("-")
+                    .append(UUID.randomUUID());
+        return idBuffer.toString();
+    }
+
 
 }

Modified: james/server/trunk/domainlist-api/src/main/java/org/apache/james/domainlist/api/DomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domainlist-api/src/main/java/org/apache/james/domainlist/api/DomainList.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/domainlist-api/src/main/java/org/apache/james/domainlist/api/DomainList.java (original)
+++ james/server/trunk/domainlist-api/src/main/java/org/apache/james/domainlist/api/DomainList.java Wed Dec 15 12:54:20 2010
@@ -59,4 +59,14 @@ public interface DomainList {
      */
     public boolean removeDomain(String domain);
     
+    
+    
+    /**
+     * Return the default domain which will get used to deliver mail to if only the localpart
+     * was given on rcpt to.
+     * 
+     * @return the defaultdomain
+     */
+    public String getDefaultDomain();
+    
 }

Modified: james/server/trunk/domainlist-api/src/test/java/org/apache/james/domainlist/api/SimpleDomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domainlist-api/src/test/java/org/apache/james/domainlist/api/SimpleDomainList.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/domainlist-api/src/test/java/org/apache/james/domainlist/api/SimpleDomainList.java (original)
+++ james/server/trunk/domainlist-api/src/test/java/org/apache/james/domainlist/api/SimpleDomainList.java Wed Dec 15 12:54:20 2010
@@ -46,4 +46,8 @@ public class SimpleDomainList implements
     public boolean removeDomain(String domain) {
         return domains.remove(domain);
     }
+
+    public String getDefaultDomain() {
+        return "localhost";
+    }
 }
\ No newline at end of file

Modified: james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java (original)
+++ james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java Wed Dec 15 12:54:20 2010
@@ -30,19 +30,23 @@ import java.util.Locale;
 
 import javax.annotation.Resource;
 
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.lifecycle.Configurable;
 import org.apache.james.lifecycle.LogEnabled;
 
 /**
  * All implementations of the DomainList interface should extends this abstract class
  */
-public abstract class AbstractDomainList implements  DomainList, LogEnabled {
+public abstract class AbstractDomainList implements  DomainList, LogEnabled, Configurable {
     private DNSService dns;
     private boolean autoDetect = true;
     private boolean autoDetectIP = true;
     private Log logger;
+    private String defaultDomain;
     
     @Resource(name="dnsservice")
     public void setDNSService(DNSService dns) {
@@ -60,6 +64,23 @@ public abstract class AbstractDomainList
 
     
     
+    public void configure(HierarchicalConfiguration config) throws ConfigurationException {
+        defaultDomain = config.getString("defaultDomain","localhost");
+
+        setAutoDetect(config.getBoolean("autodetect", true));    
+        setAutoDetectIP(config.getBoolean("autodetectIP", true));            
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.domainlist.api.DomainList#getDefaultDomain()
+     */
+    public String getDefaultDomain() {
+        return defaultDomain;
+    }
+
+
     /*
      * (non-Javadoc)
      * @see org.apache.james.api.domainlist.DomainList#getDomains()

Modified: james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/DomainListManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/DomainListManagement.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/DomainListManagement.java (original)
+++ james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/DomainListManagement.java Wed Dec 15 12:54:20 2010
@@ -54,4 +54,8 @@ public class DomainListManagement extend
         return domainList.removeDomain(domain);
     }
 
+    public String getDefaultDomain() {
+        return domainList.getDefaultDomain();
+    }
+
 }

Modified: james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/JamesDomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/JamesDomainList.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/JamesDomainList.java (original)
+++ james/server/trunk/domainlist-library/src/main/java/org/apache/james/domainlist/lib/JamesDomainList.java Wed Dec 15 12:54:20 2010
@@ -133,4 +133,12 @@ public class JamesDomainList implements 
         this.config = config;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.domainlist.api.DomainList#getDefaultDomain()
+     */
+    public String getDefaultDomain() {
+        return domainList.getDefaultDomain();
+    }
+
 }

Modified: james/server/trunk/domainlist-xml/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domainlist-xml/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/domainlist-xml/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java (original)
+++ james/server/trunk/domainlist-xml/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java Wed Dec 15 12:54:20 2010
@@ -46,13 +46,12 @@ public class XMLDomainList extends Abstr
      */
     @SuppressWarnings("unchecked")
     public void configure(HierarchicalConfiguration config) throws ConfigurationException {
+        super.configure(config);
         List<String> serverNameConfs = config.getList( "domainnames.domainname" );
         for ( int i = 0; i < serverNameConfs.size(); i++ ) {
             addDomainInternal( serverNameConfs.get(i));
         }
         
-        setAutoDetect(config.getBoolean("autodetect", true));    
-        setAutoDetectIP(config.getBoolean("autodetectIP", true));    
     }
    
    

Modified: james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java (original)
+++ james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java Wed Dec 15 12:54:20 2010
@@ -42,7 +42,6 @@ import org.apache.james.dnsservice.api.D
 import org.apache.james.lifecycle.Configurable;
 import org.apache.james.lifecycle.LogEnabled;
 import org.apache.james.queue.api.MailQueue;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 
 /**
@@ -388,10 +387,6 @@ public class FetchMail implements Runnab
      */
     private Map<DynamicAccountKey, DynamicAccount> fieldDynamicAccounts;        
     
-   /**
-     * The MailServer service
-     */
-    private MailServer fieldServer;
     
    /**
      * The Local Users repository
@@ -435,7 +430,6 @@ public class FetchMail implements Runnab
             new ParsedConfiguration(
                 configuration,
                 logger,
-                getServer(),
                 getLocalUsers(),
                 getDNSService());
         setParsedConfiguration(parsedConfiguration);
@@ -612,14 +606,6 @@ public class FetchMail implements Runnab
         fieldFetching = fetching;
     }
 
-    /**
-     * Returns the server.
-     * @return MailServer
-     */
-    protected MailServer getServer()
-    {
-        return fieldServer;
-    }
 
     /**
      * Returns the configuration.
@@ -664,11 +650,6 @@ public class FetchMail implements Runnab
     public void setDNSService(DNSService dns) {
         this.dnsServer = dns;
     }
-
-
-    public void setMailServer(MailServer mailserver) {
-        this.fieldServer = mailserver;
-    }
    
     public void setUsersRepository(UsersRepository urepos) {
         this.fieldLocalUsers = urepos;

Modified: james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java (original)
+++ james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java Wed Dec 15 12:54:20 2010
@@ -40,7 +40,6 @@ import org.apache.james.lifecycle.Config
 import org.apache.james.lifecycle.LogEnabled;
 import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.api.MailQueueFactory;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 
 /**
@@ -73,8 +72,6 @@ public class FetchScheduler implements F
     private DNSService dns;
 
 
-    private MailServer mailserver;
-
 
     private UsersRepository urepos;
     
@@ -102,11 +99,6 @@ public class FetchScheduler implements F
         this.dns = dns;
     }
 
-
-    @Resource(name="mailserver")
-    public void setMailServer(MailServer mailserver) {
-        this.mailserver = mailserver;
-    }
    
     @Resource(name="localusersrepository")
     public void setUsersRepository(UsersRepository urepos) {
@@ -142,7 +134,6 @@ public class FetchScheduler implements F
                     
                 fetcher.setLog(logger);
                 fetcher.setDNSService(dns);
-                fetcher.setMailServer(mailserver);
                 fetcher.setUsersRepository(urepos);
                 fetcher.setMailQueue(queue);
                 fetcher.configure(fetchConf);

Modified: james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java (original)
+++ james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java Wed Dec 15 12:54:20 2010
@@ -623,7 +623,7 @@ public class MessageProcessor extends Pr
         Collection<MailAddress> recipients = new ArrayList<MailAddress>(1);
         recipients.add(recipient);
         MailImpl mail =
-            new MailImpl(getServer().getId(), getSender(), recipients, message);
+            new MailImpl(MailImpl.getId(), getSender(), recipients, message);
         
 
         try {
@@ -896,7 +896,7 @@ public class MessageProcessor extends Pr
         if (isLocalServer(recipient)) {
             // check if we use virtualhosting or not and use the right part of the recipient in respect of this
             // See JAMES-1135
-            if (getServer().supportVirtualHosting()) {
+            if (getConfiguration().getLocalUsers().supportVirtualHosting()) {
                 return getLocalUsers().contains(recipient.toString());
             } else {
                 return getLocalUsers().contains(recipient.getLocalPart());

Modified: james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ParsedConfiguration.java
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ParsedConfiguration.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ParsedConfiguration.java (original)
+++ james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ParsedConfiguration.java Wed Dec 15 12:54:20 2010
@@ -34,7 +34,6 @@ import org.apache.commons.logging.Log;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.queue.api.MailQueue;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.MailAddress;
 
@@ -202,11 +201,6 @@ class ParsedConfiguration
      */
     private boolean fieldRecurse = false;
     
-
-    /**
-     * The MailServer service
-     */
-    private MailServer fieldServer;    
     
 
     /**
@@ -328,16 +322,14 @@ class ParsedConfiguration
      * Constructor for ParsedConfiguration.
      * @param configuration
      * @param logger
-     * @param server
      * @param localUsers
      * @param dnsServer
      * @throws ConfigurationException
      */
-    public ParsedConfiguration(HierarchicalConfiguration configuration, Log logger, MailServer server, UsersRepository localUsers,DNSService dnsServer) throws ConfigurationException
+    public ParsedConfiguration(HierarchicalConfiguration configuration, Log logger, UsersRepository localUsers,DNSService dnsServer) throws ConfigurationException
     {
         this();
         setLogger(logger);
-        setServer(server);
         setLocalUsers(localUsers);   
         setDNSServer(dnsServer);
         configure(configuration);
@@ -517,15 +509,6 @@ class ParsedConfiguration
     }
 
     /**
-     * Returns the server.
-     * @return MailServer
-     */
-    public MailServer getServer()
-    {
-        return fieldServer;
-    }
-
-    /**
      * Sets the fetchAll.
      * @param fetchAll The fetchAll to set
      */
@@ -580,15 +563,6 @@ class ParsedConfiguration
     }
 
     /**
-     * Sets the server.
-     * @param server The server to set
-     */
-    protected void setServer(MailServer server)
-    {
-        fieldServer = server;
-    }
-
-    /**
      * Returns the logger.
      * @return Logger
      */

Modified: james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ProcessorAbstract.java
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ProcessorAbstract.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ProcessorAbstract.java (original)
+++ james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/ProcessorAbstract.java Wed Dec 15 12:54:20 2010
@@ -30,7 +30,6 @@ import javax.mail.Session;
 import org.apache.commons.logging.Log;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.queue.api.MailQueue;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.MailAddress;
 
@@ -187,16 +186,6 @@ abstract public class ProcessorAbstract
         return getConfiguration().getRemoteReceivedHeaderIndex();    
     }
 
-
-    /**
-     * Returns the server.
-     * @return MailServer
-     */
-    protected MailServer getServer()
-    {
-        return getConfiguration().getServer();
-    }
-    
     /**
      * Returns the DNSService
      * @return DNSService

Modified: james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/DataLineLMTPMessageHookHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/DataLineLMTPMessageHookHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/DataLineLMTPMessageHookHandler.java (original)
+++ james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/DataLineLMTPMessageHookHandler.java Wed Dec 15 12:54:20 2010
@@ -42,8 +42,8 @@ import org.apache.james.protocols.smtp.S
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.james.protocols.smtp.core.DataLineFilter;
 import org.apache.james.protocols.smtp.dsn.DSNStatus;
-import org.apache.james.services.MailServer;
 import org.apache.james.smtpserver.SMTPConstants;
+import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
@@ -53,16 +53,12 @@ import org.apache.mailet.MailAddress;
  *
  */
 public class DataLineLMTPMessageHookHandler implements DataLineFilter {
-    private MailServer mailServer;
+    private UsersRepository users;
     private MailboxManager mailboxManager;
-    
-   /**
-    * Sets the mail server.
-    * @param mailServer the mailServer to
-    */
-   @Resource(name="mailserver")
-   public final void setMailServer(MailServer mailServer) {
-       this.mailServer = mailServer;
+
+   @Resource(name="localusersrepository")
+   public final void setUsersRepository(UsersRepository users) {
+       this.users = users;
    }
    
    @Resource(name="mailboxmanager")
@@ -85,7 +81,7 @@ public class DataLineLMTPMessageHookHand
                 
                 List recipientCollection = (List) session.getState().get(SMTPSession.RCPT_LIST);
                 MailImpl mail =
-                    new MailImpl(mailServer.getId(),
+                    new MailImpl(MailImpl.getId(),
                                  (MailAddress) session.getState().get(SMTPSession.SENDER),
                                  recipientCollection);
                 
@@ -151,7 +147,7 @@ public class DataLineLMTPMessageHookHand
         while (recipients.hasNext()) {
             MailAddress recipient = recipients.next();
             String username;
-            if (mailServer.supportVirtualHosting()) {
+            if (users.supportVirtualHosting()) {
                 username = recipient.toString();
             } else {
                 username = recipient.getLocalPart();

Modified: james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java (original)
+++ james/server/trunk/lmtpserver/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java Wed Dec 15 12:54:20 2010
@@ -26,7 +26,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.smtpserver.netty.SMTPChannelUpstreamHandler;
 import org.apache.james.smtpserver.netty.SMTPResponseEncoder;
 import org.apache.james.socket.netty.AbstractConfigurableAsyncServer;
@@ -44,18 +43,12 @@ public class LMTPServer extends Abstract
      * value, 0, means no limit.
      */
     private long maxMessageSize = 0;
-    private MailServer mailServer;
     private ProtocolHandlerChain handlerChain;
     private LMTPConfiguration lmtpConfig = new LMTPConfiguration();
     private String lmtpGreeting;
     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;
@@ -110,11 +103,7 @@ public class LMTPServer extends Abstract
          * @see org.apache.james.protocols.smtp.SMTPConfiguration#getHelloName()
          */
         public String getHelloName() {
-            if (LMTPServer.this.getHelloName() == null) {
-                return LMTPServer.this.mailServer.getHelloName();
-            } else {
-                return LMTPServer.this.getHelloName();
-            }
+            return LMTPServer.this.getHelloName();
         }
 
         /**

Modified: james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java (original)
+++ james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/maildir/MaildirStoreUtil.java Wed Dec 15 12:54:20 2010
@@ -22,7 +22,7 @@ import java.io.FileNotFoundException;
 
 import org.apache.james.mailbox.maildir.MaildirStore;
 import org.apache.james.services.FileSystem;
-import org.apache.james.services.MailServer;
+import org.apache.james.user.api.UsersRepository;
 
 /**
  * Utility to instance a {@link MaildirStore} object
@@ -40,10 +40,10 @@ public class MaildirStoreUtil{
      * @return store
      * @throws FileNotFoundException
      */
-    public static MaildirStore create(FileSystem fs, MailServer mailServer, String rootURL) throws FileNotFoundException {
+    public static MaildirStore create(FileSystem fs, UsersRepository usersRepos, String rootURL) throws FileNotFoundException {
         StringBuffer root = new StringBuffer();
         root.append(fs.getFile(rootURL).getAbsolutePath());
-        if (mailServer.supportVirtualHosting()) {
+        if (usersRepos.supportVirtualHosting()) {
             root.append("/%domain/%user/");
         } else {
             root.append("/%user/");

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailetContext.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailetContext.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailetContext.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailetContext.java Wed Dec 15 12:54:20 2010
@@ -27,25 +27,29 @@ import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Vector;
 
 import javax.annotation.Resource;
 import javax.mail.Address;
 import javax.mail.Message;
 import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.ParseException;
 
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.james.core.MailImpl;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.TemporaryResolutionException;
 import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.lifecycle.Configurable;
 import org.apache.james.lifecycle.LifecycleUtil;
 import org.apache.james.lifecycle.LogEnabled;
 import org.apache.james.mailetcontainer.api.MailProcessor;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.HostAddress;
 import org.apache.mailet.Mail;
@@ -53,9 +57,7 @@ import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.base.RFC2822Headers;
 
-public class JamesMailetContext implements MailetContext, LogEnabled {
-
-    private MailServer mailServer;
+public class JamesMailetContext implements MailetContext, LogEnabled, Configurable {
 
     /**
      * A hash table of server attributes These are the MailetContext attributes
@@ -71,10 +73,8 @@ public class JamesMailetContext implemen
 
     private DomainList domains;
 
-    @Resource(name = "mailserver")
-    public void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
+    private MailAddress postmaster;
+
 
     @Resource(name="mailProcessor")
     public void setMailProcessor(MailProcessor processorList) {
@@ -242,7 +242,7 @@ public class JamesMailetContext implemen
         }
         try {
             if (name.indexOf("@") == -1) {
-                return isLocalEmail(new MailAddress(name, mailServer.getDefaultDomain()));
+                return isLocalEmail(new MailAddress(name, domains.getDefaultDomain()));
             } else {
                 return isLocalEmail(new MailAddress(name));
             }
@@ -260,7 +260,7 @@ public class JamesMailetContext implemen
         if (!isLocalServer(mailAddress.getDomain())) {
             return false;
         }
-        if (mailServer.supportVirtualHosting() == false) {
+        if (localusers.supportVirtualHosting() == false) {
             userName = mailAddress.getLocalPart();
         }
         return localusers.contains(userName);
@@ -270,7 +270,7 @@ public class JamesMailetContext implemen
      * @see org.apache.mailet.MailetContext#getPostmaster()
      */
     public MailAddress getPostmaster() {
-        return mailServer.getPostmaster();
+        return postmaster;
     }
 
     /**
@@ -397,7 +397,7 @@ public class JamesMailetContext implemen
      */
     @SuppressWarnings("unchecked")
 	public void sendMail(MailAddress sender, Collection recipients, MimeMessage message, String state) throws MessagingException {
-        MailImpl mail = new MailImpl(mailServer.getId(), sender, recipients, message);
+        MailImpl mail = new MailImpl(MailImpl.getId(), sender, recipients, message);
         try {
             mail.setState(state);
             sendMail(mail);
@@ -431,4 +431,47 @@ public class JamesMailetContext implemen
     public void setLog(Log log) {
         this.log = log;
     }
+
+
+    /*
+     * 
+     */
+    public void configure(HierarchicalConfiguration config) throws ConfigurationException {
+        // Get postmaster
+        String postMasterAddress = config.getString("postmaster", "postmaster").toLowerCase(Locale.US);
+        // if there is no @domain part, then add the first one from the
+        // list of supported domains that isn't localhost. If that
+        // doesn't work, use the hostname, even if it is localhost.
+        if (postMasterAddress.indexOf('@') < 0) {
+            String domainName = null; // the domain to use
+            // loop through candidate domains until we find one or exhaust the
+            // list
+            String[] doms = domains.getDomains();
+            if (doms != null) {
+                for (int i = 0; i < doms.length; i++) {
+                    String serverName = doms[i].toLowerCase(Locale.US);
+                    if (!("localhost".equals(serverName))) {
+                        domainName = serverName; // ok, not localhost, so use it
+                        continue;
+                    }
+                }
+            
+            }
+            // if we found a suitable domain, use it. Otherwise fallback to the
+            // host name.
+            postMasterAddress = postMasterAddress + "@" + (domainName != null ? domainName : domains.getDefaultDomain());
+        }
+        try {
+            this.postmaster = new MailAddress(postMasterAddress);
+            if (!domains.containsDomain(postmaster.getDomain())) {
+                StringBuffer warnBuffer = new StringBuffer(320).append("The specified postmaster address ( ").append(postmaster).append(
+                        " ) is not a local address.  This is not necessarily a problem, but it does mean that emails addressed to the postmaster will be routed to another server.  For some configurations this may cause problems.");
+                log.warn(warnBuffer.toString());
+            }    
+        } catch (AddressException e) {
+            throw new ConfigurationException("Postmaster address " + postMasterAddress + "is invalid",e);
+        }
+
+    
+    }
 }

Modified: james/server/trunk/mailets/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/pom.xml?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/pom.xml (original)
+++ james/server/trunk/mailets/pom.xml Wed Dec 15 12:54:20 2010
@@ -118,6 +118,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.james</groupId>
+      <artifactId>james-server-domainlist-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.james</groupId>
       <artifactId>james-server-mail-api</artifactId>
     </dependency>
     <dependency>

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractRedirect.java Wed Dec 15 12:54:20 2010
@@ -49,7 +49,6 @@ import org.apache.mailet.base.RFC822Date
 import org.apache.james.core.MailImpl;
 import org.apache.james.core.MimeMessageUtil;
 import org.apache.james.dnsservice.api.DNSService;
-import org.apache.james.services.MailServer;
 
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.Mail;
@@ -234,15 +233,9 @@ public abstract class AbstractRedirect e
 
     private RFC822DateFormat rfc822DateFormat = new RFC822DateFormat();
 
-    protected MailServer mailServer;
-
     protected DNSService dns;
 
     
-    @Resource(name="mailserver")
-    public void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
     
 
     @Resource(name="dnsservice")

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTable.java Wed Dec 15 12:54:20 2010
@@ -36,7 +36,7 @@ import javax.mail.internet.ParseExceptio
 
 import org.apache.james.core.MailImpl;
 import org.apache.james.dnsservice.api.DNSService;
-import org.apache.james.services.MailServer;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.vut.lib.VirtualUserTableUtil;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
@@ -54,19 +54,21 @@ import org.apache.oro.text.regex.Malform
 public abstract class AbstractVirtualUserTable extends GenericMailet
 {
     static private final String MARKER = "org.apache.james.transport.mailets.AbstractVirtualUserTable.mapped";
-    private MailServer mailServer;
     private DNSService dns;
+    private DomainList domainList;
 
-    @Resource(name="mailserver")
-    public void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
     
     @Resource(name="dnsservice")
     public void setDNSService(DNSService dns) {
         this.dns = dns;
     }
     
+    @Resource(name="domainlist")
+    public void setDomainList(DomainList domainList) {
+        this.domainList = domainList;
+    }
+    
+    
     /**
      * Checks the recipient list of the email for user mappings.  Maps recipients as
      * appropriate, modifying the recipient list of the mail and sends mail to any new
@@ -125,7 +127,7 @@ public abstract class AbstractVirtualUse
                         }
 
                         try {
-                            MailAddress target = (targetAddress.indexOf('@') < 0) ? new MailAddress(targetAddress, mailServer.getDefaultDomain())
+                            MailAddress target = (targetAddress.indexOf('@') < 0) ? new MailAddress(targetAddress, domainList.getDefaultDomain())
                                 : new MailAddress(targetAddress);
 
                             //Mark this source address as an address to remove from the recipient list

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/AbstractVirtualUserTableMailet.java Wed Dec 15 12:54:20 2010
@@ -29,7 +29,7 @@ import javax.annotation.Resource;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
 
-import org.apache.james.services.MailServer;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.GenericMailet;
@@ -43,13 +43,14 @@ import org.apache.mailet.base.RFC2822Hea
  */
 public abstract class AbstractVirtualUserTableMailet extends GenericMailet {
     
-    private MailServer mailServer;
+    private DomainList domainList;
 
-    @Resource(name="mailserver")
-    public void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
+    @Resource(name="domainlist")
+    public void setDomainList(DomainList domainList) {
+        this.domainList = domainList;
     }
     
+    
     /*
      * (non-Javadoc)
      * @see org.apache.mailet.base.GenericMailet#service(org.apache.mailet.Mail)
@@ -136,7 +137,7 @@ public abstract class AbstractVirtualUse
 
             if (rcpt.indexOf("@") < 0) {
                 // the mapping contains no domain name, use the default domain
-                rcpt = rcpt + "@" + mailServer.getDefaultDomain();
+                rcpt = rcpt + "@" + domainList.getDefaultDomain();
             }
 
             MailAddress nextMap = new MailAddress(rcpt);

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java Wed Dec 15 12:54:20 2010
@@ -320,7 +320,7 @@ public class DSNBounce extends AbstractN
         // failure reports into DSNs
         nameType = "dns";
         try {
-            String myAddress = mailServer.getHelloName();
+            String myAddress = dns.getHostName(dns.getLocalHost());//mailServer.getHelloName();
             /*
             String myAddress = InetAddress.getLocalHost().getCanonicalHostName();
             */

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/LocalDelivery.java Wed Dec 15 12:54:20 2010
@@ -22,7 +22,6 @@
 package org.apache.james.transport.mailets;
 
 import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersStore;
 import org.apache.mailet.base.GenericMailet;
@@ -60,7 +59,6 @@ public class LocalDelivery extends Gener
 
     private UsersStore usersStore;
 
-    private MailServer mailServer;
 
     private MailboxManager mailboxManager;
 
@@ -77,10 +75,6 @@ public class LocalDelivery extends Gener
         this.usersStore = usersStore;
     }
     
-    @Resource(name="mailserver")
-    public void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
     
 
     @Resource(name="mailboxmanager")
@@ -155,7 +149,7 @@ public class LocalDelivery extends Gener
             }
 
         };
-        sieveMailet.setMailServer(mailServer);
+        sieveMailet.setUsersRepository(usersRepository);
         sieveMailet.setMailboxManager(mailboxManager);
         sieveMailet.init(m);
 

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java Wed Dec 15 12:54:20 2010
@@ -23,12 +23,12 @@ package org.apache.james.transport.maile
 
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.TemporaryResolutionException;
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.lifecycle.LifecycleUtil;
 import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.queue.api.MailQueue.MailQueueException;
 import org.apache.james.queue.api.MailQueue.MailQueueItem;
-import org.apache.james.services.MailServer;
 import org.apache.james.util.TimeConverter;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.HostAddress;
@@ -190,7 +190,8 @@ public class RemoteDelivery extends Gene
 
     private MailQueue queue;
 
-    private MailServer mailServer;
+    private String heloName;
+
     
     
     @Resource(name="mailQueueFactory")
@@ -203,13 +204,14 @@ public class RemoteDelivery extends Gene
         this.dnsServer = dnsService;
     }
     
-    @Resource(name="mailserver")
-    public void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
+    private DomainList domainList;
+
+    @Resource(name="domainlist")
+    public void setDomainList(DomainList domainList) {
+        this.domainList = domainList;
     }
     
     
-    
     /**
      * Initializes all arguments based on configuration values specified in the
      * James configuration file.
@@ -376,6 +378,9 @@ public class RemoteDelivery extends Gene
         if (dnsRetry != null && !dnsRetry.equals("")) {
             dnsProblemRetry = Integer.parseInt(dnsRetry); 
         }
+        
+        heloName = getInitParameter("heloName");
+
     }
 
     /**
@@ -649,12 +654,6 @@ public class RemoteDelivery extends Gene
          * fix.
          */
         long stop = System.currentTimeMillis() + 60000;
-        while (mailServer.getHelloName() == null
-               && stop > System.currentTimeMillis()) {
-            try {
-                Thread.sleep(1000);
-            } catch (Exception ignored) {} // wait for James to finish initializing
-        }
 
         //Checks the pool and delivers a mail message
         Properties props = new Properties();
@@ -674,16 +673,8 @@ public class RemoteDelivery extends Gene
         props.put("mail.smtp.connectiontimeout", connectionTimeout + "");
         props.put("mail.smtp.sendpartial",String.valueOf(sendPartial));
 
-        //Set the hostname we'll use as this server
-        if (mailServer.getHelloName() != null) {
-            props.put("mail.smtp.localhost", mailServer.getHelloName());
-        }
-        else {
-            String defaultDomain = mailServer.getDefaultDomain();
-            if (defaultDomain != null) {
-                props.put("mail.smtp.localhost", defaultDomain);
-            }
-        }
+        props.put("mail.smtp.localhost", getHeloName());
+
 
         if (isBindUsed) {
             // undocumented JavaMail 1.2 feature, smtp transport will use
@@ -1474,7 +1465,7 @@ public class RemoteDelivery extends Gene
         PrintWriter out = new PrintWriter(sout, true);
         String machine = "[unknown]";
         try {
-            machine = mailServer.getHelloName();
+            machine = getHeloName();
             
         } catch(Exception e){
             machine = "[address unknown]";
@@ -1618,5 +1609,14 @@ public class RemoteDelivery extends Gene
             }
         };
     }
+    
+    protected String getHeloName() {
+        if (heloName == null) {
+            //TODO: Maybe we should better just lookup the hostname via dns
+            return domainList.getDefaultDomain();
+        } else {
+            return heloName;
+        }
+    }
   
 }

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java Wed Dec 15 12:54:20 2010
@@ -32,7 +32,7 @@ import org.apache.james.mailbox.MailboxM
 import org.apache.james.mailbox.MailboxPath;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
-import org.apache.james.services.MailServer;
+import org.apache.james.user.api.UsersRepository;
 import org.apache.jsieve.mailet.Poster;
 import org.apache.jsieve.mailet.SieveMailboxMailet;
 import org.apache.mailet.Mail;
@@ -44,12 +44,12 @@ import org.apache.mailet.MailetConfig;
  */
 public class SieveMailet extends SieveMailboxMailet implements Poster{
 
-    private MailServer mailServer;
+    private UsersRepository usersRepos;
     private MailboxManager mailboxManager;
 
-    @Resource(name="mailserver")
-    public void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
+    @Resource(name="localusersrepository")
+    public void setUsersRepository(UsersRepository usersRepos) {
+        this.usersRepos = usersRepos;
     }
 
     
@@ -61,7 +61,7 @@ public class SieveMailet extends SieveMa
     @Override
     public void init(MailetConfig config) throws MessagingException {
         // ATM Fixed implementation
-        setLocator(new ResourceLocatorImpl(mailServer.supportVirtualHosting()));
+        setLocator(new ResourceLocatorImpl(usersRepos.supportVirtualHosting()));
         setPoster(this);
         super.init(config);
     }
@@ -79,7 +79,7 @@ public class SieveMailet extends SieveMa
      * @return username
      */
     protected String getUsername(MailAddress m) {
-        if (mailServer.supportVirtualHosting()) {
+        if (usersRepos.supportVirtualHosting()) {
             return m.toString();
         } else {
             return super.getUsername(m);
@@ -134,7 +134,7 @@ public class SieveMailet extends SieveMa
 
                     // check if we should use the full emailaddress as
                     // username
-                    if (mailServer.supportVirtualHosting()) {
+                    if (usersRepos.supportVirtualHosting()) {
                         user = user + "@" + host;
                     }
 

Modified: james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3Server.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3Server.java (original)
+++ james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3Server.java Wed Dec 15 12:54:20 2010
@@ -26,7 +26,6 @@ import org.apache.commons.configuration.
 import org.apache.james.pop3server.POP3HandlerConfigurationData;
 import org.apache.james.protocols.api.ProtocolHandlerChain;
 import org.apache.james.protocols.impl.AbstractSSLAwareChannelPipelineFactory;
-import org.apache.james.services.MailServer;
 import org.apache.james.socket.netty.AbstractConfigurableAsyncServer;
 import org.apache.james.socket.netty.ConnectionCountHandler;
 import org.jboss.netty.channel.ChannelPipeline;
@@ -56,17 +55,11 @@ public class POP3Server extends Abstract
     
     private ProtocolHandlerChain handlerChain;
 
-    private MailServer mailServer;
-
     
     public void setProtocolHandlerChain(ProtocolHandlerChain handlerChain) {
         this.handlerChain = handlerChain;
     }
 
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
     @Override
     protected int getDefaultPort() {
         return 110;
@@ -101,11 +94,7 @@ public class POP3Server extends Abstract
          * @see org.apache.james.pop3server.POP3HandlerConfigurationData#getHelloName()
          */
         public String getHelloName() {
-            if (POP3Server.this.getHelloName() == null) {
-                return POP3Server.this.mailServer.getHelloName();
-            } else {
-                return POP3Server.this.getHelloName();
-            }
+            return POP3Server.this.getHelloName();
         }
 
         /**

Modified: james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/AbstractAsyncPOP3ServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/AbstractAsyncPOP3ServerTest.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/AbstractAsyncPOP3ServerTest.java (original)
+++ james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/AbstractAsyncPOP3ServerTest.java Wed Dec 15 12:54:20 2010
@@ -39,7 +39,6 @@ import org.apache.commons.net.pop3.POP3M
 import org.apache.commons.net.pop3.POP3Reply;
 import org.apache.james.services.MockJSR250Loader;
 import org.apache.james.services.MockFileSystem;
-import org.apache.james.services.MockMailServer;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.MockDNSService;
 import org.apache.james.mailbox.inmemory.InMemoryMailboxManager;
@@ -49,7 +48,6 @@ import org.apache.james.mailbox.MailboxP
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.MailboxConstants;
 import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.lifecycle.LifecycleUtil;
 import org.apache.james.mailbox.store.Authenticator;
 import org.apache.james.socket.JamesProtocolHandlerChain;
 import org.apache.james.user.lib.MockUsersRepository;
@@ -59,7 +57,6 @@ import org.apache.james.util.TestUtil;
 public abstract class AbstractAsyncPOP3ServerTest extends TestCase {
 
     private int m_pop3ListenerPort = TestUtil.getNonPrivilegedPort();
-    protected MockMailServer m_mailServer;
     private POP3TestConfiguration m_testConfiguration;
     private MockUsersRepository m_usersRepository = new MockUsersRepository();
     private POP3Client m_pop3Protocol = null;
@@ -101,9 +98,6 @@ public abstract class AbstractAsyncPOP3S
     
     protected void setUpServiceManager() throws Exception {
         serviceManager = new MockJSR250Loader();
-
-        m_mailServer = new MockMailServer();
-        serviceManager.put("mailserver", m_mailServer);
         serviceManager.put("localusersrepository",
                 m_usersRepository);
         
@@ -145,7 +139,6 @@ public abstract class AbstractAsyncPOP3S
                m_pop3Protocol.disconnect();
            }
         }
-        LifecycleUtil.dispose(m_mailServer);
         
         manager.deleteEverything();
         //manager.deleteAll();

Modified: james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java (original)
+++ james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java Wed Dec 15 12:54:20 2010
@@ -44,7 +44,6 @@ public class POP3ServerTest extends Abst
         SimpleLog log = new SimpleLog("Mock");
         log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
         m_pop3Server.setLog(log);
-        m_pop3Server.setMailServer(m_mailServer);        
     }
 
     @Override

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/AddUserCmdHandler.java Wed Dec 15 12:54:20 2010
@@ -33,7 +33,6 @@ import org.apache.james.remotemanager.Co
 import org.apache.james.remotemanager.CommandHelp;
 import org.apache.james.remotemanager.RemoteManagerResponse;
 import org.apache.james.remotemanager.RemoteManagerSession;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersStore;
 
@@ -46,7 +45,6 @@ public class AddUserCmdHandler implement
     private CommandHelp help = new CommandHelp("adduser [username] [password]","add a new user");
 
     private UsersStore uStore;
-    private MailServer mailServer;
 
     private DomainList domList;
 
@@ -64,15 +62,7 @@ public class AddUserCmdHandler implement
         this.uStore = uStore;
     }
     
-    /**
-     * Sets the mail server.
-     * @param mailServer the mailServer to set
-     */
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
-    
+
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
      */
@@ -113,7 +103,7 @@ public class AddUserCmdHandler implement
             return response;
         } else {
             if((username.indexOf("@") < 0) == false) {
-                if(mailServer.supportVirtualHosting() == false) {
+                if(users.supportVirtualHosting() == false) {
                     response = new RemoteManagerResponse("Virtualhosting not supported");
                     return response;
                 }

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/CountUsersCmdHandler.java Wed Dec 15 12:54:20 2010
@@ -57,7 +57,7 @@ public class CountUsersCmdHandler extend
             response = new RemoteManagerResponse("Existing accounts " + users.countUsers());
             return response;
         } else {
-            if(mailServer.supportVirtualHosting() == false) {
+            if(users.supportVirtualHosting() == false) {
                 response = new RemoteManagerResponse("Virtualhosting not supported");
                 return response;
            }

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/core/ListUsersCmdHandler.java Wed Dec 15 12:54:20 2010
@@ -32,7 +32,6 @@ import org.apache.james.remotemanager.Co
 import org.apache.james.remotemanager.CommandHelp;
 import org.apache.james.remotemanager.RemoteManagerResponse;
 import org.apache.james.remotemanager.RemoteManagerSession;
-import org.apache.james.services.MailServer;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersStore;
 
@@ -42,7 +41,6 @@ public class ListUsersCmdHandler impleme
     private CommandHelp help = new CommandHelp("listusers","display existing accounts");
 
     protected UsersStore uStore;
-    protected MailServer mailServer;
 
     /**
      * Sets the users store.
@@ -57,13 +55,6 @@ public class ListUsersCmdHandler impleme
 
     
     /**
-     * Sets the mail server.
-     * @param mailServer the mailServer to set
-     */
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
     
     /**
      * @see org.apache.james.remotemanager.CommandHandler#getHelp()
@@ -88,7 +79,7 @@ public class ListUsersCmdHandler impleme
             }
             return response;
         } else {
-            if(mailServer.supportVirtualHosting() == false) {
+            if(users.supportVirtualHosting() == false) {
                 response = new RemoteManagerResponse("Virtualhosting not supported");
                 return response;
             }

Modified: james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/netty/RemoteManager.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/netty/RemoteManager.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/netty/RemoteManager.java (original)
+++ james/server/trunk/remotemanager/src/main/java/org/apache/james/remotemanager/netty/RemoteManager.java Wed Dec 15 12:54:20 2010
@@ -30,7 +30,6 @@ import org.apache.commons.configuration.
 import org.apache.james.protocols.api.ProtocolHandlerChain;
 import org.apache.james.protocols.impl.AbstractChannelPipelineFactory;
 import org.apache.james.remotemanager.RemoteManagerHandlerConfigurationData;
-import org.apache.james.services.MailServer;
 import org.apache.james.socket.netty.AbstractConfigurableAsyncServer;
 import org.apache.james.socket.netty.ConnectionCountHandler;
 import org.jboss.netty.channel.ChannelPipeline;
@@ -51,17 +50,12 @@ public class RemoteManager extends Abstr
     private RemoteManagerHandlerConfigurationData configData = new RemoteManagerHandlerConfigurationDataImpl();
     private final ConnectionCountHandler countHandler = new ConnectionCountHandler();
     private ProtocolHandlerChain handlerChain;
-    private MailServer mailServer;
 
     public void setProtocolHandlerChain(ProtocolHandlerChain handlerChain) {
         this.handlerChain = handlerChain;
     }
     
 
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
     
     @Override
     protected int getDefaultPort() {
@@ -99,11 +93,8 @@ public class RemoteManager extends Abstr
          * @see org.apache.james.remotemanager.RemoteManagerHandlerConfigurationData#getHelloName()
          */
         public String getHelloName() {
-            if (getHelloName() == null) {
-                return RemoteManager.this.mailServer.getHelloName();
-            } else {
-                return RemoteManager.this.getHelloName();
-            }
+            return RemoteManager.this.getHelloName();
+
         }
         
         /**

Modified: james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java (original)
+++ james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/AbstractRemoteManagerTest.java Wed Dec 15 12:54:20 2010
@@ -38,7 +38,6 @@ import org.apache.commons.logging.impl.S
 import org.apache.commons.net.telnet.TelnetClient;
 import org.apache.james.services.MockJSR250Loader;
 import org.apache.james.services.MockFileSystem;
-import org.apache.james.services.MockMailServer;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.MockDNSService;
 import org.apache.james.domainlist.api.DomainList;
@@ -60,7 +59,6 @@ public abstract class AbstractRemoteMana
 	private InternetPrintWriter m_writer;
 	private TelnetClient m_telnetClient;
 	private MockUsersRepository m_mockUsersRepository;
-	protected MockMailServer mailServer;
 	private MockJSR250Loader serviceManager;
 	private MockUsersStore usersStore;
 	protected DNSService dnsservice;
@@ -80,10 +78,6 @@ public abstract class AbstractRemoteMana
 				m_remoteManagerListenerPort);
 	}
 
-	protected void tearDown() throws Exception {
-	    LifecycleUtil.dispose(mailServer);
-		super.tearDown();
-	}
 
 	protected void finishSetUp(RemoteManagerTestConfiguration testConfiguration)
 			throws Exception {
@@ -175,8 +169,6 @@ public abstract class AbstractRemoteMana
 		usersStore = new MockUsersStore(m_mockUsersRepository);
 		serviceManager.put("usersstore", usersStore);
 
-		mailServer = new MockMailServer();
-		serviceManager.put("mailserver", mailServer);
 		
 		filesystem = new MockFileSystem();
 		serviceManager.put("filesystem", filesystem);

Modified: james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java (original)
+++ james/server/trunk/remotemanager/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java Wed Dec 15 12:54:20 2010
@@ -40,7 +40,6 @@ public class RemoteManagerTest extends A
         SimpleLog log = new SimpleLog("Mock");
         log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
         remotemanager.setLog(log);
-        remotemanager.setMailServer(mailServer);
                
     }
 

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java Wed Dec 15 12:54:20 2010
@@ -52,7 +52,6 @@ import org.apache.james.protocols.smtp.h
 import org.apache.james.protocols.smtp.hook.HookResult;
 import org.apache.james.protocols.smtp.hook.HookResultHook;
 import org.apache.james.protocols.smtp.hook.MessageHook;
-import org.apache.james.services.MailServer;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
@@ -73,27 +72,8 @@ public final class DataLineJamesMessageH
     
     private List<HookResultHook> rHooks;
     
-    private MailServer mailServer;
-
 	private List<MessageHook> mHandlers;
-    
-    /**
-     * Gets the mail server.
-     * @return the mailServer
-     */
-    public final MailServer getMailServer() {
-        return mailServer;
-    }
 
-    /**
-     * Sets the mail server.
-     * @param mailServer the mailServer to set
-     */
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
-    
 
     /*
      * (non-Javadoc)
@@ -113,7 +93,7 @@ public final class DataLineJamesMessageH
                 
                 List recipientCollection = (List) session.getState().get(SMTPSession.RCPT_LIST);
                 MailImpl mail =
-                    new MailImpl(mailServer.getId(),
+                    new MailImpl(MailImpl.getId(),
                                  (MailAddress) session.getState().get(SMTPSession.SENDER),
                                  recipientCollection);
                 

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesDataCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesDataCmdHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesDataCmdHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesDataCmdHandler.java Wed Dec 15 12:54:20 2010
@@ -19,15 +19,14 @@
 package org.apache.james.smtpserver;
 
 
-import javax.annotation.Resource;
 import javax.mail.MessagingException;
 
+import org.apache.james.core.MailImpl;
 import org.apache.james.core.MimeMessageInputStreamSource;
 import org.apache.james.protocols.smtp.SMTPResponse;
 import org.apache.james.protocols.smtp.SMTPRetCode;
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.james.protocols.smtp.core.DataCmdHandler;
-import org.apache.james.services.MailServer;
 
 
 /**
@@ -35,26 +34,7 @@ import org.apache.james.services.MailSer
  */
 public class JamesDataCmdHandler extends DataCmdHandler {
 
-    
-
-    private MailServer mailServer;
-    
-    /**
-     * Gets the mail server.
-     * @return the mailServer
-     */
-    public final MailServer getMailServer() {
-        return mailServer;
-    }
-
-    /**
-     * Sets the mail server.
-     * @param mailServer the mailServer to set
-     */
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
-    }
+  
  
     /**
      * Handler method called upon receipt of a DATA command.
@@ -66,7 +46,7 @@ public class JamesDataCmdHandler extends
      */
     protected SMTPResponse doDATA(SMTPSession session, String argument) {
         try {
-            MimeMessageInputStreamSource mmiss = new MimeMessageInputStreamSource(mailServer.getId());
+            MimeMessageInputStreamSource mmiss = new MimeMessageInputStreamSource(MailImpl.getId());
             session.getState().put(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE, mmiss);
         } catch (MessagingException e) {
             session.getLogger().warn("Error creating mimemessagesource for incoming data",e);

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesMailCmdHandler.java Wed Dec 15 12:54:20 2010
@@ -20,35 +20,23 @@ package org.apache.james.smtpserver;
 
 import javax.annotation.Resource;
 
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.protocols.smtp.core.MailCmdHandler;
-import org.apache.james.services.MailServer;
 
 public class JamesMailCmdHandler extends MailCmdHandler{
 
-    private MailServer mailServer;
-        
-    /**
-     * Gets the mail server.
-     * @return the mailServer
-     */
-    public final MailServer getMailServer() {
-        return mailServer;
-    }
+    private DomainList domainList;
 
-    /**
-     * Sets the mail server.
-     * @param mailServer the mailServer to set
-     */
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
+    @Resource(name="domainlist")
+    public final void setDomainList(DomainList domainList) {
+        this.domainList = domainList;
     }
 
     /**
      * @see org.apache.james.protocols.smtp.core.MailCmdHandler#getDefaultDomain()
      */
     public String getDefaultDomain() {
-        return mailServer.getDefaultDomain();
+        return domainList.getDefaultDomain();
     }
     
     

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/JamesRcptCmdHandler.java Wed Dec 15 12:54:20 2010
@@ -21,37 +21,22 @@ package org.apache.james.smtpserver;
 
 import javax.annotation.Resource;
 
+import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.protocols.smtp.core.RcptCmdHandler;
-import org.apache.james.services.MailServer;
 
 public class JamesRcptCmdHandler extends RcptCmdHandler{
-	private MailServer mailServer;
 
-	/**
-	 * Gets the mail server.
-	 * 
-	 * @return the mailServer
-	 */
-	public final MailServer getMailServer() {
-		return mailServer;
-	}
-
-	/**
-	 * Sets the mail server.
-	 * 
-	 * @param mailServer
-	 *            the mailServer to set
-	 */
-	@Resource(name = "mailserver")
-	public final void setMailServer(MailServer mailServer) {
-		this.mailServer = mailServer;
-	}
-
-	/**
-	 * (non-Javadoc)
-	 * @see org.apache.james.protocols.smtp.core.RcptCmdHandler#getDefaultDomain()
-	 */
-    protected String getDefaultDomain() {
-    	return mailServer.getDefaultDomain();
+    private DomainList domainList;
+
+    @Resource(name="domainlist")
+    public final void setDomainList(DomainList domainList) {
+        this.domainList = domainList;
+    }
+
+    /**
+     * @see org.apache.james.protocols.smtp.core.MailCmdHandler#getDefaultDomain()
+     */
+    public String getDefaultDomain() {
+        return domainList.getDefaultDomain();
     }
 }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java?rev=1049530&r1=1049529&r2=1049530&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java (original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/SenderAuthIdentifyVerificationRcptHook.java Wed Dec 15 12:54:20 2010
@@ -25,8 +25,8 @@ import org.apache.james.protocols.smtp.S
 import org.apache.james.protocols.smtp.core.AbstractSenderAuthIdentifyVerificationRcptHook;
 import org.apache.james.protocols.smtp.hook.HookResult;
 import org.apache.james.protocols.smtp.hook.HookReturnCode;
-import org.apache.james.services.MailServer;
 import org.apache.james.smtpserver.netty.SMTPNettySession;
+import org.apache.james.user.api.UsersRepository;
 import org.apache.mailet.MailAddress;
 
 /**
@@ -34,17 +34,12 @@ import org.apache.mailet.MailAddress;
  */
 public class SenderAuthIdentifyVerificationRcptHook extends AbstractSenderAuthIdentifyVerificationRcptHook {
 
-    private MailServer mailServer;
     private DomainList domains;
-    
+    private UsersRepository users;
 
-    /**
-     * Sets the mail server.
-     * @param mailServer the mailServer to set
-     */
-    @Resource(name="mailserver")
-    public final void setMailServer(MailServer mailServer) {
-        this.mailServer = mailServer;
+    @Resource(name="localusersrepository")
+    public final void setUsersRepository(UsersRepository users) {
+        this.users = users;
     }
 
 
@@ -74,6 +69,6 @@ public class SenderAuthIdentifyVerificat
 
     @Override
     protected boolean useVirtualHosting() {
-        return mailServer.supportVirtualHosting();
+        return users.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