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 2009/09/09 13:38:46 UTC

svn commit: r812893 - in /james/server/trunk/smtpserver-function/src: main/java/org/apache/james/smtpserver/core/filter/fastfail/ test/java/org/apache/james/smtpserver/

Author: norman
Date: Wed Sep  9 11:38:45 2009
New Revision: 812893

URL: http://svn.apache.org/viewvc?rev=812893&view=rev
Log:
change more handler to use commons configuration (JAMES-918)

Modified:
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/SpamTrapHandler.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TarpitHandler.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java
    james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java
    james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/DNSRBLHandler.java Wed Sep  9 11:38:45 2009
@@ -23,16 +23,17 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.StringTokenizer;
 
 import javax.annotation.Resource;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.dsn.DSNStatus;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.ConnectHandler;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.smtpserver.hook.HookResult;
@@ -79,57 +80,50 @@
         this.dnsService = dnsService;
     }
 
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration handlerConfiguration) throws ConfigurationException {
+    @SuppressWarnings("unchecked")
+	public void configure(Configuration handlerConfiguration) throws ConfigurationException {
         boolean validConfig = false;
 
-        Configuration rblserverConfiguration = handlerConfiguration.getChild("rblservers", false);
-        if ( rblserverConfiguration != null ) {
-            ArrayList rblserverCollection = new ArrayList();
-            Configuration[] children = rblserverConfiguration.getChildren("whitelist");
-            if ( children != null ) {
-                for ( int i = 0 ; i < children.length ; i++ ) {
-                    String rblServerName = children[i].getValue();
-                    rblserverCollection.add(rblServerName);
-                    if (getLogger().isInfoEnabled()) {
-                        getLogger().info("Adding RBL server to whitelist: " + rblServerName);
-                    }
-                }
-                if (rblserverCollection != null && rblserverCollection.size() > 0) {
-                    setWhitelist((String[]) rblserverCollection.toArray(new String[rblserverCollection.size()]));
-                    rblserverCollection.clear();
-                    validConfig = true;
-                }
-            }
-            children = rblserverConfiguration.getChildren("blacklist");
-            if ( children != null ) {
-                for ( int i = 0 ; i < children.length ; i++ ) {
-                    String rblServerName = children[i].getValue();
-                    rblserverCollection.add(rblServerName);
-                    if (getLogger().isInfoEnabled()) {
-                        getLogger().info("Adding RBL server to blacklist: " + rblServerName);
-                    }
-                }
-                if (rblserverCollection != null && rblserverCollection.size() > 0) {
-                    setBlacklist((String[]) rblserverCollection.toArray(new String[rblserverCollection.size()]));
-                    rblserverCollection.clear();
-                    validConfig = true;
-                }
+        ArrayList<String> rblserverCollection = new ArrayList<String>();
+        List<String> whiteList = handlerConfiguration.getList("rblservers/whitelist");
+        if ( whiteList != null ) {
+            for ( int i = 0 ; i < whiteList.size() ; i++ ) {
+                String rblServerName = whiteList.get(i);
+                rblserverCollection.add(rblServerName);
+                if (getLogger().isInfoEnabled()) {
+                    getLogger().info("Adding RBL server to whitelist: " + rblServerName);
+                }
+            }
+            if (rblserverCollection != null && rblserverCollection.size() > 0) {
+                setWhitelist((String[]) rblserverCollection.toArray(new String[rblserverCollection.size()]));
+                rblserverCollection.clear();
+                validConfig = true;
+            }
+        }
+        List<String> blackList = handlerConfiguration.getList("rblservers/blacklist");
+        if ( blackList != null ) {
+
+            for ( int i = 0 ; i < blackList.size() ; i++ ) {
+                String rblServerName = blackList.get(i);
+                rblserverCollection.add(rblServerName);
+                if (getLogger().isInfoEnabled()) {
+                    getLogger().info("Adding RBL server to blacklist: " + rblServerName);
+                }
+            }
+            if (rblserverCollection != null && rblserverCollection.size() > 0) {
+                setBlacklist((String[]) rblserverCollection.toArray(new String[rblserverCollection.size()]));
+                rblserverCollection.clear();
+                validConfig = true;
             }
         }
         
+        
         // Throw an ConfiigurationException on invalid config
         if (validConfig == false){
             throw new ConfigurationException("Please configure whitelist or blacklist");
         }
-        
-        Configuration configuration = handlerConfiguration.getChild("getDetail",false);
-        if(configuration != null) {
-           getDetail = configuration.getValueAsBoolean();
-        }
-        
+
+        setGetDetail(handlerConfiguration.getBoolean("getDetail",false));
     }
     
     /**

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java Wed Sep  9 11:38:45 2009
@@ -31,24 +31,21 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.StringTokenizer;
 
 import javax.annotation.Resource;
 
 import org.apache.avalon.cornerstone.services.datasources.DataSourceSelector;
 import org.apache.avalon.excalibur.datasource.DataSourceComponent;
 import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 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.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.api.dnsservice.util.NetMatcher;
 import org.apache.james.dsn.DSNStatus;
 import org.apache.james.services.FileSystem;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.SMTPRetCode;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.smtpserver.hook.HookResult;
@@ -179,49 +176,43 @@
         this.sqlFileUrl = sqlFileUrl;
     } 
     
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration handlerConfiguration) throws ConfigurationException {
-        Configuration configTemp = handlerConfiguration.getChild("tempBlockTime", false);
-        if (configTemp != null) {
-            try {
-                setTempBlockTime(configTemp.getValue());
 
-            } catch (NumberFormatException e) {
-               throw new ConfigurationException(e.getMessage());
-            }
+    @SuppressWarnings("unchecked")
+	public void configure(Configuration handlerConfiguration) throws ConfigurationException {
+        try {
+            setTempBlockTime(handlerConfiguration.getString("tempBlockTime"));
+        } catch (NumberFormatException e) {
+           throw new ConfigurationException(e.getMessage());
         }
+       
     
-        Configuration configAutoWhiteList = handlerConfiguration.getChild("autoWhiteListLifeTime", false);
-        if (configAutoWhiteList != null) {
-            try {
-                setAutoWhiteListLifeTime(configAutoWhiteList.getValue());
-            } catch (NumberFormatException e) {
-                throw new ConfigurationException(e.getMessage());
-            }
+      
+        try {
+            setAutoWhiteListLifeTime(handlerConfiguration.getString("autoWhiteListLifeTime"));
+        } catch (NumberFormatException e) {
+            throw new ConfigurationException(e.getMessage());
         }
        
-        Configuration configUnseen = handlerConfiguration.getChild("unseenLifeTime", false);
-        if (configUnseen != null) {
-            try {
-                setUnseenLifeTime(configUnseen.getValue());
-            } catch (NumberFormatException e) {
-                throw new ConfigurationException(e.getMessage());
-            }
+
+        try {
+            setUnseenLifeTime(handlerConfiguration.getString("unseenLifeTime"));
+        } catch (NumberFormatException e) {
+            throw new ConfigurationException(e.getMessage());
         }
 
-        Configuration configRepositoryPath = handlerConfiguration.getChild("repositoryPath", false);
+        String configRepositoryPath = handlerConfiguration.getString("repositoryPath", null);
         if (configRepositoryPath != null) {
-            setRepositoryPath(configRepositoryPath.getValue());
+            setRepositoryPath(configRepositoryPath);
         } else {
             throw new ConfigurationException("repositoryPath is not configured");
         }
 
         // Get the SQL file location
-        Configuration sFile = handlerConfiguration.getChild("sqlFile", false);
+        String sFile = handlerConfiguration.getString("sqlFile",null);
         if (sFile != null) {
-            setSqlFileUrl(sFile.getValue());
+            
+        	setSqlFileUrl(sFile);
+            
             if (!sqlFileUrl.startsWith("file://")) {
                 throw new ConfigurationException(
                     "Malformed sqlFile - Must be of the format \"file://<filename>\".");
@@ -230,9 +221,8 @@
             throw new ConfigurationException("sqlFile is not configured");
         }
 
-        Configuration whitelistedNetworks = handlerConfiguration.getChild("whitelistedNetworks", false);
-        if (whitelistedNetworks != null) {
-            Collection nets = whitelistedNetworks(whitelistedNetworks.getValue());
+        Collection<String> nets  = handlerConfiguration.getList("whitelistedNetworks");
+        if (nets != null) {
 
             if (nets != null) {
                 wNetworks = new NetMatcher(nets,dnsService);
@@ -319,11 +309,11 @@
             int count = 0;
             
             // get the timestamp when he triplet was last seen
-            Iterator data = getGreyListData(datasource.getConnection(), ipAddress, sender, recip);
+            Iterator<String> data = getGreyListData(datasource.getConnection(), ipAddress, sender, recip);
             
             if (data.hasNext()) {
-                createTimeStamp = Long.parseLong(data.next().toString());
-                count = Integer.parseInt(data.next().toString());
+                createTimeStamp = Long.parseLong(data.next());
+                count = Integer.parseInt(data.next());
             }
             
             getLogger().debug("Triplet " + ipAddress + " | " + sender + " | " + recip  +" -> TimeStamp: " + createTimeStamp);
@@ -387,9 +377,9 @@
      *            The data
      * @throws SQLException
      */
-    private Iterator getGreyListData(Connection conn, String ipAddress,
+    private Iterator<String> getGreyListData(Connection conn, String ipAddress,
         String sender, String recip) throws SQLException {
-        Collection data = new ArrayList(2);
+        Collection<String> data = new ArrayList<String>(2);
         PreparedStatement mappingStmt = null;
         try {
             mappingStmt = conn.prepareStatement(selectQuery);
@@ -647,24 +637,6 @@
     }
 
     /**
-     * Return a Collection which holds the values of the given string splitted
-     * on ","
-     * 
-     * @param networks
-     *            The commaseperated list of values
-     * @return wNetworks The Collection which holds the whitelistNetworks
-     */
-    private Collection whitelistedNetworks(String networks) {
-        Collection wNetworks = null;
-        StringTokenizer st = new StringTokenizer(networks, ", ", false);
-        wNetworks = new ArrayList();
-        
-        while (st.hasMoreTokens())
-            wNetworks.add(st.nextToken());
-        return wNetworks;
-    }
-
-    /**
      * @see org.apache.james.smtpserver.hook.RcptHook#doRcpt(org.apache.james.smtpserver.SMTPSession, org.apache.mailet.MailAddress, org.apache.mailet.MailAddress)
      */
     public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rcpt) {

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/SpamTrapHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/SpamTrapHandler.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/SpamTrapHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/SpamTrapHandler.java Wed Sep  9 11:38:45 2009
@@ -23,12 +23,14 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
+
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.smtpserver.hook.HookResult;
 import org.apache.james.smtpserver.hook.HookReturnCode;
@@ -42,9 +44,9 @@
 public class SpamTrapHandler extends AbstractLogEnabled implements RcptHook,Configurable{
 
     // Map which hold blockedIps and blockTime in memory
-    private Map blockedIps = new HashMap();
+    private Map<String,Long> blockedIps = new HashMap<String,Long>();
     
-    private Collection spamTrapRecips = new ArrayList();
+    private Collection<String> spamTrapRecips = new ArrayList<String>();
     
     // Default blocktime 12 hours
     private long blockTime = 4320000; 
@@ -52,29 +54,21 @@
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */
-    public void configure(Configuration arg0) throws ConfigurationException {
-        Configuration[] rcptsConf = arg0.getChildren("spamTrapRecip");
+    @SuppressWarnings("unchecked")
+	public void configure(Configuration config) throws ConfigurationException {
+        List<String> rcpts= config.getList("spamTrapRecip");
     
-        if (rcptsConf.length > 0 ) {
-            for (int i= 0; i < rcptsConf.length; i++) {
-                String rcpt = rcptsConf[i].getValue().toLowerCase();
-                
-                getLogger().debug("Add spamTrapRecip " + rcpt);
-           
-                spamTrapRecips.add(rcpt);
-            }
+        if (rcpts.isEmpty() == false ) {
+            setSpamTrapRecipients(rcpts);
         } else {
             throw new ConfigurationException("Please configure a spamTrapRecip.");
         }
     
-        Configuration blockTimeConf = arg0.getChild("blockTime",false);
-    
-        if (blockTimeConf != null) {
-            blockTime = blockTimeConf.getValueAsLong(blockTime);
-        }
+        setBlockTime(config.getLong("blockTime",blockTime));
+        
     }
     
-    public void setSpamTrapRecipients(Collection spamTrapRecips) {
+    public void setSpamTrapRecipients(Collection<String> spamTrapRecips) {
         this.spamTrapRecips = spamTrapRecips;
     }
     
@@ -108,10 +102,10 @@
      * @return true or false
      */
     private boolean isBlocked(String ip) {
-        Object rawTime = blockedIps.get(ip);
+        Long rawTime = blockedIps.get(ip);
     
         if (rawTime != null) {
-            long blockTime = ((Long) rawTime).longValue();
+            long blockTime = rawTime.longValue();
            
             if (blockTime > System.currentTimeMillis()) {
                 getLogger().debug("BlockList contain Ip " + ip);

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TarpitHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TarpitHandler.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TarpitHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/TarpitHandler.java Wed Sep  9 11:38:45 2009
@@ -21,9 +21,10 @@
 
 package org.apache.james.smtpserver.core.filter.fastfail;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.smtpserver.hook.HookResult;
 import org.apache.james.smtpserver.hook.HookReturnCode;
@@ -45,22 +46,14 @@
      */
     public void configure(Configuration handlerConfiguration)
             throws ConfigurationException {
-
-        Configuration configTarpitRcptCount = handlerConfiguration.getChild(
-                "tarpitRcptCount", false);
-        if (configTarpitRcptCount != null) {
-            setTarpitRcptCount(configTarpitRcptCount.getValueAsInteger(0));
-        }
+        setTarpitRcptCount(handlerConfiguration.getInt("tarpitRcptCount", 0));
 
         if (tarpitRcptCount == 0)
             throw new ConfigurationException(
                     "Please set the tarpitRcptCount bigger values as 0");
 
-        Configuration configTarpitSleepTime = handlerConfiguration.getChild(
-                "tarpitSleepTime", false);
-        if (configTarpitSleepTime != null) {
-            setTarpitSleepTime(configTarpitSleepTime.getValueAsLong(5000));
-        }
+        setTarpitSleepTime(handlerConfiguration.getLong("tarpitSleepTime", 5000));
+
 
         if (tarpitSleepTime == 0)
             throw new ConfigurationException(

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/URIRBLHandler.java Wed Sep  9 11:38:45 2009
@@ -36,11 +36,12 @@
 import javax.mail.internet.MimeMultipart;
 import javax.mail.internet.MimePart;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.dsn.DSNStatus;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.smtpserver.hook.HookResult;
 import org.apache.james.smtpserver.hook.HookReturnCode;
@@ -50,11 +51,11 @@
 /**
  * Extract domains from message and check against URIRBLServer. For more informations see http://www.surbl.org
  */
-public class URIRBLHandler extends AbstractLogEnabled implements MessageHook {
+public class URIRBLHandler extends AbstractLogEnabled implements MessageHook, Configurable {
 
     private DNSService dnsService;
 
-    private Collection uriRbl;
+    private Collection<String> uriRbl;
 
     private boolean getDetail = false;
 
@@ -81,47 +82,30 @@
         this.dnsService = dnsService;
     }
     
+
+    
     /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
+     * @see org.apache.james.smtpserver.Configurable#configure(org.apache.commons.configuration.Configuration)
      */
-    public void configure(Configuration arg0) throws ConfigurationException {
-        boolean invalidConfig = false;
-    
-        Configuration serverConfiguration = arg0.getChild("uriRblServers", false);
-        if ( serverConfiguration != null ) {
-            ArrayList serverCollection = new ArrayList();
-            Configuration[] children = serverConfiguration.getChildren("server");
-            if ( children != null ) {
-                for ( int i = 0 ; i < children.length ; i++ ) {
-                    String rblServerName = children[i].getValue();
-                    serverCollection.add(rblServerName);
-                    if (getLogger().isInfoEnabled()) {
-                        getLogger().info("Adding uriRBL server: " + rblServerName);
-                    }
-                }
-                if (serverCollection != null && serverCollection.size() > 0) {
-                    setUriRblServer(serverCollection);
-                } else {
-                    invalidConfig = true;
-                }
+    public void configure(Configuration config) throws ConfigurationException {
+        String[] servers = config.getStringArray("server");
+        Collection<String> serverCollection = new ArrayList<String>();
+        for ( int i = 0 ; i < servers.length ; i++ ) {
+            String rblServerName = servers[i];
+            serverCollection.add(rblServerName);
+            if (getLogger().isInfoEnabled()) {
+                    getLogger().info("Adding uriRBL server: " + rblServerName);
             }
-        } else {
-            invalidConfig = true;
         }
-        
-        if (invalidConfig == true) {
+        if (serverCollection != null && serverCollection.size() > 0) {
+            setUriRblServer(serverCollection);
+        } else {
             throw new ConfigurationException("Please provide at least one server");
         }
-    
-        Configuration configuration = arg0.getChild("getDetail",false);
-        if(configuration != null) {
-           getDetail = configuration.getValueAsBoolean();
-        }
+            
+        setGetDetail(config.getBoolean("getDetail",false));
+        setCheckAuthNetworks(config.getBoolean("checkAuthNetworks", false));
         
-        Configuration configRelay = arg0.getChild("checkAuthNetworks", false);
-        if (configRelay != null) {
-            setCheckAuthNetworks(configRelay.getValueAsBoolean(false));
-        }
         
     }
    
@@ -130,7 +114,7 @@
      * 
      * @param uriRbl The Collection holding the servers
      */
-    public void setUriRblServer(Collection uriRbl) {
+    public void setUriRblServer(Collection<String> uriRbl) {
         this.uriRbl = uriRbl;
     }
     
@@ -195,13 +179,13 @@
      * @param part MimePart to scan
      * @return domains The HashSet that contains the domains which were extracted
      */
-    private HashSet scanMailForDomains(MimePart part) throws MessagingException, IOException {
-        HashSet domains = new HashSet();
+    private HashSet<String> scanMailForDomains(MimePart part) throws MessagingException, IOException {
+        HashSet<String> domains = new HashSet<String>();
         getLogger().debug("mime type is: \"" + part.getContentType() + "\"");
        
         if (part.isMimeType("text/plain") || part.isMimeType("text/html")) {
             getLogger().debug("scanning: \"" + part.getContent().toString() + "\"");
-            HashSet newDom = URIScanner.scanContentForDomains(domains, part.getContent().toString());
+            HashSet<String> newDom = URIScanner.scanContentForDomains(domains, part.getContent().toString());
            
             // Check if new domains are found and add the domains 
             if (newDom != null && newDom.size() > 0) {
@@ -215,7 +199,7 @@
             for (int index = 0; index < count; index++) {
                 getLogger().debug("recursing index: " + index);
                 MimeBodyPart mimeBodyPart = (MimeBodyPart) multipart.getBodyPart(index);
-                HashSet newDomains = scanMailForDomains(mimeBodyPart);
+                HashSet<String> newDomains = scanMailForDomains(mimeBodyPart);
                 
                 // Check if new domains are found and add the domains 
                 if(newDomains != null && newDomains.size() > 0) {
@@ -240,12 +224,12 @@
         try {
             message = mail.getMessage();
 
-            HashSet domains = scanMailForDomains(message);
+            HashSet<String> domains = scanMailForDomains(message);
 
-            Iterator fDomains = domains.iterator();
+            Iterator<String> fDomains = domains.iterator();
 
             while (fDomains.hasNext()) {
-                Iterator uRbl = uriRbl.iterator();
+                Iterator<String> uRbl = uriRbl.iterator();
                 String target = fDomains.next().toString();
                 
                 while (uRbl.hasNext()) {
@@ -277,43 +261,4 @@
         }
         return false;
     }
-
-//    /**
-//     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)
-//     */
-//    public JunkHandlerData getJunkHandlerData(SMTPSession session) {
-//        JunkHandlerData data = new JunkHandlerData();
-//    
-//        String uRblServer = (String) session.getState().get(URBLSERVER);
-//        String target = (String) session.getState().get(LISTED_DOMAIN);
-//        String detail = null;
-//
-//        // we should try to retrieve details
-//        if (getDetail) {
-//            Collection txt = dnsServer.findTXTRecords(target+ "." + uRblServer);
-//
-//            // Check if we found a txt record
-//            if (!txt.isEmpty()) {
-//                // Set the detail
-//                detail = txt.iterator().next().toString();
-//
-//            }
-//        }
-//
-//        if (detail != null) {
-//           
-//            data.setRejectResponseString(new SMTPResponse(SMTPRetCode.TRANSACTION_FAILED,DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
-//                + "Rejected: message contains domain " + target + " listed by " + uRblServer +" . Details: " 
-//                + detail));
-//        } else {
-//            data.setRejectResponseString(new SMTPResponse(SMTPRetCode.TRANSACTION_FAILED,DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SECURITY_OTHER)
-//                + " Rejected: message contains domain " + target + " listed by " + uRblServer));
-//        }  
-//
-//        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/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptHandler.java Wed Sep  9 11:38:45 2009
@@ -25,22 +25,21 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.StringTokenizer;
 
 import javax.annotation.Resource;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 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.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.api.user.UsersRepository;
 import org.apache.james.api.vut.ErrorMappingException;
 import org.apache.james.api.vut.VirtualUserTable;
 import org.apache.james.api.vut.VirtualUserTableStore;
 import org.apache.james.dsn.DSNStatus;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.SMTPResponse;
 import org.apache.james.smtpserver.SMTPRetCode;
 import org.apache.james.smtpserver.SMTPSession;
@@ -77,9 +76,9 @@
         this.users = users;
     }
     
-    private Collection recipients = new ArrayList();
-    private Collection domains = new ArrayList();
-    private Collection regex = new ArrayList();
+    private Collection<String> recipients = new ArrayList<String>();
+    private Collection<String> domains = new ArrayList<String>();
+    private Collection<Pattern> regex = new ArrayList<Pattern>();
     private boolean vut = true;
     private VirtualUserTable table;
     private String tableName = null;
@@ -98,35 +97,17 @@
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
      */
-    public void configure(Configuration arg0) throws ConfigurationException {
-        Configuration recipientsConfig = arg0.getChild("validRecipients");
-        if (recipientsConfig != null) {
-            setValidRecipients(recipientsConfig.getValue());
-        }
-        
-        Configuration domainConfig = arg0.getChild("validDomains");        
-        if (domainConfig != null) {
-            setValidDomains(domainConfig.getValue());
-        }
-        
-        Configuration regexConfig = arg0.getChild("validRegexPattern");        
-        if (regexConfig != null) {
-            try {
-                setValidRegex(regexConfig.getValue());
-            } catch(MalformedPatternException mpe) {
-                throw new ConfigurationException("Malformed pattern: ", mpe);
-            }
-        }
-        Configuration vutConfig = arg0.getChild("enableVirtualUserTable");
-        
-        if (vutConfig != null) {
-            vut = vutConfig.getValueAsBoolean(true);    
-        }
-        Configuration tableConfig = arg0.getChild("table");
-        
-        if (tableConfig != null) {
-            tableName = tableConfig.getValue(null);   
+    @SuppressWarnings("unchecked")
+	public void configure(Configuration config) throws ConfigurationException {
+        setValidRecipients(config.getList("validRecipients"));
+        setValidDomains(config.getList("validDomains"));
+        try {
+            setValidRegex(config.getList("validRegexPattern"));
+        } catch(MalformedPatternException mpe) {
+            throw new ConfigurationException("Malformed pattern: ", mpe);
         }
+        setVirtualUserTableSupport(config.getBoolean("enableVirtualUserTable",true));    
+    	setTableName(config.getString("table",null));   
     }
     
     /**
@@ -134,15 +115,14 @@
      * 
      * @param recip The valid recipients. Commaseperated list
      */
-    public void setValidRecipients(String recip) {
-        StringTokenizer st = new StringTokenizer(recip, ", ", false);
-        
-        while (st.hasMoreTokens()) {
-            String recipient = st.nextToken().toLowerCase();
+    public void setValidRecipients(Collection<String> recips) {
+    	Iterator<String> recipsIt = recips.iterator();
+    	while (recipsIt.hasNext()) {
+            String recipient = recipsIt.next();
             
             getLogger().debug("Add recipient to valid recipients: " + recipient);
             recipients.add(recipient);
-        }
+    	}
     }
 
     /**
@@ -150,11 +130,11 @@
      * 
      * @param dom The valid domains. Commaseperated list
      */
-    public void setValidDomains(String dom) {
-        StringTokenizer st = new StringTokenizer(dom, ", ", false);
-        
-        while (st.hasMoreTokens()) {
-            String domain = st.nextToken().toLowerCase();
+    public void setValidDomains(Collection<String> doms) {
+    	Iterator<String> domsIt = doms.iterator();
+    	
+        while (domsIt.hasNext()) {
+            String domain = domsIt.next().toLowerCase();
             getLogger().debug("Add domain to valid domains: " + domain);
             domains.add(domain);
         }  
@@ -165,13 +145,12 @@
      * @param reg 
      * @throws MalformedPatternException
      */
-    public void setValidRegex(String reg) throws MalformedPatternException {
+    public void setValidRegex(Collection<String> regs) throws MalformedPatternException {
         Perl5Compiler compiler = new Perl5Compiler();
-        
-        StringTokenizer st = new StringTokenizer(reg, ", ", false);
-        
-        while (st.hasMoreTokens()) {
-            String patternString = st.nextToken().trim();
+                
+        Iterator<String> regsIt = regs.iterator();
+        while (regsIt.hasNext()) {
+            String patternString = regsIt.next();
 
             getLogger().debug("Add regex to valid regex: " + patternString);
             
@@ -185,6 +164,10 @@
         this.vut = vut;
     }
 
+    public void setTableName(String tableName) {
+    	this.tableName = tableName;
+    }
+    
     /**
      * @see org.apache.james.smtpserver.hook.RcptHook#doRcpt(org.apache.james.smtpserver.SMTPSession, org.apache.mailet.MailAddress, org.apache.mailet.MailAddress)
      */
@@ -200,7 +183,7 @@
             // check if an valid virtual mapping exists
             if (invalidUser == true  && vut == true) {
                 try {
-                    Collection targetString = table.getMappings(rcpt.getLocalPart(), rcpt.getDomain());
+                    Collection<String> targetString = table.getMappings(rcpt.getLocalPart(), rcpt.getDomain());
             
                     if (targetString != null && targetString.isEmpty() == false) {
                         invalidUser = false;
@@ -214,11 +197,11 @@
             }
             
             if (invalidUser == true && !regex.isEmpty()) {
-                Iterator reg = regex.iterator();
+                Iterator<Pattern> reg = regex.iterator();
                 Perl5Matcher matcher  = new Perl5Matcher();
                 
                 while (reg.hasNext()) {
-                    if (matcher.matches(rcpt.toString(), (Pattern) reg.next())) {
+                    if (matcher.matches(rcpt.toString(), reg.next())) {
                         // regex match
                         invalidUser = false;
                         break;

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidRcptMX.java Wed Sep  9 11:38:45 2009
@@ -23,16 +23,18 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.annotation.Resource;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.api.dnsservice.TemporaryResolutionException;
 import org.apache.james.api.dnsservice.util.NetMatcher;
 import org.apache.james.dsn.DSNStatus;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.SMTPRetCode;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.smtpserver.hook.HookResult;
@@ -44,7 +46,7 @@
  * This class can be used to reject email with bogus MX which is send from a authorized user or an authorized
  * network.
  */
-public class ValidRcptMX extends AbstractLogEnabled implements RcptHook {
+public class ValidRcptMX extends AbstractLogEnabled implements RcptHook, Configurable {
 
     private DNSService dnsService = null;
 
@@ -70,22 +72,20 @@
     }
     
     /**
-     * @see org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler#configure(org.apache.avalon.framework.configuration.Configuration)
+     * @see org.apache.james.smtpserver.Configurable#configure(org.apache.commons.configuration.Configuration)
      */
-    public void configure(Configuration arg0) throws ConfigurationException {
+    @SuppressWarnings("unchecked")
+	public void configure(Configuration config) throws ConfigurationException {
 
-        Configuration[] badMX = arg0.getChildren("invalidMXNetworks");
+        List<String> networks = config.getList("invalidMXNetworks");
 
-        if (badMX.length != 0) {
- 
-            Collection bannedNetworks = new ArrayList();
-
-            for (int i = 0; i < badMX.length; i++) {
-                String network = badMX[i].getValue(null);
-
-                if (network != null) {
-                    bannedNetworks.add(network);
-                }
+        if (networks.isEmpty() == false) {
+        	
+            Collection<String> bannedNetworks = new ArrayList<String>();
+
+            for (int i = 0; i < networks.size(); i++) {
+                String network = networks.get(i);
+                bannedNetworks.add(network.trim());
             }
 
             setBannedNetworks(bannedNetworks, dnsService);
@@ -105,7 +105,7 @@
      * @param networks Collection of networks 
      * @param dnsServer The DNSServer
      */
-    public void setBannedNetworks(Collection networks, DNSService dnsServer) {
+    public void setBannedNetworks(Collection<String> networks, DNSService dnsServer) {
         bNetwork = new NetMatcher(networks, dnsServer) {
             protected void log(String s) {
                 getLogger().debug(s);

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/ValidSenderDomainHandler.java Wed Sep  9 11:38:45 2009
@@ -22,12 +22,12 @@
 
 import javax.annotation.Resource;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.api.dnsservice.TemporaryResolutionException;
 import org.apache.james.dsn.DSNStatus;
+import org.apache.james.smtpserver.Configurable;
 import org.apache.james.smtpserver.SMTPRetCode;
 import org.apache.james.smtpserver.SMTPSession;
 import org.apache.james.smtpserver.hook.HookResult;
@@ -61,15 +61,12 @@
         this.dnsService = dnsService;
     }
     
+    
     /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
+     * @see org.apache.james.smtpserver.Configurable#configure(org.apache.commons.configuration.Configuration)
      */
     public void configure(Configuration handlerConfiguration) throws ConfigurationException {
-        
-        Configuration configRelay = handlerConfiguration.getChild("checkAuthNetworks",false);
-        if(configRelay != null) {
-            setCheckAuthNetworks(configRelay.getValueAsBoolean(false));
-        }
+    	setCheckAuthNetworks(handlerConfiguration.getBoolean("checkAuthNetworks",false));
     }
         
     /**

Modified: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java (original)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java Wed Sep  9 11:38:45 2009
@@ -20,22 +20,25 @@
 
 package org.apache.james.smtpserver;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.mail.internet.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.api.dnsservice.AbstractDNSServer;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.smtpserver.core.filter.fastfail.DNSRBLHandler;
@@ -258,7 +261,213 @@
         boolean exception = false;
         DNSRBLHandler rbl = new DNSRBLHandler();
         try {
-            rbl.configure((Configuration) new DefaultConfiguration("rblserver"));
+            rbl.configure(new Configuration() {
+				
+				public Configuration subset(String prefix) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public void setProperty(String key, Object value) {
+					// TODO Auto-generated method stub
+					
+				}
+				
+				public boolean isEmpty() {
+					// TODO Auto-generated method stub
+					return true;
+				}
+				
+				public String[] getStringArray(String key) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public String getString(String key, String defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public String getString(String key) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public Short getShort(String key, Short defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public short getShort(String key, short defaultValue) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public short getShort(String key) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public Object getProperty(String key) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public Properties getProperties(String key) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public Long getLong(String key, Long defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public long getLong(String key, long defaultValue) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public long getLong(String key) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public List getList(String key, List defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public List getList(String key) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public Iterator getKeys(String prefix) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public Iterator getKeys() {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public Integer getInteger(String key, Integer defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public int getInt(String key, int defaultValue) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public int getInt(String key) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public Float getFloat(String key, Float defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public float getFloat(String key, float defaultValue) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public float getFloat(String key) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public Double getDouble(String key, Double defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public double getDouble(String key, double defaultValue) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public double getDouble(String key) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public Byte getByte(String key, Byte defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public byte getByte(String key, byte defaultValue) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public byte getByte(String key) {
+					// TODO Auto-generated method stub
+					return 0;
+				}
+				
+				public Boolean getBoolean(String key, Boolean defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public boolean getBoolean(String key, boolean defaultValue) {
+					// TODO Auto-generated method stub
+					return false;
+				}
+				
+				public boolean getBoolean(String key) {
+					// TODO Auto-generated method stub
+					return false;
+				}
+				
+				public BigInteger getBigInteger(String key, BigInteger defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public BigInteger getBigInteger(String key) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public BigDecimal getBigDecimal(String key, BigDecimal defaultValue) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public BigDecimal getBigDecimal(String key) {
+					// TODO Auto-generated method stub
+					return null;
+				}
+				
+				public boolean containsKey(String key) {
+					// TODO Auto-generated method stub
+					return false;
+				}
+				
+				public void clearProperty(String key) {
+					// TODO Auto-generated method stub
+					
+				}
+				
+				public void clear() {
+					// TODO Auto-generated method stub
+					
+				}
+				
+				public void addProperty(String key, Object value) {
+					// TODO Auto-generated method stub
+					
+				}
+			});
         } catch (ConfigurationException e) {
             exception = true;
         }

Modified: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java?rev=812893&r1=812892&r2=812893&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java (original)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java Wed Sep  9 11:38:45 2009
@@ -183,12 +183,14 @@
     
     public void testNotRejectValidUserRecipient() throws Exception {
         String recipient = "recip@domain";
+        ArrayList<String> list = new ArrayList<String>();
+        list.add(recipient);
         ContainerUtil.service(handler, setUpServiceManager());
         MailAddress mailAddress = new MailAddress(recipient);
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
         ContainerUtil.enableLogging(handler,new MockLogger());
     
-        handler.setValidRecipients(recipient);
+        handler.setValidRecipients(list);
 
         int rCode = handler.doRcpt(session, null, mailAddress).getResult();
         
@@ -198,13 +200,14 @@
     public void testNotRejectValidUserDomain() throws Exception {
         String domain = "domain";
         String recipient = "recip@" + domain;
-
+        ArrayList<String> list = new ArrayList<String>();
+        list.add(domain);
         ContainerUtil.service(handler, setUpServiceManager());
         MailAddress mailAddress = new MailAddress(recipient);
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
         ContainerUtil.enableLogging(handler,new MockLogger());
     
-        handler.setValidDomains(domain);
+        handler.setValidDomains(list);
 
         int rCode = handler.doRcpt(session, null, mailAddress).getResult();
         
@@ -214,13 +217,14 @@
     public void testNotRejectValidUserRegex() throws Exception {
         String domain = "domain";
         String recipient = "recip@" + domain;
-
+        ArrayList<String> list = new ArrayList<String>();
+        list.add("reci.*");
         ContainerUtil.service(handler, setUpServiceManager());
         MailAddress mailAddress = new MailAddress(recipient);
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
         ContainerUtil.enableLogging(handler,new MockLogger());
     
-        handler.setValidRegex("reci.*");
+        handler.setValidRegex(list);
 
         int rCode = handler.doRcpt(session, null, mailAddress).getResult();
         
@@ -231,9 +235,11 @@
         boolean exception = false;
         ContainerUtil.service(handler, setUpServiceManager());
         ContainerUtil.enableLogging(handler,new MockLogger());
-    
+        
+        ArrayList<String> list = new ArrayList<String>();
+        list.add("(.*");
         try {
-            handler.setValidRegex("(.*");
+            handler.setValidRegex(list);
         } catch (MalformedPatternException e) {
             exception = true;
         }



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