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/11/18 13:23:20 UTC

svn commit: r476503 - /james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/

Author: norman
Date: Sat Nov 18 04:23:18 2006
New Revision: 476503

URL: http://svn.apache.org/viewvc?view=rev&rev=476503
Log:
Refactor the AbstractJunkHandler stuff to use a JunkHandlerData object to store and retrieve all needed stuff. See JAMES-614

Added:
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/JunkHandlerData.java   (with props)
Modified:
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/AbstractJunkHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/MaxRcptHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java
    james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/AbstractJunkHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/AbstractJunkHandler.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/AbstractJunkHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/AbstractJunkHandler.java Sat Nov 18 04:23:18 2006
@@ -100,14 +100,14 @@
     protected void doProcessing(SMTPSession session) {
         if (check(session)) {
             if (getAction().equals(JunkScoreConfigUtil.JUNKSCORE)) {
-                getLogger().info(getJunkScoreLogString(session));
+                getLogger().info(getJunkHandlerData(session).getJunkScoreLogString());
                 JunkScore junk = getJunkScore(session);
-                junk.setStoredScore(getScoreName(), getScore());
+                junk.setStoredScore(getJunkHandlerData(session).getScoreName(), getScore());
                  
             } else {
-                String response = getResponseString(session);
+                String response = getJunkHandlerData(session).getRejectResponseString();
                 
-                if (getRejectLogString(session) != null) getLogger().info(getRejectLogString(session));
+                if (getJunkHandlerData(session).getRejectLogString() != null) getLogger().info(getJunkHandlerData(session).getRejectLogString());
                 
                 session.writeResponse(response);
                 // After this filter match we should not call any other handler!
@@ -125,35 +125,13 @@
     protected abstract boolean check(SMTPSession session);
     
     /**
-     * Get the reponseString to return 
+     * Get the JunkHandlerData to work with
      * 
      * @param session the SMTPSession
-     * @return responseString
+     * @return junkHandlerData
      */
-    protected abstract String getResponseString(SMTPSession session);
-    
-    /**
-     * Return the LogString if a JunkScore action is used
-     * 
-     * @param session the SMTPSession
-     * @return the LogString
-     */
-    protected abstract String getJunkScoreLogString(SMTPSession session);
-    
-    /**
-     * Return the LogString if a Reject action is used
-     * 
-     * @param the SMTPSession
-     * @return the LogString
-     */
-    protected abstract String getRejectLogString(SMTPSession session);
-    
-    /**
-     * Return the Name which will used to store the JunkScore and get used in the headers
-     * @return the name
-     */
-    protected abstract String getScoreName();
-    
+    public abstract JunkHandlerData getJunkHandlerData(SMTPSession session);
+   
     /**
      * Return the JunkScore object.
      * 

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java Sat Nov 18 04:23:18 2006
@@ -281,44 +281,22 @@
     }
     
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScoreLogString(org.apache.james.smtpserver.SMTPSession)
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
      */
-    protected String getJunkScoreLogString(SMTPSession session) {
-        return "Ipaddress " + session.getRemoteIPAddress() + " listed on RBL. Add junkScore: " + getScore();
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getRejectLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getRejectLogString(SMTPSession session) {
-        return "ipaddress " + session.getRemoteIPAddress() + " listed on RBL. Reject email";
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getResponseString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getResponseString(SMTPSession session) {
-        String responseString;
+    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
+        JunkHandlerData data = new JunkHandlerData();
+        
+        data.setJunkScoreLogString("Ipaddress " + session.getRemoteIPAddress() + " listed on RBL. Add junkScore: " + getScore());
+        data.setRejectLogString("ipaddress " + session.getRemoteIPAddress() + " listed on RBL. Reject email");
+    
         if (blocklistedDetail != null) {
-            responseString = "530 "
-                    + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                            DSNStatus.SECURITY_AUTH) + " "
-                    + blocklistedDetail;
+            data.setRejectResponseString("530 "+ DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SECURITY_AUTH) + " " + blocklistedDetail);
         } else {
-            responseString = "530 "
-                    + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                            DSNStatus.SECURITY_AUTH)
-                    + " Rejected: unauthenticated e-mail from "
-                    + session.getRemoteIPAddress()
-                    + " is restricted.  Contact the postmaster for details.";
+            data.setRejectResponseString("530 "+ DSNStatus.getStatus(DSNStatus.PERMANENT,
+                            DSNStatus.SECURITY_AUTH)  + " Rejected: unauthenticated e-mail from " + session.getRemoteIPAddress() 
+                            + " is restricted.  Contact the postmaster for details.");
         }
-        return responseString;
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getScoreName()
-     */
-    protected String getScoreName() {
-        return "DNSRBLCheck";
+        data.setScoreName("DNSRBLCheck");
+        return data;
     }
 }

Added: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/JunkHandlerData.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/JunkHandlerData.java?view=auto&rev=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/JunkHandlerData.java (added)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/JunkHandlerData.java Sat Nov 18 04:23:18 2006
@@ -0,0 +1,108 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+
+
+package org.apache.james.smtpserver.core.filter.fastfail;
+
+import org.apache.james.util.mail.dsn.DSNStatus;
+
+public class JunkHandlerData {
+    
+    private String rejectLogString = "Bad email. Reject email";
+    private String rejectResponseString = "554 " + DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SECURITY_OTHER) + " " + rejectLogString;
+    private String junkScoreLogString = "Bad email. Add JunkScore";
+    private String scoreName = "JunkHandler";
+    
+    /**
+     * The ResponseString which get returned in SMTP transaction if the email get rejected
+     * 
+     * @param rejectResponseString the responseString
+     */
+    public void setRejectResponseString(String rejectResponseString) {
+        this.rejectResponseString = rejectResponseString;
+    }
+    
+    /**
+     * Set the logString which will be used on junkScore action
+     * 
+     * @param junkScoreLogString the logString
+     */
+    public void setJunkScoreLogString(String junkScoreLogString) {
+        this.junkScoreLogString = junkScoreLogString;
+    }
+    
+    /**
+     * Set the logString which will be used on reject action
+     * 
+     * @param rejectLogString the logString
+     */
+    public void setRejectLogString(String rejectLogString) {
+        this.rejectLogString = rejectLogString;
+    }
+    
+    /**
+     * The the keyname which will be used to store the junkScore
+     * 
+     * @param scoreName the name
+     */
+    public void setScoreName(String scoreName) {
+        this.scoreName = scoreName;
+    }
+    
+    /**
+     * Get the reponseString to return 
+     * 
+     * @param session the SMTPSession
+     * @return rejectResponseString
+     */
+    public String getRejectResponseString() {
+        return rejectResponseString;
+    }
+    
+    /**
+     * Return the LogString if a JunkScore action is used
+     * 
+     * @param session the SMTPSession
+     * @return the LogString
+     */
+    public String getJunkScoreLogString() {
+        return junkScoreLogString;
+    }
+    
+    /**
+     * Return the LogString if a Reject action is used
+     * 
+     * @param the SMTPSession
+     * @return the LogString
+     */
+    public String getRejectLogString() {
+        return rejectLogString;
+    }
+    
+    /**
+     * Return the Name which will used to store the JunkScore and get used in the headers
+     * 
+     * @return the name
+     */
+    protected String getScoreName() {
+        return scoreName;
+    }
+
+}

Propchange: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/JunkHandlerData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/MaxRcptHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/MaxRcptHandler.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/MaxRcptHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/MaxRcptHandler.java Sat Nov 18 04:23:18 2006
@@ -29,7 +29,7 @@
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.james.smtpserver.CommandHandler;
 import org.apache.james.smtpserver.SMTPSession;
-import org.apache.james.util.junkscore.JunkScore;
+
 import org.apache.james.util.mail.dsn.DSNStatus;
 
 public class MaxRcptHandler extends AbstractJunkHandler implements
@@ -90,34 +90,16 @@
     }
 
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScoreLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getJunkScoreLogString(SMTPSession session) {
-        return "Maximum recipients of " + maxRcpt + " reached. Add JunkScore: " +getScore();
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getRejectLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getRejectLogString(SMTPSession session) {
-        return getResponseString(session);
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getResponseString(org.apache.james.smtpserver.SMTPSession)
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
      */
-    protected String getResponseString(SMTPSession session) {
-        String responseString = "452 "
-            + DSNStatus.getStatus(DSNStatus.NETWORK,
-                    DSNStatus.DELIVERY_TOO_MANY_REC)
-            + " Requested action not taken: max recipients reached";
-        return responseString;
-    }
+    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
+        JunkHandlerData data = new JunkHandlerData();
     
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getScoreName()
-     */
-    protected String getScoreName() {
-        return "MaxRcptCheck";
+        data.setRejectResponseString("452 "  + DSNStatus.getStatus(DSNStatus.NETWORK, DSNStatus.DELIVERY_TOO_MANY_REC)
+                + " Requested action not taken: max recipients reached");
+        data.setJunkScoreLogString("Maximum recipients of " + maxRcpt + " reached. Add JunkScore: " +getScore());
+        data.setRejectLogString("Maximum recipients of " + maxRcpt + " reached");
+        data.setScoreName("MaxRcptCheck");
+        return data;
     }
 }

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ResolvableEhloHeloHandler.java Sat Nov 18 04:23:18 2006
@@ -179,43 +179,30 @@
         return false;
     }
 
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScoreLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getJunkScoreLogString(SMTPSession session) {
-        return "Provided EHLO/HELO " + session.getState().get(SMTPSession.CURRENT_HELO_NAME) + " can not resolved. Add junkScore: " + getScore();
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getRejectLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getRejectLogString(SMTPSession session) {
-        return getResponseString(session);
-    }
 
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getResponseString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getResponseString(SMTPSession session) {
-        String responseString = "501 "
-            + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                    DSNStatus.DELIVERY_INVALID_ARG)
-            + " Provided EHLO/HELO " + session.getState().get(SMTPSession.CURRENT_HELO_NAME) + " can not resolved";
-        return responseString;
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getScoreName()
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScore(org.apache.james.smtpserver.SMTPSession)
      */
-    protected String getScoreName() {
-        return "ResolvableEhloHeloCheck";
+    protected JunkScore getJunkScore(SMTPSession session) {
+        return (JunkScore) session.getConnectionState().get(JunkScore.JUNK_SCORE_SESSION);
     }
     
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScore(org.apache.james.smtpserver.SMTPSession)
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
      */
-    protected JunkScore getJunkScore(SMTPSession session) {
-        return (JunkScore) session.getConnectionState().get(JunkScore.JUNK_SCORE_SESSION);
+    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
+        JunkHandlerData data = new JunkHandlerData();
+        
+        data.setJunkScoreLogString("Provided EHLO/HELO " + session.getState().get(SMTPSession.CURRENT_HELO_NAME) + " can not resolved. Add junkScore: " + getScore());
+        data.setRejectLogString("501 " + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_ARG)
+                + " Provided EHLO/HELO " + session.getState().get(SMTPSession.CURRENT_HELO_NAME) + " can not resolved");
+    
+        
+        data.setRejectResponseString("501 " + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_ARG)
+                + " Provided EHLO/HELO " + session.getState().get(SMTPSession.CURRENT_HELO_NAME) + " can not resolved");
+
+        data.setScoreName("ResolvableEhloHeloCheck");
+        return data;
     }
 
 }

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/SPFHandler.java Sat Nov 18 04:23:18 2006
@@ -279,60 +279,29 @@
         }
         return false;
     }
-
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScoreLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getJunkScoreLogString(SMTPSession session) {
-        return "Not match SPF-Record. Add junkScore: " + getScore();
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getRejectLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getRejectLogString(SMTPSession session) {
-        return "Not match SPF-Record. Reject email";
-    }
-
+    
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getResponseString(org.apache.james.smtpserver.SMTPSession)
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
      */
-    protected String getResponseString(SMTPSession session) {
+    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
         String blocklisted = (String) session.getState().get(SPF_BLOCKLISTED);
         String blocklistedDetail = (String) session.getState().get(SPF_DETAIL);
-        String tempBlocklisted = (String) session.getState().get(
-                SPF_TEMPBLOCKLISTED);
-        String responseString = null;
-        
-        
+        String tempBlocklisted = (String) session.getState().get(SPF_TEMPBLOCKLISTED);
+        JunkHandlerData data = new JunkHandlerData();
+
         // Check if session is blocklisted
         if (blocklisted != null && blocklisted.equals("true")) {
-            responseString = "530 "
-                    + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                            DSNStatus.SECURITY_AUTH) + " "
-                    + blocklistedDetail;
-            session.writeResponse(responseString);
-
-            session.setStopHandlerProcessing(true);
-
+            data.setRejectResponseString("530 " + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_AUTH) + " "
+                    + blocklistedDetail);
         } else if (tempBlocklisted != null
                 && tempBlocklisted.equals("true")) {
-            responseString = "451 "
-                    + DSNStatus.getStatus(DSNStatus.TRANSIENT,
-                            DSNStatus.NETWORK_DIR_SERVER) + " "
-                    + "Temporarily rejected: Problem on SPF lookup";
-            session.writeResponse(responseString);
-            session.setStopHandlerProcessing(true);
+            data.setRejectResponseString("451 " + DSNStatus.getStatus(DSNStatus.TRANSIENT, DSNStatus.NETWORK_DIR_SERVER) + " "
+                    + "Temporarily rejected: Problem on SPF lookup");
         }
-        return responseString;
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getScoreName()
-     */
-    protected String getScoreName() {
-        return "SPFCheck";
+        data.setJunkScoreLogString("Not match SPF-Record. Add junkScore: " + getScore());
+        data.setRejectLogString("Not match SPF-Record. Reject email");
+        data.setScoreName("SPFCheck");
+        return data;
     }
     
     

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java Sat Nov 18 04:23:18 2006
@@ -256,32 +256,15 @@
     }
 
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScoreLogString(org.apache.james.smtpserver.SMTPSession)
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
      */
-    protected String getJunkScoreLogString(SMTPSession session) {
-        String uRblServer = (String) session.getState().get(URBLSERVER);
-        String target = (String) session.getState().get(LISTED_DOMAIN);
-        return "Message sent by " + session.getRemoteIPAddress() + " restricted by " +  uRblServer + " because " + target + " is listed. Add junkScore: " + getScore();
-    }
+    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
+        JunkHandlerData data = new JunkHandlerData();
     
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getRejectLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getRejectLogString(SMTPSession session) {
-        String uRblServer = (String) session.getState().get(URBLSERVER);
-        String target = (String) session.getState().get(LISTED_DOMAIN);
-        return "Rejected: message contains domain " + target + " listed by " + uRblServer;
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getResponseString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getResponseString(SMTPSession session) {
         String uRblServer = (String) session.getState().get(URBLSERVER);
         String target = (String) session.getState().get(LISTED_DOMAIN);
         String detail = null;
-        String responseString = null;
-    
+
         // we should try to retrieve details
         if (getDetail) {
             Collection txt = dnsServer.findTXTRecords(target+ "." + uRblServer);
@@ -296,23 +279,18 @@
 
         if (detail != null) {
            
-            responseString = "554 "
-                + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
-                + getRejectLogString(session) +" . Details: " 
-                + detail;
+            data.setRejectResponseString("554 " + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
+                + "Rejected: message contains domain " + target + " listed by " + uRblServer +" . Details: " 
+                + detail);
         } else {
-            responseString = "554 "
-                + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
-                + getRejectLogString(session);
+            data.setRejectResponseString("554 " + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
+                + " Rejected: message contains domain " + target + " listed by " + uRblServer);
         }  
-        return responseString;
-    }
 
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getScoreName()
-     */
-    protected String getScoreName() {
-        return "UriRBLCheck";
+        data.setJunkScoreLogString("Message sent by " + session.getRemoteIPAddress() + " restricted by " +  uRblServer + " because " + target + " is listed. Add junkScore: " + getScore());
+        data.setRejectLogString("Rejected: message contains domain " + target + " listed by " + uRblServer);
+        data.setScoreName("UriRBLCheck");
+        return data;
     }
 
 }

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java Sat Nov 18 04:23:18 2006
@@ -162,32 +162,18 @@
     }
 
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScoreLogString(org.apache.james.smtpserver.SMTPSession)
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
      */
-    protected String getJunkScoreLogString(SMTPSession session) {
+    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
         MailAddress rcpt = (MailAddress) session.getState().get(SMTPSession.CURRENT_RECIPIENT);
-        return "Invalid MX " + session.getRemoteIPAddress() + " for domain " + rcpt.getHost() + ". Add JunkScore: " + getScore();
-    }
+        JunkHandlerData data = new JunkHandlerData();
 
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getRejectLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getRejectLogString(SMTPSession session) {
-        MailAddress rcpt = (MailAddress) session.getState().get(SMTPSession.CURRENT_RECIPIENT);
-        return "Invalid MX " + session.getRemoteIPAddress() + " for domain " + rcpt.getHost() + ". Reject email";   
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getResponseString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getResponseString(SMTPSession session) {
-        return "530" + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_AUTH) + " " + getRejectLogString(session) ;   
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getScoreName()
-     */
-    protected String getScoreName() {
-        return "ValidRcptMXCheck";
+        data.setRejectResponseString("530" + DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_AUTH) + " Invalid MX " + session.getRemoteIPAddress() 
+            + " for domain " + rcpt.getHost() + ". Reject email");
+       
+        data.setJunkScoreLogString("Invalid MX " + session.getRemoteIPAddress() + " for domain " + rcpt.getHost() + ". Add JunkScore: " + getScore());
+        data.setRejectLogString("Invalid MX " + session.getRemoteIPAddress() + " for domain " + rcpt.getHost() + ". Reject email");
+        data.setScoreName("ValidRcptMXCheck");
+        return data;
     }
 }

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java?view=diff&rev=476503&r1=476502&r2=476503
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java Sat Nov 18 04:23:18 2006
@@ -124,36 +124,18 @@
         
         return implCommands;
     }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkScoreLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getJunkScoreLogString(SMTPSession session) {
-       MailAddress senderAddress = (MailAddress) session.getState().get(SMTPSession.SENDER);
-        String response = "Sender " + senderAddress + " contains a domain with no valid MX records. Add Junkscore: " + getScore();
-        return response;
-    }
-    
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getRejectLogString(org.apache.james.smtpserver.SMTPSession)
-     */
-    protected String getRejectLogString(SMTPSession session) {
-        return getResponseString(session);
-    }
     
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getResponseString(org.apache.james.smtpserver.SMTPSession)
+     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
      */
-    protected String getResponseString(SMTPSession session) {
+    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
         MailAddress senderAddress = (MailAddress) session.getState().get(SMTPSession.SENDER);
-        String response = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.ADDRESS_SYNTAX_SENDER)+ " sender " + senderAddress + " contains a domain with no valid MX records";
-        return response;
-    }
-
-    /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getScoreName()
-     */
-    protected String getScoreName() {
-        return "ValidSenderDomainCheck";
+        JunkHandlerData data = new JunkHandlerData();
+    
+        data.setRejectResponseString("501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.ADDRESS_SYNTAX_SENDER)+ " sender " + senderAddress + " contains a domain with no valid MX records");
+        data.setJunkScoreLogString("Sender " + senderAddress + " contains a domain with no valid MX records. Add Junkscore: " + getScore());
+        data.setRejectLogString("Sender " + senderAddress + " contains a domain with no valid MX records");
+        data.setScoreName("ValidSenderDomainCheck");
+        return data;
     }
 }



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