You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2009/09/17 17:11:33 UTC

svn commit: r816226 - in /james/server/trunk: avalon-socket-library/src/main/java/org/apache/james/socket/AbstractProtocolServer.java smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java

Author: rdonkin
Date: Thu Sep 17 15:11:32 2009
New Revision: 816226

URL: http://svn.apache.org/viewvc?rev=816226&view=rev
Log:
JAMES-923 Use super class for DNS server https://issues.apache.org/jira/browse/JAMES-923

Modified:
    james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractProtocolServer.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java

Modified: james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractProtocolServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractProtocolServer.java?rev=816226&r1=816225&r2=816226&view=diff
==============================================================================
--- james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractProtocolServer.java (original)
+++ james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractProtocolServer.java Thu Sep 17 15:11:32 2009
@@ -182,7 +182,7 @@
     /**
      * The DNSService
      */
-    private DNSService dnsServer = null;
+    private DNSService dnsService = null;
     
     /**
      * Counts the number of handler instances created.
@@ -199,6 +199,24 @@
      */
     private String streamDumpDir = null;
 
+    
+    
+    /**
+     * Gets the DNS Service.
+     * @return the dnsServer
+     */
+    public final DNSService getDnsServer() {
+        return dnsService;
+    }
+
+    /**
+     * Sets the DNS service.
+     * @param dnsServer the dnsServer to set
+     */
+    public final void setDnsServer(DNSService dnsServer) {
+        this.dnsService = dnsServer;
+    }
+
     public void setConnectionManager(JamesConnectionManager connectionManager) {
         this.connectionManager = connectionManager;
     }
@@ -212,7 +230,7 @@
         JamesConnectionManager connectionManager =
             (JamesConnectionManager)componentManager.lookup(JamesConnectionManager.ROLE);
         setConnectionManager(connectionManager);
-        dnsServer = (DNSService) comp.lookup(DNSService.ROLE);
+        dnsService = (DNSService) comp.lookup(DNSService.ROLE);
     }
 
     /**
@@ -400,7 +418,7 @@
     protected String getLocalHostName() {
         String hostName = null;
         try {
-            hostName = dnsServer.getHostName(dnsServer.getLocalHost());
+            hostName = dnsService.getHostName(dnsService.getLocalHost());
         } catch (UnknownHostException ue) {
             hostName = "localhost";
         }
@@ -411,7 +429,7 @@
         StringBuffer infoBuffer;
         String hostName = null;
         try {
-            hostName = dnsServer.getHostName(dnsServer.getLocalHost());
+            hostName = dnsService.getHostName(dnsService.getLocalHost());
         } catch (UnknownHostException ue) {
             hostName = "localhost";
         }
@@ -818,7 +836,7 @@
     public Object newInstance() throws Exception {
         final String name = "Handler-" + handlerCount.getAndAdd(1);
         final JamesConnectionBridge delegatingJamesHandler = 
-            new JamesConnectionBridge(newProtocolHandlerInstance(), dnsServer, name, getLogger());
+            new JamesConnectionBridge(newProtocolHandlerInstance(), dnsService, name, getLogger());
         return delegatingJamesHandler;
     }
     
@@ -827,6 +845,7 @@
    /**
      * @see org.apache.avalon.excalibur.pool.ObjectFactory#getCreatedClass()
      */
+    @SuppressWarnings("unchecked")
     public Class getCreatedClass() {
         return JamesConnectionBridge.class;
     }

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java?rev=816226&r1=816225&r2=816226&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPServer.java Thu Sep 17 15:11:32 2009
@@ -29,7 +29,6 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.commons.logging.impl.AvalonLogger;
 import org.apache.james.Constants;
-import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.api.dnsservice.util.NetMatcher;
 import org.apache.james.api.kernel.LoaderService;
 import org.apache.james.services.MailServer;
@@ -68,10 +67,6 @@
      */
     private MailServer mailServer;
 
-    /**
-     * The DNSServer to use for queries
-     */
-    private DNSService dnsServer;
     /** Loads instances */
     private LoaderService loader;
 
@@ -149,7 +144,6 @@
         super.service( manager );
         mailetcontext = (MailetContext) manager.lookup("org.apache.mailet.MailetContext");
         mailServer = (MailServer) manager.lookup(MailServer.ROLE);
-        dnsServer = (DNSService) manager.lookup(DNSService.ROLE); 
     }
 
     /**
@@ -200,7 +194,7 @@
                     String addr = st.nextToken();
                     networks.add(addr);
                 }
-                authorizedNetworks = new NetMatcher(networks,dnsServer);
+                authorizedNetworks = new NetMatcher(networks, getDnsServer());
             }
 
             if (authorizedNetworks != null) {



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