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 no...@apache.org on 2006/06/09 21:36:40 UTC

svn commit: r413135 - /james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java

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


RE: svn commit: r413135 - /james/server/trunk/src/java/org/apache/james/transport/matchers/AbstractNetworkMatcher.java

Posted by "Noel J. Bergman" <no...@devtech.com>.
> - Add [protected] set methods for ServiceManager and DNSServer

Those properties were private, and you've now exposed setters to derived classes.  Why?

	--- Noel


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