Author: norman
Date: Sat Jan 30 11:03:08 2010
New Revision: 904762

URL: http://svn.apache.org/viewvc?rev=904762&view=rev
Log:
Move more code to integration module

Added:
    
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/fastfail/SpamTrapHandler.java
Modified:
    
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/fastfail/SpamTrapHandler.java

Modified: 
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/fastfail/SpamTrapHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/fastfail/SpamTrapHandler.java?rev=904762&r1=904761&r2=904762&view=diff
==============================================================================
--- 
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/fastfail/SpamTrapHandler.java
 (original)
+++ 
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/fastfail/SpamTrapHandler.java
 Sat Jan 30 11:03:08 2010
@@ -23,12 +23,8 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.james.lifecycle.Configurable;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.hook.HookResult;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;
@@ -39,7 +35,7 @@
  * This handler can be used for providing a spam trap. IPAddresses which send 
emails to the configured
  * recipients will get blacklisted for the configured time.
  */
-public class SpamTrapHandler implements RcptHook, Configurable {
+public class SpamTrapHandler implements RcptHook {
 
     /** Map which hold blockedIps and blockTime in memory */
     private Map<String,Long> blockedIps = new HashMap<String,Long>();
@@ -47,26 +43,9 @@
     private Collection<String> spamTrapRecips = new ArrayList<String>();
     
     /** Default blocktime 12 hours */
-    private long blockTime = 4320000; 
-    
-    /*
-     * (non-Javadoc)
-     * @see 
org.apache.james.lifecycle.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
-     */
-    @SuppressWarnings("unchecked")
-       public void configure(HierarchicalConfiguration config) throws 
ConfigurationException {
-        List<String> rcpts= config.getList("spamTrapRecip");
-    
-        if (rcpts.isEmpty() == false ) {
-            setSpamTrapRecipients(rcpts);
-        } else {
-            throw new ConfigurationException("Please configure a 
spamTrapRecip.");
-        }
-    
-        setBlockTime(config.getLong("blockTime",blockTime));
-        
-    }
+    protected long blockTime = 4320000; 
     
+   
     public void setSpamTrapRecipients(Collection<String> spamTrapRecips) {
         this.spamTrapRecips = spamTrapRecips;
     }

Added: 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/fastfail/SpamTrapHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/fastfail/SpamTrapHandler.java?rev=904762&view=auto
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/fastfail/SpamTrapHandler.java
 (added)
+++ 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/fastfail/SpamTrapHandler.java
 Sat Jan 30 11:03:08 2010
@@ -0,0 +1,47 @@
+/****************************************************************
+ * 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.integration.fastfail;
+
+import java.util.List;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+
+public class SpamTrapHandler extends 
org.apache.james.smtpserver.protocol.core.fastfail.SpamTrapHandler{
+
+    /*
+     * (non-Javadoc)
+     * @see 
org.apache.james.lifecycle.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+     */
+    @SuppressWarnings("unchecked")
+    public void configure(HierarchicalConfiguration config) throws 
ConfigurationException {
+        List<String> rcpts= config.getList("spamTrapRecip");
+    
+        if (rcpts.isEmpty() == false ) {
+            setSpamTrapRecipients(rcpts);
+        } else {
+            throw new ConfigurationException("Please configure a 
spamTrapRecip.");
+        }
+    
+        setBlockTime(config.getLong("blockTime",blockTime));
+        
+    }
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to