Author: norman
Date: Mon May 15 01:44:16 2006
New Revision: 406587

URL: http://svn.apache.org/viewcvs?rev=406587&view=rev
Log:
-Add setMethods. See JAMES-494
-Add default value for configure values

Modified:
    
james/server/trunk/src/java/org/apache/james/smtpserver/AddHeaderHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/RcptCmdHandler.java

Modified: 
james/server/trunk/src/java/org/apache/james/smtpserver/AddHeaderHandler.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/smtpserver/AddHeaderHandler.java?rev=406587&r1=406586&r2=406587&view=diff
==============================================================================
--- 
james/server/trunk/src/java/org/apache/james/smtpserver/AddHeaderHandler.java 
(original)
+++ 
james/server/trunk/src/java/org/apache/james/smtpserver/AddHeaderHandler.java 
Mon May 15 01:44:16 2006
@@ -44,13 +44,31 @@
 
         Configuration configuration = 
handlerConfiguration.getChild("headername", false);
         if(configuration != null) {
-            headerName = configuration.getValue();
+            setHeaderName(configuration.getValue());
         }
 
         configuration = handlerConfiguration.getChild("headervalue", false);
         if(configuration != null) {
-            headerValue = configuration.getValue();
+            setHeaderValue(configuration.getValue());
         }
+    }
+    
+    /**
+     * Set the header name
+     * 
+     * @param headerName String which represent the header name
+     */
+    public void setHeaderName(String headerName) {
+       this.headerName = headerName;
+    }
+    
+    /**
+     * Set the header value
+     * 
+     * @param headerValue String wich represetn the header value
+     */
+    public void setHeaderValue(String headerValue) {
+       this.headerValue = headerValue;
     }
 
     /**

Modified: 
james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java?rev=406587&r1=406586&r2=406587&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java 
(original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/MailCmdHandler.java 
Mon May 15 01:44:16 2006
@@ -55,7 +55,7 @@
     public void configure(Configuration handlerConfiguration) throws 
ConfigurationException {
         Configuration configuration = 
handlerConfiguration.getChild("checkValidSenderDomain",false);
         if(configuration != null) {
-           checkValidSenderDomain = configuration.getValueAsBoolean();
+           setCheckValidSenderDomain(configuration.getValueAsBoolean(false));
            if (checkValidSenderDomain && dnsServer == null) {
                throw new ConfigurationException("checkValidSenderDomain 
enabled but no DNSServer service provided to SMTPServer");
            }
@@ -63,7 +63,7 @@
         
         Configuration configRelay = 
handlerConfiguration.getChild("checkAuthClients",false);
         if(configRelay != null) {
-            checkAuthClients = configRelay.getValueAsBoolean();
+            setCheckAuthClients(configRelay.getValueAsBoolean(false));
         }
     }
     
@@ -71,7 +71,34 @@
      * @see 
org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
      */
     public void service(ServiceManager serviceMan) throws ServiceException {
-        dnsServer = (DNSServer) serviceMan.lookup(DNSServer.ROLE);
+        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
+    }
+    
+    /**
+     * Set the DnsServer
+     * 
+     * @param dnsServer The DnsServer
+     */
+    public void setDnsServer(DNSServer dnsServer) {
+       this.dnsServer = dnsServer;
+    }
+    
+    /**
+     * Enable checkvalidsenderdomain feature
+     * 
+     * @param checkValidSenderDomain Set to true to enable
+     */
+    public void setCheckValidSenderDomain(boolean checkValidSenderDomain) {
+       this.checkValidSenderDomain = checkValidSenderDomain;
+    }
+    
+    /**
+     * Enable checking of authorized clients
+     * 
+     * @param checkAuthClients Set to true to enable
+     */
+    public void setCheckAuthClients(boolean checkAuthClients) {
+       this.checkAuthClients = checkAuthClients;
     }
     
     /**

Modified: 
james/server/trunk/src/java/org/apache/james/smtpserver/RcptCmdHandler.java
URL: 
http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/smtpserver/RcptCmdHandler.java?rev=406587&r1=406586&r2=406587&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/RcptCmdHandler.java 
(original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/RcptCmdHandler.java 
Mon May 15 01:44:16 2006
@@ -49,19 +49,48 @@
     public void configure(Configuration handlerConfiguration) throws 
ConfigurationException {
         Configuration configuration = 
handlerConfiguration.getChild("maxRcpt",false);
         if(configuration != null) {
-           maxRcpt = configuration.getValueAsInteger();
+           setMaxRcpt(configuration.getValueAsInteger(0));
         }
         
         Configuration configTarpitRcptCount = 
handlerConfiguration.getChild("tarpitRcptCount",false);
         if(configTarpitRcptCount != null) {
-           tarpitRcptCount = configTarpitRcptCount.getValueAsInteger();
+           setTarpitRcptCount(configTarpitRcptCount.getValueAsInteger(0));
         }
         
         Configuration configTarpitSleepTime = 
handlerConfiguration.getChild("tarpitSleepTime",false);
         if(configTarpitSleepTime != null) {
-           tarpitSleepTime = configTarpitSleepTime.getValueAsLong();
+           setTarpitSleepTime(configTarpitSleepTime.getValueAsLong(5000));
         }
     }
+    
+    /**
+     * Set the max rcpt for wich should be accepted
+     *  
+     * @param maxRcpt The max rcpt count
+     */
+    public void setMaxRcpt(int maxRcpt) {
+       this.maxRcpt = maxRcpt;
+    }
+    
+    /**
+     * Set the tarpit count after which the tarpit sleep time will be activated
+     * 
+     * @param tarpitRcptCount
+     */
+    public void setTarpitRcptCount(int tarpitRcptCount) {
+       this.tarpitRcptCount = tarpitRcptCount;
+    }
+    
+    /**
+     * Set the tarpit sleep time 
+     * 
+     * @param tarpitSleepTime Time in milliseconds
+     */
+    public void setTarpitSleepTime(long tarpitSleepTime) {
+       this.tarpitSleepTime = tarpitSleepTime;
+    }
+    
+    
     
     /*
      * handles RCPT command



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to