james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r413135 - /james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java
Date Fri, 09 Jun 2006 19:36:40 GMT
Author: norman
Date: Fri Jun  9 12:36:39 2006
New Revision: 413135

URL: http://svn.apache.org/viewvc?rev=413135&view=rev
Log:
-Add set methods for ServiceManager and DNSServer
-Throws MessagingException if the DNSServer was not suplied!

Modified:
    james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java

Modified: james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java?rev=413135&r1=413134&r2=413135&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java
(original)
+++ james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java
Fri Jun  9 12:36:39 2006
@@ -17,7 +17,6 @@
 
 package org.apache.james.transport.matchers;
 
-import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.james.Constants;
 import org.apache.james.services.DNSServer;
@@ -58,18 +57,21 @@
      * The DNSServer
      */
     private DNSServer dnsServer;
+    
+    /**
+     * The ServiceManger
+     */
+    private ServiceManager compMgr;
 
     public void init() throws MessagingException {
         
-        ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
+        setServiceManager((ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER));
         
         try {
             // Instantiate DNSServer
-            dnsServer = (DNSServer) compMgr.lookup(DNSServer.ROLE);
-        } catch (ServiceException cnfe) {
-            log("Failed to retrieve DNSServer" + cnfe.getMessage());
+            setDNSServer((DNSServer) compMgr.lookup(DNSServer.ROLE));
         } catch (Exception e) {
-            log("Failed to retrieve DNSServer:" + e.getMessage());
+            throw new MessagingException("Failed to retrieve DNSServer:" + e.getMessage());
         }
         
         Collection nets = allowedNetworks();
@@ -101,5 +103,14 @@
 
     protected boolean matchNetwork(String addr) {
         return authorizedNetworks == null ? false : authorizedNetworks.matchInetNetwork(addr);
+    }
+    
+    
+    protected void setDNSServer(DNSServer dnsServer) {
+        this.dnsServer = dnsServer;
+    }
+    
+    protected void setServiceManager(ServiceManager compMgr) {
+        this.compMgr = compMgr;
     }
 }



---------------------------------------------------------------------
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