james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r420818 - in /james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver: ./ basefilter/ fastfailfilter/
Date Tue, 11 Jul 2006 12:25:38 GMT
Author: norman
Date: Tue Jul 11 05:25:36 2006
New Revision: 420818

URL: http://svn.apache.org/viewvc?rev=420818&view=rev
Log:
Revert replacing interfaces with abstract classes.

Added:
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/CommandHandler.java
      - copied unchanged from r419170, james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/CommandHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/ConnectHandler.java
      - copied unchanged from r419229, james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/ConnectHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MessageHandler.java
      - copied unchanged from r419229, james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MessageHandler.java
Removed:
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractConnectHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractGeneralHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractMessageHandler.java
Modified:
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractCommandHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AuthCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DNSRBLHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DataCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/ExpnCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HelpCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/NoopCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/QuitCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RsetCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPSession.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SendMailHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SetMimeHeaderHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/UnknownCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/VrfyCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/DataBaseFilterCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/HeloBaseFilterCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/MailBaseFilterCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/RcptBaseFilterCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/MaxRcptHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ResolvableEhloHeloHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ReverseEqualsEhloHeloHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/TarpitHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ValidSenderDomainHandler.java

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractCommandHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractCommandHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractCommandHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AbstractCommandHandler.java Tue Jul 11 05:25:36 2006
@@ -19,14 +19,38 @@
 
 import java.util.List;
 
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 /**
  * Custom CommandHandlers must extend this class.
  */
-public abstract class AbstractCommandHandler extends AbstractGeneralHandler {
+public abstract class AbstractCommandHandler extends AbstractLogEnabled {
 
     /**
+     * If set to true all handler processing is stopped (fastfail)
+     */
+    private boolean stopHandlerProcessing = false;
+    
+    
+    /**
+     * Method to set if a after the handler no other command handlers should processed
+     * @param stopHandlerProcessing true or false
+     */
+    public void setStopHandlerProcessing(boolean stopHandlerProcessing) {
+        this.stopHandlerProcessing = stopHandlerProcessing;
+    }
+    
+    /**
+     * Return if the processing of other commandHandlers should be done
+     * @return true or false
+     */
+    public boolean stopHandlerProcessing() {
+        return stopHandlerProcessing;
+    }
+    
+    /**
      * Handle the command
-     **/
+    **/
     public abstract void onCommand(SMTPSession session);
 
     /**
@@ -35,5 +59,5 @@
      * @return List which contains implemented commands
      */
     public abstract List getImplCommands();
-
+    
 }

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AuthCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AuthCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AuthCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/AuthCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -17,21 +17,23 @@
 
 package org.apache.james.smtpserver;
 
-import java.io.IOException;
+import org.apache.james.util.mail.dsn.DSNStatus;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.StringTokenizer;
-
 import org.apache.james.util.Base64;
-import org.apache.james.util.mail.dsn.DSNStatus;
+import java.io.IOException;
 
 
 /**
   * handles AUTH command
   */
 public class AuthCmdHandler
-    extends AbstractCommandHandler {
+    extends AbstractLogEnabled
+    implements CommandHandler {
 
     /**
      * The text string for the SMTP AUTH type PLAIN.

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DNSRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DNSRBLHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DNSRBLHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DNSRBLHandler.java Tue Jul 11 05:25:36 2006
@@ -17,25 +17,33 @@
 
 package org.apache.james.smtpserver;
 
-import java.net.Socket;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.james.services.DNSServer;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.StringTokenizer;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-
 /**
   * Connect handler for DNSRBL processing
   */
 public class DNSRBLHandler
-    extends AbstractConnectHandler {
+    extends AbstractLogEnabled
+    implements ConnectHandler, Configurable, Serviceable {
     /**
      * The lists of rbl servers to be checked to limit spam
      */
     private String[] whitelist;
     private String[] blacklist;
     
+    private DNSServer dnsServer = null;
+    
     private boolean getDetail = false;
 
     /**
@@ -83,6 +91,12 @@
 
     }
 
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
+     */
+    public void service(ServiceManager serviceMan) throws ServiceException {
+        setDNSServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
+    }
     
     /*
      * check if the remote Ip address is block listed
@@ -112,6 +126,14 @@
         this.blacklist = blacklist;
     }
     
+    /**
+     * Set the DNSServer
+     * 
+     * @param dnsServer The DNSServer
+     */
+    public void setDNSServer(DNSServer dnsServer) {
+        this.dnsServer = dnsServer;
+    }
 
     /**
      * Set for try to get a TXT record for the blocked record. 
@@ -154,7 +176,7 @@
             if (whitelist != null) {
                 String[] rblList = whitelist;
                 for (int i = 0 ; i < rblList.length ; i++) try {
-                    getDnsServer().getByName(reversedOctets + rblList[i]);
+                    dnsServer.getByName(reversedOctets + rblList[i]);
                     if (getLogger().isInfoEnabled()) {
                         getLogger().info("Connection from " + ipAddress + " whitelisted by " + rblList[i]);
                     }
@@ -169,14 +191,14 @@
             if (blacklist != null) {
                 String[] rblList = blacklist;
                 for (int i = 0 ; i < rblList.length ; i++) try {
-                    getDnsServer().getByName(reversedOctets + rblList[i]);
+                    dnsServer.getByName(reversedOctets + rblList[i]);
                     if (getLogger().isInfoEnabled()) {
                         getLogger().info("Connection from " + ipAddress + " restricted by " + rblList[i] + " to SMTP AUTH/postmaster/abuse.");
                     }
                     
                     // we should try to retrieve details
                     if (getDetail) {
-                        Collection txt = getDnsServer().findTXTRecords(reversedOctets + rblList[i]);
+                        Collection txt = dnsServer.findTXTRecords(reversedOctets + rblList[i]);
                         
                         // Check if we found a txt record
                         if (!txt.isEmpty()) {

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DataCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DataCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DataCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/DataCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -17,19 +17,7 @@
 
 package org.apache.james.smtpserver;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.SequenceInputStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.mail.MessagingException;
-
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.james.Constants;
 import org.apache.james.core.MailHeaders;
 import org.apache.james.core.MailImpl;
@@ -42,12 +30,26 @@
 import org.apache.mailet.RFC2822Headers;
 import org.apache.mailet.dates.RFC822DateFormat;
 
+import javax.mail.MessagingException;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.SequenceInputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.List;
+
 
 /**
   * handles DATA command
  */
 public class DataCmdHandler
-    extends AbstractCommandHandler {
+    extends AbstractLogEnabled
+    implements CommandHandler {
 
     private final static String SOFTWARE_TYPE = "JAMES SMTP Server "
                                                  + Constants.SOFTWARE_VERSION;

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -20,10 +20,13 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 /**
  * Handles EHLO command
  */
-public class EhloCmdHandler extends AbstractCommandHandler {
+public class EhloCmdHandler extends AbstractLogEnabled implements
+        CommandHandler {
 
     /**
      * The name of the command handled by the command handler

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/ExpnCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/ExpnCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/ExpnCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/ExpnCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -25,7 +25,7 @@
 /**
   * Handles EXPN command
   */
-public class ExpnCmdHandler extends AbstractCommandHandler {
+public class ExpnCmdHandler implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -21,11 +21,13 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+
 
 /**
   * Handles HELO command
   */
-public class HeloCmdHandler extends AbstractCommandHandler {
+public class HeloCmdHandler extends AbstractLogEnabled implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HelpCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HelpCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HelpCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HelpCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -25,7 +25,7 @@
 /**
   * Handles HELP command
   */
-public class HelpCmdHandler extends AbstractCommandHandler {
+public class HelpCmdHandler implements CommandHandler {
     /**
      * The name of the command handled by the command handler
      */

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.james.util.mail.dsn.DSNStatus;
 import org.apache.mailet.MailAddress;
 
@@ -27,7 +28,8 @@
   * Handles MAIL command
   */
 public class MailCmdHandler
-    extends AbstractCommandHandler{
+    extends AbstractLogEnabled
+    implements CommandHandler {
 
     
     /**

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/NoopCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/NoopCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/NoopCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/NoopCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -25,7 +25,7 @@
 /**
   * Handles NOOP command
   */
-public class NoopCmdHandler extends AbstractCommandHandler {
+public class NoopCmdHandler implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/QuitCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/QuitCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/QuitCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/QuitCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -25,7 +25,7 @@
 /**
   * Handles QUIT command
   */
-public class QuitCmdHandler extends AbstractCommandHandler {
+public class QuitCmdHandler implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -21,13 +21,15 @@
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.james.util.mail.dsn.DSNStatus;
 import org.apache.mailet.MailAddress;
 
 /**
   * Handles RCPT command
   */
-public class RcptCmdHandler extends AbstractCommandHandler {
+public class RcptCmdHandler extends AbstractLogEnabled implements
+        CommandHandler {
 
     /**
      * handles RCPT command

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RsetCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RsetCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RsetCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RsetCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -25,7 +25,7 @@
 /**
   * Handles RSET command
   */
-public class RsetCmdHandler extends AbstractCommandHandler {
+public class RsetCmdHandler implements CommandHandler {
     /**
      * The name of the command handled by the command handler
      */

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java Tue Jul 11 05:25:36 2006
@@ -158,6 +158,8 @@
      * The per-handler response buffer used to marshal responses.
      */
     private StringBuffer responseBuffer = new StringBuffer(256);
+    
+    private boolean stopHandlerProcessing = false;
 
     /**
      * Set the configuration data for the handler
@@ -232,12 +234,8 @@
         if(connectHandlers != null) {
             int count = connectHandlers.size();
             for(int i = 0; i < count; i++) {
-                AbstractConnectHandler aHandler = (AbstractConnectHandler)connectHandlers.get(i);
-                aHandler.setStopHandlerProcessing(false);
-                aHandler.onConnect(this);
-                boolean stopHandlerProcessing = aHandler.stopHandlerProcessing();
-
-                if(sessionEnded || stopHandlerProcessing) {
+                ((ConnectHandler)connectHandlers.get(i)).onConnect(this);
+                if(sessionEnded) {
                     break;
                 }
             }
@@ -272,15 +270,13 @@
           } else {
               int count = commandHandlers.size();
               for(int i = 0; i < count; i++) {
-                  AbstractCommandHandler aHandler = (AbstractCommandHandler)commandHandlers.get(i);
-                  aHandler.setStopHandlerProcessing(false);
-                  aHandler.onCommand(this);
-                  boolean stopHandlerProcessing = aHandler.stopHandlerProcessing();
+                  setStopHandlerProcessing(false);
+                  ((CommandHandler)commandHandlers.get(i)).onCommand(this);
                   
                   theWatchdog.reset();
                   
                   //if the response is received, stop processing of command handlers
-                  if(mode != COMMAND_MODE || stopHandlerProcessing) {
+                  if(mode != COMMAND_MODE || getStopHandlerProcessing()) {
                       break;
                   }
               }
@@ -293,13 +289,9 @@
               List messageHandlers = handlerChain.getMessageHandlers();
               int count = messageHandlers.size();
               for(int i =0; i < count; i++) {
-                  AbstractMessageHandler aHandler = (AbstractMessageHandler)messageHandlers.get(i);
-                  aHandler.setStopHandlerProcessing(false);
-                  aHandler.onMessage(this);
-                  boolean stopHandlerProcessing = aHandler.stopHandlerProcessing();
-
+                  ((MessageHandler)messageHandlers.get(i)).onMessage(this);
                   //if the response is received, stop processing of command handlers
-                  if(mode == MESSAGE_ABORT_MODE || stopHandlerProcessing) {
+                  if(mode == MESSAGE_ABORT_MODE) {
                       break;
                   }
               }
@@ -579,4 +571,19 @@
 
         return count;
     }
+    
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#setStopHandlerProcessing(boolean)
+     */
+    public void setStopHandlerProcessing(boolean stopHandlerProcessing) {
+        this.stopHandlerProcessing = stopHandlerProcessing;
+    }
+    
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getStopHandlerProcessing()
+     */
+    public boolean getStopHandlerProcessing() {
+        return stopHandlerProcessing;
+    }
+
 }

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java Tue Jul 11 05:25:36 2006
@@ -52,7 +52,7 @@
     private ArrayList messageHandlers = new ArrayList();
     private ArrayList connectHandlers = new ArrayList();
 
-    private final AbstractCommandHandler unknownHandler = new UnknownCmdHandler();
+    private final CommandHandler unknownHandler = new UnknownCmdHandler();
     private ServiceManager serviceManager;
     private Context context;
     
@@ -212,8 +212,8 @@
             ContainerUtil.configure(handler, config);
 
             // if it is a connect handler add it to list of connect handlers
-            if (handler instanceof AbstractConnectHandler) {
-                connectHandlers.add((AbstractConnectHandler) handler);
+            if (handler instanceof ConnectHandler) {
+                connectHandlers.add((ConnectHandler) handler);
                 if (getLogger().isInfoEnabled()) {
                     getLogger().info("Added ConnectHandler: " + className);
                 }
@@ -242,17 +242,17 @@
 
             // if it is a command handler add it to the map with key as command
             // name
-            if (handler instanceof AbstractCommandHandler) {
+            if (handler instanceof CommandHandler) {
                 String commandName = config.getAttribute("command");
                 String cmds[] = commandName.split(",");
-                List implCmds = ((AbstractCommandHandler) handler).getImplCommands();
+                List implCmds = ((CommandHandler) handler).getImplCommands();
 
                 for (int i = 0; i < cmds.length; i++) {
                     commandName = cmds[i].trim().toUpperCase(Locale.US);
 
                     // Check if the commandHandler implement the configured command
                     if (implCmds.contains(commandName)) {
-                        addToMap(commandName, (AbstractCommandHandler) handler);
+                        addToMap(commandName, (CommandHandler) handler);
                         if (getLogger().isInfoEnabled()) {
                             getLogger().info(
                                     "Added Commandhandler: " + className);
@@ -269,8 +269,8 @@
             }
 
             // if it is a message handler add it to list of message handlers
-            if (handler instanceof AbstractMessageHandler) {
-                messageHandlers.add((AbstractMessageHandler) handler);
+            if (handler instanceof MessageHandler) {
+                messageHandlers.add((MessageHandler) handler);
                 if (getLogger().isInfoEnabled()) {
                     getLogger().info("Added MessageHandler: " + className);
                 }
@@ -333,7 +333,7 @@
      * @param commandName the command name which will be key
      * @param cmdHandler The commandhandler object
      */
-    private void addToMap(String commandName, AbstractCommandHandler cmdHandler) {
+    private void addToMap(String commandName, CommandHandler cmdHandler) {
         ArrayList handlers = (ArrayList)commandHandlerMap.get(commandName);
         if(handlers == null) {
             handlers = new ArrayList();

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPSession.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPSession.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPSession.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPSession.java Tue Jul 11 05:25:36 2006
@@ -241,5 +241,10 @@
      * @return recipient count
      */
     int getRcptCount();
+
+    void setStopHandlerProcessing(boolean b);
+    
+    boolean getStopHandlerProcessing();
+
 }
 

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SendMailHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SendMailHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SendMailHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SendMailHandler.java Tue Jul 11 05:25:36 2006
@@ -34,7 +34,8 @@
   * Adds the header to the message
   */
 public class SendMailHandler
-    extends AbstractMessageHandler {
+    extends AbstractLogEnabled
+    implements MessageHandler, Serviceable {
 
     private MailServer mailServer;
 
@@ -42,8 +43,6 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager serviceManager) throws ServiceException {
-        
-        //TODO: Maybe we should move this to AbstractGeneralHandler
         mailServer = (MailServer) serviceManager.lookup(MailServer.ROLE);
     }
 

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SetMimeHeaderHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SetMimeHeaderHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SetMimeHeaderHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SetMimeHeaderHandler.java Tue Jul 11 05:25:36 2006
@@ -28,7 +28,8 @@
   * Adds the header to the message
   */
 public class SetMimeHeaderHandler
-    extends AbstractMessageHandler {
+    extends AbstractLogEnabled
+    implements MessageHandler, Configurable {
 
     /**
      * The header name and value that needs to be added

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/UnknownCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/UnknownCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/UnknownCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/UnknownCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -25,7 +25,7 @@
 /**
   * Default command handler for handling unknown commands
   */
-public class UnknownCmdHandler extends AbstractCommandHandler {
+public class UnknownCmdHandler implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/VrfyCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/VrfyCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/VrfyCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/VrfyCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -25,9 +25,10 @@
 /**
   * Command handler for handling VRFY command
   */
-public class VrfyCmdHandler extends AbstractCommandHandler {
+public class VrfyCmdHandler implements CommandHandler {
 
     private final String COMMAND_NAME = "VRFY";
+    private boolean stopHandlerProcessing = true;
 
     /**
      * Handler method called upon receipt of a VRFY command.
@@ -50,4 +51,12 @@
         
         return implCommands;
     }
+
+    /**
+     * @see org.apache.james.smtpserver.CommandHandler#stopHandlerProcessing()
+     */
+    public boolean stopHandlerProcessing() {
+        return stopHandlerProcessing ;
+    }
+
 }

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/DataBaseFilterCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/DataBaseFilterCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/DataBaseFilterCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/DataBaseFilterCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -20,7 +20,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 
@@ -29,7 +30,8 @@
   * handles DATA command
  */
 public class DataBaseFilterCmdHandler
-    extends AbstractCommandHandler {
+    extends AbstractLogEnabled
+    implements CommandHandler {
 
     /**
      * process DATA command
@@ -58,14 +60,14 @@
             session.writeResponse(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
         } else if (!session.getState().containsKey(SMTPSession.RCPT_LIST)) {
             responseString = "503 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_OTHER)+" No recipients specified";
             session.writeResponse(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
         }
     }
     

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -20,14 +20,15 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 
 /**
   * Handles EHLO command
   */
-public class EhloBaseFilterCmdHandler extends AbstractCommandHandler {
+public class EhloBaseFilterCmdHandler extends AbstractLogEnabled implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler
@@ -55,7 +56,7 @@
             session.writeResponse(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
         }
     }
     

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/HeloBaseFilterCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/HeloBaseFilterCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/HeloBaseFilterCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/HeloBaseFilterCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -21,14 +21,15 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 
 
 /**
   * Handles HELO command
   */
-public class HeloBaseFilterCmdHandler extends AbstractCommandHandler {
+public class HeloBaseFilterCmdHandler extends AbstractLogEnabled implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler
@@ -57,7 +58,7 @@
             getLogger().info(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
          
         }
     }

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/MailBaseFilterCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/MailBaseFilterCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/MailBaseFilterCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/MailBaseFilterCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -22,7 +22,8 @@
 import java.util.Locale;
 import java.util.StringTokenizer;
 
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 import org.apache.mailet.MailAddress;
@@ -31,7 +32,8 @@
   * Handles MAIL command
   */
 public class MailBaseFilterCmdHandler
-    extends AbstractCommandHandler {
+    extends AbstractLogEnabled
+    implements CommandHandler {
 
     private final static String MAIL_OPTION_SIZE = "SIZE";
 
@@ -65,14 +67,14 @@
             session.writeResponse(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
         } else if (!session.getState().containsKey(SMTPSession.CURRENT_HELO_MODE) && session.useHeloEhloEnforcement()) {
             responseString = "503 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_OTHER)+" Need HELO or EHLO before MAIL";
             session.writeResponse(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
         } else if (argument == null || !argument.toUpperCase(Locale.US).equals("FROM")
                    || sender == null) {
@@ -80,7 +82,7 @@
             session.writeResponse(responseString);
         
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
         } else {
             sender = sender.trim();
@@ -137,7 +139,7 @@
                     getLogger().error(errorBuffer.toString());
                 }
                 // After this filter match we should not call any other handler!
-                setStopHandlerProcessing(true);
+                session.setStopHandlerProcessing(true);
                 
                 return;
             }
@@ -168,7 +170,7 @@
                     }
                     
                     // After this filter match we should not call any other handler!
-                    setStopHandlerProcessing(true);
+                    session.setStopHandlerProcessing(true);
                     
                     return;
                 }
@@ -198,7 +200,7 @@
             getLogger().error("Rejected syntactically incorrect value for SIZE parameter.");
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
             return false;
         }
@@ -231,7 +233,7 @@
             getLogger().error(errorBuffer.toString());
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
             return false;
         } else {

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/RcptBaseFilterCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/RcptBaseFilterCmdHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/RcptBaseFilterCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/RcptBaseFilterCmdHandler.java Tue Jul 11 05:25:36 2006
@@ -23,7 +23,8 @@
 import java.util.Locale;
 import java.util.StringTokenizer;
 
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 import org.apache.mailet.MailAddress;
@@ -31,7 +32,8 @@
 /**
   * Handles RCPT command
   */
-public class RcptBaseFilterCmdHandler extends AbstractCommandHandler {
+public class RcptBaseFilterCmdHandler extends AbstractLogEnabled implements
+        CommandHandler {
 
 
     /**
@@ -62,7 +64,7 @@
             session.writeResponse(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
         } else if (argument == null || !argument.toUpperCase(Locale.US).equals("TO")
                    || recipient == null) {
@@ -70,7 +72,7 @@
             session.writeResponse(responseString);
             
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
             
         } else {
             Collection rcptColl = (Collection) session.getState().get(SMTPSession.RCPT_LIST);
@@ -101,7 +103,7 @@
                 }
                 
                 // After this filter match we should not call any other handler!
-                setStopHandlerProcessing(true);
+                session.setStopHandlerProcessing(true);
                 
                 return;
             }
@@ -133,7 +135,7 @@
                 }
                 
                 // After this filter match we should not call any other handler!
-                setStopHandlerProcessing(true);
+                session.setStopHandlerProcessing(true);
                 
                 return;
             }
@@ -151,7 +153,7 @@
                 session.writeResponse(responseString);
                 
                 // After this filter match we should not call any other handler!
-                setStopHandlerProcessing(true);
+                session.setStopHandlerProcessing(true);
                 
                 return;
             }
@@ -170,7 +172,7 @@
                         getLogger().error(sb.toString());
                         
                         // After this filter match we should not call any other handler!
-                        setStopHandlerProcessing(true);
+                        session.setStopHandlerProcessing(true);
                         
                         return;
                     }
@@ -196,7 +198,7 @@
                             }
                             
                             // After this filter match we should not call any other handler!
-                            setStopHandlerProcessing(true);
+                            session.setStopHandlerProcessing(true);
                             
                             return;
                         }
@@ -216,7 +218,7 @@
                     getLogger().error(errorBuffer.toString());
                     
                     // After this filter match we should not call any other handler!
-                    setStopHandlerProcessing(true);
+                    session.setStopHandlerProcessing(true);
                     
                     return;
                 }
@@ -246,7 +248,7 @@
                   }
                   
                   // After this filter match we should not call any other handler!
-                  setStopHandlerProcessing(true);
+                  session.setStopHandlerProcessing(true);
                   
               }
               optionTokenizer = null;

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/MaxRcptHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/MaxRcptHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/MaxRcptHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/MaxRcptHandler.java Tue Jul 11 05:25:36 2006
@@ -20,13 +20,16 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 
-public class MaxRcptHandler extends AbstractCommandHandler {
+public class MaxRcptHandler extends AbstractLogEnabled implements
+        CommandHandler, Configurable {
 
     private int maxRcpt = 0;
 
@@ -74,7 +77,7 @@
             getLogger().error(responseString);
 
             // After this filter match we should not call any other handler!
-            setStopHandlerProcessing(true);
+            session.setStopHandlerProcessing(true);
         }
     }
     
@@ -87,4 +90,5 @@
         
         return implCommands;
     }
+
 }

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ResolvableEhloHeloHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ResolvableEhloHeloHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ResolvableEhloHeloHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ResolvableEhloHeloHandler.java Tue Jul 11 05:25:36 2006
@@ -17,20 +17,28 @@
 
 package org.apache.james.smtpserver.fastfailfilter;
 
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.DNSServer;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 
-public class ResolvableEhloHeloHandler extends AbstractCommandHandler {
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ResolvableEhloHeloHandler extends AbstractLogEnabled
+        implements CommandHandler, Configurable, Serviceable {
 
     private boolean checkAuthNetworks = false;
 
+    private DNSServer dnsServer = null;
 
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
@@ -45,6 +53,13 @@
     }
 
     /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
+     */
+    public void service(ServiceManager serviceMan) throws ServiceException {
+        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
+    }
+
+    /**
      * Set to true if AuthNetworks should be included in the EHLO check
      * 
      * @param checkAuthNetworks
@@ -55,6 +70,16 @@
     }
 
     /**
+     * Set the DNSServer
+     * 
+     * @param dnsServer
+     *            The DNSServer
+     */
+    public void setDnsServer(DNSServer dnsServer) {
+        this.dnsServer = dnsServer;
+    }
+
+    /**
      * @see org.apache.james.smtpserver.fastfailfilter.HeloFilterHandler#onEhloCommand(SMTPSession)
      */
     public void onCommand(SMTPSession session) {
@@ -69,7 +94,7 @@
             // try to resolv the provided helo. If it can not resolved do not
             // accept it.
             try {
-                getDnsServer().getByName(argument);
+                dnsServer.getByName(argument);
             } catch (UnknownHostException e) {
                 responseString = "501 "
                         + DSNStatus.getStatus(DSNStatus.PERMANENT,
@@ -80,7 +105,7 @@
                 getLogger().info(responseString);
 
                 // After this filter match we should not call any other handler!
-                setStopHandlerProcessing(true);
+                session.setStopHandlerProcessing(true);
             }
         }
     }

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ReverseEqualsEhloHeloHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ReverseEqualsEhloHeloHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ReverseEqualsEhloHeloHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ReverseEqualsEhloHeloHandler.java Tue Jul 11 05:25:36 2006
@@ -17,20 +17,28 @@
 
 package org.apache.james.smtpserver.fastfailfilter;
 
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.DNSServer;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 
-public class ReverseEqualsEhloHeloHandler extends AbstractCommandHandler {
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ReverseEqualsEhloHeloHandler extends AbstractLogEnabled
+        implements CommandHandler, Configurable, Serviceable {
 
     private boolean checkAuthNetworks = false;
 
+    private DNSServer dnsServer = null;
 
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
@@ -45,6 +53,13 @@
     }
 
     /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
+     */
+    public void service(ServiceManager serviceMan) throws ServiceException {
+        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
+    }
+
+    /**
      * Set to true if AuthNetworks should be included in the EHLO check
      * 
      * @param checkAuthNetworks
@@ -54,6 +69,15 @@
         this.checkAuthNetworks = checkAuthNetworks;
     }
 
+    /**
+     * Set the DNSServer
+     * 
+     * @param dnsServer
+     *            The DNSServer
+     */
+    public void setDnsServer(DNSServer dnsServer) {
+        this.dnsServer = dnsServer;
+    }
 
     /**
      * @see org.apache.james.smtpserver.CommandHandler#onCommand(SMTPSession)
@@ -69,7 +93,7 @@
         if (!session.isRelayingAllowed() || checkAuthNetworks) {
             try {
                 // get reverse entry
-                String reverse = getDnsServer().getByName(
+                String reverse = dnsServer.getByName(
                         session.getRemoteIPAddress()).getHostName();
 
                 if (!argument.equals(reverse)) {
@@ -84,7 +108,7 @@
                     getLogger().info(responseString);
 
                     // After this filter match we should not call any other handler!
-                    setStopHandlerProcessing(true);
+                    session.setStopHandlerProcessing(true);
                 }
             } catch (UnknownHostException e) {
                 responseString = "501 "
@@ -96,7 +120,7 @@
                 getLogger().info(responseString);
 
                 // After this filter match we should not call any other handler!
-                setStopHandlerProcessing(true);
+                session.setStopHandlerProcessing(true);
             }
         }
     }
@@ -113,4 +137,3 @@
     }
 
 }
-

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/TarpitHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/TarpitHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/TarpitHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/TarpitHandler.java Tue Jul 11 05:25:36 2006
@@ -20,12 +20,15 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 
-public class TarpitHandler extends AbstractCommandHandler {
+public class TarpitHandler extends AbstractLogEnabled implements
+        CommandHandler, Configurable {
 
     private int tarpitRcptCount = 0;
 

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ValidSenderDomainHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ValidSenderDomainHandler.java?rev=420818&r1=420817&r2=420818&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ValidSenderDomainHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/fastfailfilter/ValidSenderDomainHandler.java Tue Jul 11 05:25:36 2006
@@ -21,18 +21,27 @@
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.james.smtpserver.AbstractCommandHandler;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.james.services.DNSServer;
+import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.util.mail.dsn.DSNStatus;
 import org.apache.mailet.MailAddress;
 
 public class ValidSenderDomainHandler
-    extends AbstractCommandHandler {
+    extends AbstractLogEnabled
+    implements CommandHandler, Configurable, Serviceable {
     
     private boolean checkAuthClients = false;
     
+    private DNSServer dnsServer = null;
+    
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
      */
@@ -43,7 +52,22 @@
             setCheckAuthClients(configRelay.getValueAsBoolean(false));
         }
     }
-
+    
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
+     */
+    public void service(ServiceManager serviceMan) throws ServiceException {
+        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
+    }
+    
+    /**
+     * Set the DnsServer
+     * 
+     * @param dnsServer The DnsServer
+     */
+    public void setDnsServer(DNSServer dnsServer) {
+        this.dnsServer = dnsServer;
+    }
     
     /**
      * Enable checking of authorized clients
@@ -73,14 +97,14 @@
         
             
             // try to resolv the provided domain in the senderaddress. If it can not resolved do not accept it.
-            records = getDnsServer().findMXRecords(senderAddress.getHost());
+            records = dnsServer.findMXRecords(senderAddress.getHost());
             if (records == null || records.size() == 0) {
                 responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.ADDRESS_SYNTAX_SENDER)+ " sender " + senderAddress + " contains a domain with no valid MX records";
                 session.writeResponse(responseString);
                 getLogger().info(responseString);
                 
                 // After this filter match we should not call any other handler!
-                setStopHandlerProcessing(true);
+                session.setStopHandlerProcessing(true);
             }
         }
     }



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