Hi guys, i whould like to use setter methods for that in all mailets and matchers like i did in smtpCommandHandlers (refactoring). Anyone has a problem with that? If not i go ahead..
bye Norman Am Freitag, den 09.06.2006, 19:36 +0000 schrieb [EMAIL PROTECTED]: > Author: norman > Date: Fri Jun 9 12:36:39 2006 > New Revision: 413135 > > URL: http://svn.apache.org/viewvc?revA3135&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?revA3135&r1A3134&r2A3135&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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > >
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
