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 ba...@apache.org on 2006/10/04 13:20:36 UTC

svn commit: r452836 - in /james/jspf/trunk/src: main/java/org/apache/james/jspf/ main/java/org/apache/james/jspf/core/ main/java/org/apache/james/jspf/localpolicy/ main/java/org/apache/james/jspf/localpolicy/terms/ main/java/org/apache/james/jspf/parse...

Author: bago
Date: Wed Oct  4 04:20:34 2006
New Revision: 452836

URL: http://svn.apache.org/viewvc?view=rev&rev=452836
Log:
Introduced a Configuration parameter interface for Configurable.
Introduced an SPFRecordParser interface for the parser
Refactored the parser to smaller components (introduced the TermsFactory, and its default implementation).
Some class has been moved around to have a better package dependency structure.
Now: overall coverage 75%, parser coverage 95%.

Added:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configuration.java   (with props)
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java   (with props)
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermDefinition.java   (with props)
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermsFactory.java   (with props)
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/MatcherBasedConfiguration.java   (with props)
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermDefinition.java   (with props)
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermsFactory.java   (with props)
    james/jspf/trunk/src/main/java/org/apache/james/jspf/util/SPFTermsRegexps.java   (with props)
Removed:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/terms/
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/SPF1Parser.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/util/ConfigurationMatch.java
Modified:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configurable.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/FallbackPolicy.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/TrustedForwarderPolicy.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AllMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExpModifier.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericModifier.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/RedirectModifier.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/UnknownModifier.java
    james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java
    james/jspf/trunk/src/test/java/org/apache/james/jspf/SPF1ParserTest.java

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/SPF.java Wed Oct  4 04:20:34 2006
@@ -28,6 +28,7 @@
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.core.SPF1Record;
 import org.apache.james.jspf.core.SPFChecker;
+import org.apache.james.jspf.core.SPFRecordParser;
 import org.apache.james.jspf.exceptions.NeutralException;
 import org.apache.james.jspf.exceptions.NoneException;
 import org.apache.james.jspf.exceptions.PermErrorException;
@@ -35,7 +36,7 @@
 import org.apache.james.jspf.localpolicy.FallbackPolicy;
 import org.apache.james.jspf.localpolicy.TrustedForwarderPolicy;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.parser.DefaultSPF1Parser;
 
 import java.util.Iterator;
 import java.util.List;
@@ -49,7 +50,7 @@
 
     private DNSService dnsProbe;
 
-    private SPF1Parser parser;
+    private SPFRecordParser parser;
 
     private Logger log;
     
@@ -84,7 +85,7 @@
      * @param logger the logger to use
      */
     public SPF(DNSService dnsProbe, Logger logger) {
-        this(dnsProbe, new SPF1Parser(logger), logger);
+        this(dnsProbe, new DefaultSPF1Parser(logger), logger);
     }
     
     
@@ -95,7 +96,7 @@
      * @param parser the parser to use
      * @param logger the logger to use
      */
-    public SPF(DNSService dnsProbe, SPF1Parser parser, Logger logger) {
+    public SPF(DNSService dnsProbe, SPFRecordParser parser, Logger logger) {
         super();
         this.dnsProbe = dnsProbe;
         this.parser = parser;
@@ -412,7 +413,7 @@
      * Initialize fallback policy and enable its usage.
      */
     public void initializeFallbackPolicy() {
-        this.fallBack =  new FallbackPolicy(this.log);
+        this.fallBack =  new FallbackPolicy(this.log, parser);
     }
     
     /**

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configurable.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configurable.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configurable.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configurable.java Wed Oct  4 04:20:34 2006
@@ -21,7 +21,6 @@
 package org.apache.james.jspf.core;
 
 import org.apache.james.jspf.exceptions.PermErrorException;
-import org.apache.james.jspf.util.ConfigurationMatch;
 
 /**
  * 
@@ -34,6 +33,6 @@
      * @param params the ConfigurationMatch which should used
      * @throws PermErrorException get thrown if a PermError should returned
      */
-    void config(ConfigurationMatch params) throws PermErrorException;
+    void config(Configuration params) throws PermErrorException;
 
 }

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configuration.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configuration.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configuration.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configuration.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,34 @@
+/****************************************************************
+ * 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.jspf.core;
+
+public interface Configuration {
+
+    /**
+     * @see java.util.regex.MatchResult#group(int)
+     */
+    public String group(int arg0);
+
+    /**
+     * @see java.util.regex.MatchResult#groupCount()
+     */
+    public int groupCount();
+
+}
\ No newline at end of file

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/Configuration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,45 @@
+/****************************************************************
+ * 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.jspf.core;
+
+import org.apache.james.jspf.exceptions.NeutralException;
+import org.apache.james.jspf.exceptions.NoneException;
+import org.apache.james.jspf.exceptions.PermErrorException;
+
+public interface SPFRecordParser {
+
+    /**
+     * This Method parse the given spf record and checks for syntax
+     * 
+     * parse can be called by multiple concurrent threads.
+     * 
+     * @param spfRecord
+     *            The String which represent the spf record in dns
+     * @return result The SPF1Record
+     * @throws PermErrorException
+     *             Get thrown if an syntax error was detected
+     * @throws NoneException
+     *             Get thrown if no spf record could be found
+     * @throws NeutralException Get thrown if an empty spf record was found 
+     */
+    public SPF1Record parse(String spfRecord) throws PermErrorException,
+            NoneException, NeutralException;
+
+}
\ No newline at end of file

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/FallbackPolicy.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/FallbackPolicy.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/FallbackPolicy.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/FallbackPolicy.java Wed Oct  4 04:20:34 2006
@@ -26,10 +26,10 @@
 
 import org.apache.james.jspf.core.Logger;
 import org.apache.james.jspf.core.SPF1Record;
+import org.apache.james.jspf.core.SPFRecordParser;
 import org.apache.james.jspf.exceptions.NeutralException;
 import org.apache.james.jspf.exceptions.NoneException;
 import org.apache.james.jspf.exceptions.PermErrorException;
-import org.apache.james.jspf.parser.SPF1Parser;
 
 /**
  * Class to support Fallback feature
@@ -38,14 +38,14 @@
 
     private Map fallBackMap;
 
-    private SPF1Parser parser;
+    private SPFRecordParser parser;
 
     private Logger log;
 
-    public FallbackPolicy(Logger log){
+    public FallbackPolicy(Logger log, SPFRecordParser parser){
         this.log = log;
         fallBackMap = Collections.synchronizedMap(new HashMap());
-        parser = new SPF1Parser(log);
+        this.parser = parser;
     }
 
     /**

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/TrustedForwarderPolicy.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/TrustedForwarderPolicy.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/TrustedForwarderPolicy.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/localpolicy/TrustedForwarderPolicy.java Wed Oct  4 04:20:34 2006
@@ -25,8 +25,9 @@
 import java.util.Collection;
 
 import org.apache.james.jspf.core.Directive;
+import org.apache.james.jspf.core.Mechanism;
 import org.apache.james.jspf.exceptions.PermErrorException;
-import org.apache.james.jspf.localpolicy.terms.TrustedForwarderMechanism;
+import org.apache.james.jspf.terms.IncludeMechanism;
 import org.apache.james.jspf.core.Logger;
 
 /**
@@ -74,8 +75,17 @@
         if (mechanism.equals("-all") || mechanism.equals("?all")) {
             log.debug("Add TrustedForwarderPolicy = include:"+TRUSTED_FORWARDER_HOST);
             try {
-                TrustedForwarderMechanism trusted = new TrustedForwarderMechanism();
-                trusted.setHost(TRUSTED_FORWARDER_HOST);
+                Mechanism trusted = new IncludeMechanism() {
+                    /**
+                     * Set the host to use 
+                     * 
+                     * @param host the host to include
+                     */
+                    public synchronized Mechanism setHost(String host) {
+                        this.host = host;
+                        return this;
+                    }
+                }.setHost(TRUSTED_FORWARDER_HOST);
                 aCom.add(aCom.size()-1, new Directive(null,trusted));
             } catch (PermErrorException e) {
                 // will never happen

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,349 @@
+/****************************************************************
+ * 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.jspf.parser;
+
+import org.apache.james.jspf.core.Configuration;
+import org.apache.james.jspf.core.Directive;
+import org.apache.james.jspf.core.Logger;
+import org.apache.james.jspf.core.Mechanism;
+import org.apache.james.jspf.core.Modifier;
+import org.apache.james.jspf.core.SPF1Constants;
+import org.apache.james.jspf.core.SPF1Record;
+import org.apache.james.jspf.core.SPFRecordParser;
+import org.apache.james.jspf.exceptions.NeutralException;
+import org.apache.james.jspf.exceptions.NoneException;
+import org.apache.james.jspf.exceptions.PermErrorException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This class is used to parse SPF1-Records from their textual form to an
+ * SPF1Record object that is composed by 2 collections: directives and
+ * modifiers.
+ * 
+ * The parsing is modular and get informations from Mechanism and Modifiers
+ * classes declared in the org/apache/james/jspf/parser/jspf.default.terms file.
+ * 
+ * Each term implementation provide its own REGEX in the REGEX static public
+ * field. This parser simply join all the regexp in a single "alternative"
+ * pattern and count the number of catch groups (brackets) assigned to each
+ * regex fragment.
+ * 
+ * SO it creates a big regex and an array where it store what term is associated
+ * to each catch group of the big regex.
+ * 
+ * If the regex matches the input vspf1 record then it start looking for the
+ * matched group (not null) and lookup the term that created that part of the
+ * regex.
+ * 
+ * With this informations it creates a new instance of the term and, if the term
+ * is Configurable it calls the config() method passing to it only the specific
+ * subset of the MatchResult (using the MatchResultSubset).
+ * 
+ * TODO doubts about the specification - redirect or exp with no domain-spec are
+ * evaluated as an unknown-modifiers according to the current spec (it does not
+ * make too much sense) - top-label is defined differently in various specs.
+ * We'll have to review the code. -
+ * http://data.iana.org/TLD/tlds-alpha-by-domain.txt (we should probably beeter
+ * use and alpha sequence being at least 2 chars - Somewhere is defined as "."
+ * TLD [ "." ] - Otherwise defined as ( *alphanum ALPHA *alphanum ) / (
+ * 1*alphanum "-" *( * alphanum / "-" ) alphanum )
+ * 
+ * @see org.apache.james.jspf.core.SPF1Record
+ * 
+ */
+public class DefaultSPF1Parser implements SPFRecordParser {
+
+    /**
+     * Regex based on http://www.ietf.org/rfc/rfc4408.txt.
+     * This will be the next official SPF-Spec
+     */
+
+    // Changed this because C, T and R MACRO_LETTERS are not available 
+    // in record parsing and must return a PermError.
+   
+    // private static final String MACRO_LETTER_PATTERN = "[lsodipvhcrtLSODIPVHCRT]";
+
+    /**
+     * ABNF: qualifier = "+" / "-" / "?" / "~"
+     */
+    private static final String QUALIFIER_PATTERN = "[" + "\\"
+            + SPF1Constants.PASS + "\\" + SPF1Constants.FAIL + "\\"
+            + SPF1Constants.NEUTRAL + "\\" + SPF1Constants.SOFTFAIL + "]";
+
+    private Pattern termsSeparatorPattern = null;
+
+    private Pattern termPattern = null;
+
+    private int TERM_STEP_REGEX_QUALIFIER_POS;
+
+    private int TERM_STEP_REGEX_MECHANISM_POS;
+
+    private int TERM_STEP_REGEX_MODIFIER_POS;
+
+    private List matchResultPositions;
+
+    private Logger log;
+
+    private TermsFactory termsFactory;
+
+    /**
+     * Constructor. Creates all the values needed to run the parsing
+     * 
+     * @param loggerThe logger to use
+     */
+    public DefaultSPF1Parser(Logger logger) {
+        log = logger;
+        termsFactory = new DefaultTermsFactory(logger);
+        /**
+         * ABNF: mechanism = ( all / include / A / MX / PTR / IP4 / IP6 / exists )
+         */
+        String MECHANISM_REGEX = createRegex(termsFactory.getMechanismsCollection());
+
+        /**
+         * ABNF: modifier = redirect / explanation / unknown-modifier
+         */
+        String MODIFIER_REGEX = "(" + createRegex(termsFactory.getModifiersCollection()) + ")";
+
+        /**
+         * ABNF: directive = [ qualifier ] mechanism
+         */
+        String DIRECTIVE_REGEX = "(" + QUALIFIER_PATTERN + "?)("
+                + MECHANISM_REGEX + ")";
+
+        /**
+         * ABNF: ( directive / modifier )
+         */
+        String TERM_REGEX = "(?:" + MODIFIER_REGEX + "|" + DIRECTIVE_REGEX
+                + ")";
+
+        /**
+         * ABNF: 1*SP
+         */
+        String TERMS_SEPARATOR_REGEX = "[ ]+";
+
+        termsSeparatorPattern = Pattern.compile(TERMS_SEPARATOR_REGEX);
+        termPattern = Pattern.compile(TERM_REGEX);
+
+        initializePositions();
+    }
+
+    /**
+     * Fill in the matchResultPositions ArrayList. This array simply map each
+     * regex matchgroup to the Term class that originated that part of the
+     * regex.
+     */
+    private void initializePositions() {
+        ArrayList matchResultPositions = new ArrayList();
+
+        // FULL MATCH
+        int posIndex = 0;
+        matchResultPositions.ensureCapacity(posIndex + 1);
+        matchResultPositions.add(posIndex, null);
+
+        Iterator i;
+
+        TERM_STEP_REGEX_MODIFIER_POS = ++posIndex;
+        matchResultPositions.ensureCapacity(posIndex + 1);
+        matchResultPositions.add(TERM_STEP_REGEX_MODIFIER_POS, null);
+        i = termsFactory.getModifiersCollection().iterator();
+        while (i.hasNext()) {
+            TermDefinition td = (TermDefinition) i.next();
+            int size = td.getMatchSize() + 1;
+            for (int k = 0; k < size; k++) {
+                posIndex++;
+                matchResultPositions.ensureCapacity(posIndex + 1);
+                matchResultPositions.add(posIndex, td);
+            }
+        }
+
+        TERM_STEP_REGEX_QUALIFIER_POS = ++posIndex;
+        matchResultPositions.ensureCapacity(posIndex + 1);
+        matchResultPositions.add(posIndex, null);
+
+        TERM_STEP_REGEX_MECHANISM_POS = ++posIndex;
+        matchResultPositions.ensureCapacity(posIndex + 1);
+        matchResultPositions.add(TERM_STEP_REGEX_MECHANISM_POS, null);
+        i = termsFactory.getMechanismsCollection().iterator();
+        while (i.hasNext()) {
+            TermDefinition td = (TermDefinition) i.next();
+            int size = td.getMatchSize() + 1;
+            for (int k = 0; k < size; k++) {
+                posIndex++;
+                matchResultPositions.ensureCapacity(posIndex + 1);
+                matchResultPositions.add(posIndex, td);
+            }
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("Parsing catch group positions: Modifiers["
+                    + TERM_STEP_REGEX_MODIFIER_POS + "] Qualifier["
+                    + TERM_STEP_REGEX_QUALIFIER_POS + "] Mechanism["
+                    + TERM_STEP_REGEX_MECHANISM_POS + "]");
+            for (int k = 0; k < matchResultPositions.size(); k++) {
+                log
+                        .debug(k
+                                + ") "
+                                + (matchResultPositions.get(k) != null ? ((TermDefinition) matchResultPositions
+                                        .get(k)).getPattern().pattern()
+                                        : null));
+            }
+        }
+        
+        this.matchResultPositions = Collections.synchronizedList(matchResultPositions);
+    }
+
+    /**
+     * Loop the classes searching for a String static field named
+     * staticFieldName and create an OR regeex like this:
+     * (?:FIELD1|FIELD2|FIELD3)
+     * 
+     * @param classes
+     *            classes to analyze
+     * @param staticFieldName
+     *            static field to concatenate
+     * @return regex The regex
+     */
+    private String createRegex(Collection commandMap) {
+        StringBuffer modifierRegex = new StringBuffer();
+        Iterator i = commandMap.iterator();
+        boolean first = true;
+        while (i.hasNext()) {
+            if (first) {
+                modifierRegex.append("(?:(");
+                first = false;
+            } else {
+                modifierRegex.append(")|(");
+            }
+            Pattern pattern = ((TermDefinition) i.next()).getPattern();
+            modifierRegex.append(pattern.pattern());
+        }
+        modifierRegex.append("))");
+        return modifierRegex.toString();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.james.jspf.parser.SPFRecordParser#parse(java.lang.String)
+     */
+    public SPF1Record parse(String spfRecord) throws PermErrorException,
+            NoneException, NeutralException {
+
+        log.debug("Start parsing SPF-Record: " + spfRecord);
+
+        SPF1Record result = new SPF1Record();
+
+        // check the version "header"
+        if (spfRecord.startsWith(SPF1Constants.SPF_VERSION + " ") || spfRecord.equalsIgnoreCase(SPF1Constants.SPF_VERSION)) {
+            if (!spfRecord.startsWith(SPF1Constants.SPF_VERSION + " ")) throw new NeutralException("Empty SPF Record");
+        } else {
+            throw new NoneException("No valid SPF Record: " + spfRecord);
+        }
+
+        // extract terms
+        String[] terms = termsSeparatorPattern.split(spfRecord.replaceFirst(
+                SPF1Constants.SPF_VERSION, ""));
+
+        // cycle terms
+        for (int i = 0; i < terms.length; i++) {
+            if (terms[i].length() > 0) {
+                Matcher termMatcher = termPattern.matcher(terms[i]);
+                if (!termMatcher.matches()) {
+                    throw new PermErrorException("Term [" + terms[i]
+                            + "] is not syntactically valid: "
+                            + termPattern.pattern());
+                }
+
+                // true if we matched a modifier, false if we matched a
+                // directive
+                String modifierString = termMatcher
+                        .group(TERM_STEP_REGEX_MODIFIER_POS);
+
+                if (modifierString != null) {
+                    // MODIFIER
+                    Modifier mod = (Modifier) lookupAndCreateTerm(termMatcher,
+                            TERM_STEP_REGEX_MODIFIER_POS);
+
+                    if (mod.enforceSingleInstance()) {
+                        Iterator it = result.getModifiers().iterator();
+                        while (it.hasNext()) {
+                            if (it.next().getClass().equals(mod.getClass())) {
+                                throw new PermErrorException("More than one "
+                                        + modifierString
+                                        + " found in SPF-Record");
+                            }
+                        }
+                    }
+
+                    result.getModifiers().add(mod);
+
+                } else {
+                    // DIRECTIVE
+                    String qualifier = termMatcher
+                            .group(TERM_STEP_REGEX_QUALIFIER_POS);
+
+                    Object mech = lookupAndCreateTerm(termMatcher,
+                            TERM_STEP_REGEX_MECHANISM_POS);
+
+                    result.getDirectives().add(
+                            new Directive(qualifier, (Mechanism) mech));
+
+                }
+
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * @param res
+     *            the MatchResult
+     * @param start
+     *            the position where the terms starts
+     * @return
+     * @throws PermErrorException
+     */
+    private Object lookupAndCreateTerm(Matcher res, int start)
+            throws PermErrorException {
+        for (int k = start + 1; k < res.groupCount(); k++) {
+            if (res.group(k) != null && k != TERM_STEP_REGEX_QUALIFIER_POS) {
+                TermDefinition c = (TermDefinition) matchResultPositions.get(k);
+                Configuration subres = new MatcherBasedConfiguration(res, k, c
+                        .getMatchSize());
+                try {
+                    return termsFactory.createTerm(c, subres);
+                } catch (InstantiationException e) {
+                    // TODO is it ok to use a Runtime for this? Or should we use a PermError here?
+                    throw new IllegalStateException("Unexpected error creating term: " + e.getMessage());
+                }
+
+            }
+        }
+        return null;
+    }
+
+}

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermDefinition.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermDefinition.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermDefinition.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermDefinition.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,87 @@
+/****************************************************************
+ * 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.jspf.parser;
+
+
+import java.util.regex.Pattern;
+
+/**
+ * Default implementation for the TermDefinition.
+ * This implementation try to retrieve the definition looking up a
+ * static REGEX field in the term class.
+ */
+class DefaultTermDefinition implements TermDefinition {
+
+    private Pattern pattern;
+
+    private Class termDef;
+
+    private int matchSize = 0;
+
+    public DefaultTermDefinition(Class tClass) throws IllegalArgumentException,
+            SecurityException, IllegalAccessException, NoSuchFieldException {
+        String pString = (String) tClass.getField("REGEX").get(null);
+        pattern = Pattern.compile(pString);
+        termDef = tClass;
+        calcGroups(pString);
+    }
+
+    /**
+     * This method should be done differently. We currently don't hanlde the
+     * escaping at all.
+     * 
+     * @param pString
+     */
+    private void calcGroups(String pString) {
+        int i = 0;
+        int c = 0;
+        while (true) {
+            int p1 = pString.indexOf("(", i);
+            int p2 = pString.indexOf("(?:", i);
+            if (p1 < 0)
+                break;
+            if (p1 != p2)
+                c++;
+            i = p1 + 1;
+        }
+        matchSize = c;
+    }
+
+    /**
+     * @see org.apache.james.jspf.parser.TermDefinition#getPattern()
+     */
+    public Pattern getPattern() {
+        return pattern;
+    }
+
+    /**
+     * @see org.apache.james.jspf.parser.TermDefinition#getTermDef()
+     */
+    public Class getTermDef() {
+        return termDef;
+    }
+
+    /**
+     * @see org.apache.james.jspf.parser.TermDefinition#getMatchSize()
+     */
+    public int getMatchSize() {
+        return matchSize;
+    }
+}
\ No newline at end of file

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermDefinition.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermsFactory.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermsFactory.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermsFactory.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermsFactory.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,150 @@
+/****************************************************************
+ * 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.jspf.parser;
+
+import org.apache.james.jspf.core.Configurable;
+import org.apache.james.jspf.core.Configuration;
+import org.apache.james.jspf.core.LogEnabled;
+import org.apache.james.jspf.core.Logger;
+import org.apache.james.jspf.exceptions.PermErrorException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Properties;
+
+/**
+ * The default implementation of the TermsFactory
+ */
+public class DefaultTermsFactory implements TermsFactory {
+    
+    private String termFile = "org/apache/james/jspf/parser/jspf.default.terms";
+    
+    private Collection mechanismsCollection;
+
+    private Collection modifiersCollection;
+
+    private Logger log;
+
+    public DefaultTermsFactory(Logger log) {
+        this.log = log;
+        try {
+            InputStream is = Thread.currentThread().getContextClassLoader()
+                    .getResourceAsStream(termFile);
+            Properties p = new Properties();
+            p.load(is);
+            String mechs = p.getProperty("mechanisms");
+            String mods = p.getProperty("modifiers");
+            String[] classes;
+            classes = mechs.split(",");
+            Class[] knownMechanisms = new Class[classes.length];
+            for (int i = 0; i < classes.length; i++) {
+                log.debug("Add following class as known mechanismn: "
+                        + classes[i]);
+                knownMechanisms[i] = Thread.currentThread()
+                        .getContextClassLoader().loadClass(classes[i]);
+            }
+            mechanismsCollection = createTermDefinitionCollection(knownMechanisms);
+            classes = mods.split(",");
+            Class[] knownModifiers = new Class[classes.length];
+            for (int i = 0; i < classes.length; i++) {
+                log.debug("Add following class as known modifier: "
+                        + classes[i]);
+                knownModifiers[i] = Thread.currentThread()
+                        .getContextClassLoader().loadClass(classes[i]);
+            }
+            modifiersCollection = createTermDefinitionCollection(knownModifiers);
+    
+        } catch (IOException e) {
+            throw new IllegalStateException(
+                    "Term configuration cannot be found");
+        } catch (ClassNotFoundException e) {
+            throw new IllegalStateException(
+                    "One configured class cannot be found");
+        }
+    }
+
+
+    /**
+     * Create a collection of term definitions supported by this factory.
+     * 
+     * @param classes
+     *            classes to analyze
+     * @param staticFieldName
+     *            static field to concatenate
+     * @return map <Class,Pattern>
+     */
+    private Collection createTermDefinitionCollection(Class[] classes) {
+        Collection l = new ArrayList();
+        for (int j = 0; j < classes.length; j++) {
+            try {
+                l.add(new DefaultTermDefinition(classes[j]));
+            } catch (Exception e) {
+                log.debug("Unable to create the term collection", e);
+                throw new IllegalStateException(
+                        "Unable to create the term collection");
+            }
+        }
+        return Collections.synchronizedCollection(l);
+    }
+
+
+    /**
+     * @see org.apache.james.jspf.parser.TermsFactory#createTerm(org.apache.james.jspf.parser.TermDefinition, org.apache.james.jspf.core.MatcherBasedConfiguration)
+     */
+    public Object createTerm(TermDefinition termDef, Configuration subres) throws PermErrorException, InstantiationException {
+        try {
+            Object term = termDef.getTermDef().newInstance();
+            if (term instanceof LogEnabled) {
+                ((LogEnabled) term).enableLogging(log);
+            }
+            if (term instanceof Configurable) {
+                if (subres == null || subres.groupCount() == 0) {
+                    ((Configurable) term).config(null);
+                } else {
+                    ((Configurable) term).config(subres);
+                }
+            }
+            return term;
+        } catch (IllegalAccessException e) {
+            throw new InstantiationException(
+                    "Unexpected error creating term: " + e.getMessage());
+        }
+    }
+
+
+    /**
+     * @see org.apache.james.jspf.parser.TermsFactory#getMechanismsCollection()
+     */
+    public Collection getMechanismsCollection() {
+        return mechanismsCollection;
+    }
+
+
+    /**
+     * @see org.apache.james.jspf.parser.TermsFactory#getModifiersCollection()
+     */
+    public Collection getModifiersCollection() {
+        return modifiersCollection;
+    }
+
+}

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultTermsFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/MatcherBasedConfiguration.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/MatcherBasedConfiguration.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/MatcherBasedConfiguration.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/MatcherBasedConfiguration.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,68 @@
+/****************************************************************
+ * 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.jspf.parser;
+
+import org.apache.james.jspf.core.Configuration;
+
+import java.util.regex.Matcher;
+
+/**
+ * 
+ * Provides a MatchResult view of a subset of another MatchResult
+ */
+public class MatcherBasedConfiguration implements Configuration {
+
+    private Matcher wrapped;
+
+    private int start;
+
+    private int count;
+
+    /**
+     * @param w
+     *            Original MatchResult
+     * @param zero
+     *            The original index returned when group(0) is requested
+     * @param start
+     *            the position where the subresult start
+     * @param count
+     *            number of groups part of the subresult
+     */
+    public MatcherBasedConfiguration(Matcher w, int start, int count) {
+        this.wrapped = w;
+        this.count = count;
+        this.start = start;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.james.jspf.core.Configuration#group(int)
+     */
+    public String group(int arg0) {
+        return wrapped.group(arg0 + start);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.james.jspf.core.Configuration#groupCount()
+     */
+    public int groupCount() {
+        return count;
+    }
+
+}
\ No newline at end of file

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/MatcherBasedConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermDefinition.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermDefinition.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermDefinition.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermDefinition.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,52 @@
+/****************************************************************
+ * 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.jspf.parser;
+
+import java.util.regex.Pattern;
+
+/**
+ * A term definition contains everything needed to match and create
+ * new Terms implementations.
+ */
+public interface TermDefinition {
+
+    /**
+     * Retrieve the pattern to be used to match a string against this record type.
+     * 
+     * @return the pattern for this term
+     */
+    public Pattern getPattern();
+
+    /**
+     * The class implementing this Term type.
+     * 
+     * @return the class object.
+     */
+    public Class getTermDef();
+
+    /**
+     * Return the number of groups to be expected from the pattern of this
+     * Term.
+     * 
+     * @return the number of groups
+     */
+    public int getMatchSize();
+
+}
\ No newline at end of file

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermDefinition.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermsFactory.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermsFactory.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermsFactory.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermsFactory.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,59 @@
+/****************************************************************
+ * 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.jspf.parser;
+
+import org.apache.james.jspf.core.Configuration;
+import org.apache.james.jspf.exceptions.PermErrorException;
+
+import java.util.Collection;
+
+/**
+ * A TermsFactory define the list of known TermDefinition and create new Terms
+ * based on its own Definition and a Configuration
+ */
+public interface TermsFactory {
+
+    /**
+     * Create a new term starting from the TermDefinition created by this factory
+     * 
+     * @param termDef the TermDefinition (returned by this factory)
+     * @param subres (the configuration)
+     * @return the generated object
+     * @throws PermErrorException if something goes wrong
+     * @throws InstantiationException 
+     */
+    public Object createTerm(TermDefinition termDef, Configuration subres)
+            throws PermErrorException, InstantiationException;
+
+    /**
+     * Return the collection of known Mechanisms
+     * 
+     * @return a Collection of TermDefinition 
+     */
+    public Collection getMechanismsCollection();
+
+    /**
+     * Return the collection of known Modifiers
+     * 
+     * @return a Collection of TermDefinition 
+     */
+    public Collection getModifiersCollection();
+
+}
\ No newline at end of file

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/TermsFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AMechanism.java Wed Oct  4 04:20:34 2006
@@ -20,14 +20,14 @@
 
 package org.apache.james.jspf.terms;
 
+import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.DNSService;
 import org.apache.james.jspf.core.IPAddr;
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
-import org.apache.james.jspf.parser.SPF1Parser;
 import org.apache.james.jspf.util.Inet6Util;
-import org.apache.james.jspf.util.ConfigurationMatch;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -42,7 +42,7 @@
      * ABNF: A = "a" [ ":" domain-spec ] [ dual-cidr-length ]
      */
     public static final String REGEX = "[aA]" + "(?:\\:"
-            + SPF1Parser.DOMAIN_SPEC_REGEX + ")?" + "(?:"
+            + SPFTermsRegexps.DOMAIN_SPEC_REGEX + ")?" + "(?:"
             + DUAL_CIDR_LENGTH_REGEX + ")?";
 
     private int ip4cidr;
@@ -105,9 +105,9 @@
     }
 
     /**
-     * @see org.apache.james.jspf.terms.GenericMechanism#config(ConfigurationMatch)
+     * @see org.apache.james.jspf.terms.GenericMechanism#config(Configuration)
      */
-    public synchronized void config(ConfigurationMatch params) throws PermErrorException {
+    public synchronized void config(Configuration params) throws PermErrorException {
         super.config(params);
         if (params.groupCount() >= 2 && params.group(2) != null) {
             ip4cidr = Integer.parseInt(params.group(2).toString());

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AllMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AllMechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AllMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/AllMechanism.java Wed Oct  4 04:20:34 2006
@@ -21,10 +21,10 @@
 package org.apache.james.jspf.terms;
 
 import org.apache.james.jspf.core.Configurable;
+import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.Mechanism;
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.exceptions.PermErrorException;
-import org.apache.james.jspf.util.ConfigurationMatch;
 
 /**
  * This class represent the all mechanism
@@ -42,9 +42,9 @@
     }
 
     /**
-     * @see org.apache.james.jspf.core.Configurable#config(ConfigurationMatch)
+     * @see org.apache.james.jspf.core.Configurable#config(Configuration)
      */
-    public void config(ConfigurationMatch params) throws PermErrorException {
+    public void config(Configuration params) throws PermErrorException {
         // no checks needed
         // the regex only passes with no parameters
     }

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java Wed Oct  4 04:20:34 2006
@@ -25,7 +25,7 @@
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 import java.util.List;
 
@@ -39,7 +39,7 @@
      * ABNF: exists = "exists" ":" domain-spec
      */
     public static final String REGEX = "[eE][xX][iI][sS][tT][sS]" + "\\:"
-            + SPF1Parser.DOMAIN_SPEC_REGEX;
+            + SPFTermsRegexps.DOMAIN_SPEC_REGEX;
 
     /**
      * 

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExpModifier.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExpModifier.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExpModifier.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/ExpModifier.java Wed Oct  4 04:20:34 2006
@@ -28,7 +28,7 @@
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 import java.util.List;
 
@@ -42,7 +42,7 @@
      * ABNF: explanation = "exp" "=" domain-spec
      */
     public static final String REGEX = "[eE][xX][pP]" + "\\="
-            + SPF1Parser.DOMAIN_SPEC_REGEX;
+            + SPFTermsRegexps.DOMAIN_SPEC_REGEX;
 
     private Logger log;
 

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericMechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericMechanism.java Wed Oct  4 04:20:34 2006
@@ -21,13 +21,13 @@
 package org.apache.james.jspf.terms;
 
 import org.apache.james.jspf.core.Configurable;
+import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.LogEnabled;
 import org.apache.james.jspf.core.Logger;
 import org.apache.james.jspf.core.Mechanism;
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.util.ConfigurationMatch;
 
 /**
  * This abstract class represent a gerneric mechanism
@@ -74,9 +74,9 @@
     }
 
     /**
-     * @see org.apache.james.jspf.core.Configurable#config(ConfigurationMatch)
+     * @see org.apache.james.jspf.core.Configurable#config(Configuration)
      */
-    public synchronized void config(ConfigurationMatch params) throws PermErrorException {
+    public synchronized void config(Configuration params) throws PermErrorException {
         if (params.groupCount() >= 1 && params.group(1) != null) {
             domain = params.group(1);
         } else {

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericModifier.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericModifier.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericModifier.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/GenericModifier.java Wed Oct  4 04:20:34 2006
@@ -21,11 +21,11 @@
 package org.apache.james.jspf.terms;
 
 import org.apache.james.jspf.core.Configurable;
+import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.Modifier;
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
-import org.apache.james.jspf.util.ConfigurationMatch;
 
 /**
  * This abstract class represent a gerneric modifier
@@ -43,9 +43,9 @@
             TempErrorException;
 
     /**
-     * @see org.apache.james.jspf.core.Configurable#config(ConfigurationMatch)
+     * @see org.apache.james.jspf.core.Configurable#config(Configuration)
      */
-    public synchronized void config(ConfigurationMatch params) throws PermErrorException {
+    public synchronized void config(Configuration params) throws PermErrorException {
         if (params.groupCount() > 0) {
             this.host = params.group(1);
         }

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IP4Mechanism.java Wed Oct  4 04:20:34 2006
@@ -20,11 +20,11 @@
 
 package org.apache.james.jspf.terms;
 
+import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.IPAddr;
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.util.Inet6Util;
-import org.apache.james.jspf.util.ConfigurationMatch;
 
 /**
  * This class represent the ip4 mechanism
@@ -59,9 +59,9 @@
     }
 
     /**
-     * @see org.apache.james.jspf.terms.GenericMechanism#config(ConfigurationMatch)
+     * @see org.apache.james.jspf.terms.GenericMechanism#config(Configuration)
      */
-    public synchronized void config(ConfigurationMatch params) throws PermErrorException {
+    public synchronized void config(Configuration params) throws PermErrorException {
         if (params.groupCount() == 0) {
             throw new PermErrorException("Missing ip");
         }

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/IncludeMechanism.java Wed Oct  4 04:20:34 2006
@@ -21,6 +21,7 @@
 package org.apache.james.jspf.terms;
 
 import org.apache.james.jspf.core.Configurable;
+import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.LogEnabled;
 import org.apache.james.jspf.core.Logger;
 import org.apache.james.jspf.core.Mechanism;
@@ -31,8 +32,7 @@
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.parser.SPF1Parser;
-import org.apache.james.jspf.util.ConfigurationMatch;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 /**
  * This class represent the incude mechanism
@@ -44,7 +44,7 @@
      * ABNF: include = "include" ":" domain-spec
      */
     public static final String REGEX = "[iI][nN][cC][lL][uU][dD][eE]" + "\\:"
-            + SPF1Parser.DOMAIN_SPEC_REGEX;
+            + SPFTermsRegexps.DOMAIN_SPEC_REGEX;
 
     protected String host;
     
@@ -112,9 +112,9 @@
     }
 
     /**
-     * @see org.apache.james.jspf.core.Configurable#config(ConfigurationMatch)
+     * @see org.apache.james.jspf.core.Configurable#config(Configuration)
      */
-    public synchronized void config(ConfigurationMatch params) throws PermErrorException {
+    public synchronized void config(Configuration params) throws PermErrorException {
         if (params.groupCount() == 0) {
             throw new PermErrorException("Include mechanism without an host");
         }

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/MXMechanism.java Wed Oct  4 04:20:34 2006
@@ -26,7 +26,7 @@
 import org.apache.james.jspf.exceptions.NoneException;
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -41,7 +41,7 @@
      * ABNF: MX = "mx" [ ":" domain-spec ] [ dual-cidr-length ]
      */
     public static final String REGEX = "[mM][xX]" + "(?:\\:"
-            + SPF1Parser.DOMAIN_SPEC_REGEX + ")?" + "(?:"
+            + SPFTermsRegexps.DOMAIN_SPEC_REGEX + ")?" + "(?:"
             + DUAL_CIDR_LENGTH_REGEX + ")?";
 
     /**

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java Wed Oct  4 04:20:34 2006
@@ -25,7 +25,7 @@
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -40,7 +40,7 @@
      * ABNF: PTR = "ptr" [ ":" domain-spec ]
      */
     public static final String REGEX = "[pP][tT][rR]" + "(?:\\:"
-            + SPF1Parser.DOMAIN_SPEC_REGEX + ")?";
+            + SPFTermsRegexps.DOMAIN_SPEC_REGEX + ")?";
 
     /**
      * @see org.apache.james.jspf.core.Mechanism#run(org.apache.james.jspf.core.SPF1Data)

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/RedirectModifier.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/RedirectModifier.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/RedirectModifier.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/RedirectModifier.java Wed Oct  4 04:20:34 2006
@@ -28,7 +28,7 @@
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 /**
  * This class represent the redirect modifier
@@ -40,7 +40,7 @@
      * ABNF: redirect = "redirect" "=" domain-spec
      */
     public static final String REGEX = "[rR][eE][dD][iI][rR][eE][cC][tT]"
-            + "\\=" + SPF1Parser.DOMAIN_SPEC_REGEX;
+            + "\\=" + SPFTermsRegexps.DOMAIN_SPEC_REGEX;
     
     private Logger log;
 

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/UnknownModifier.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/UnknownModifier.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/UnknownModifier.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/terms/UnknownModifier.java Wed Oct  4 04:20:34 2006
@@ -21,11 +21,11 @@
 package org.apache.james.jspf.terms;
 
 import org.apache.james.jspf.core.Configurable;
+import org.apache.james.jspf.core.Configuration;
 import org.apache.james.jspf.core.Modifier;
 import org.apache.james.jspf.core.SPF1Data;
 import org.apache.james.jspf.exceptions.PermErrorException;
-import org.apache.james.jspf.parser.SPF1Parser;
-import org.apache.james.jspf.util.ConfigurationMatch;
+import org.apache.james.jspf.util.SPFTermsRegexps;
 
 /**
  * This Class represent an Unknown Modifier
@@ -37,9 +37,9 @@
      * ABNF: name = ALPHA *( ALPHA / DIGIT / "-" / "_" / "." ) ABNF:
      * unknown-modifier = name "=" macro-string
      */
-    public static final String REGEX = "(" + SPF1Parser.ALPHA_PATTERN + "{1}"
+    public static final String REGEX = "(" + SPFTermsRegexps.ALPHA_PATTERN + "{1}"
             + "[A-Za-z0-9\\-\\_\\.]*" + ")" + "\\=("
-            + SPF1Parser.MACRO_STRING_REGEX + ")";
+            + SPFTermsRegexps.MACRO_STRING_REGEX + ")";
 
     /**
      * @see org.apache.james.jspf.core.Modifier#run(org.apache.james.jspf.core.SPF1Data)
@@ -56,9 +56,9 @@
     }
 
     /**
-     * @see org.apache.james.jspf.core.Configurable#config(ConfigurationMatch)
+     * @see org.apache.james.jspf.core.Configurable#config(Configuration)
      */
-    public synchronized void config(ConfigurationMatch params) throws PermErrorException {
+    public synchronized void config(Configuration params) throws PermErrorException {
         // Nothing to do
     }
 

Added: james/jspf/trunk/src/main/java/org/apache/james/jspf/util/SPFTermsRegexps.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/util/SPFTermsRegexps.java?view=auto&rev=452836
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/util/SPFTermsRegexps.java (added)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/util/SPFTermsRegexps.java Wed Oct  4 04:20:34 2006
@@ -0,0 +1,76 @@
+/****************************************************************
+ * 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.jspf.util;
+
+/**
+ * This constants are used by Terms to define their matching rules.
+ */
+public interface SPFTermsRegexps {
+    
+
+    final String ALPHA_PATTERN = "[a-zA-Z]";
+
+    final String MACRO_LETTER_PATTERN = "[lsodipvhLSODIPVH]";
+
+    final String TRANSFORMERS_REGEX = "\\d*[r]?";
+
+    final String DELEMITER_REGEX = "[\\.\\-\\+,/_\\=]";
+
+    final String MACRO_EXPAND_REGEX = "\\%(?:\\{"
+            + MACRO_LETTER_PATTERN + TRANSFORMERS_REGEX + DELEMITER_REGEX + "*"
+            + "\\}|\\%|\\_|\\-)";
+
+    final String MACRO_LITERAL_REGEX = "[\\x21-\\x24\\x26-\\x7e]";
+
+    /**
+     * ABNF: macro-string = *( macro-expand / macro-literal )
+     */
+    final String MACRO_STRING_REGEX = "(?:" + MACRO_EXPAND_REGEX
+            + "|" + MACRO_LITERAL_REGEX + "{1})*";
+
+
+    final String ALPHA_DIGIT_PATTERN = "[a-zA-Z0-9]";
+
+    /**
+     * ABNF: toplabel = ( *alphanum ALPHA *alphanum ) / ( 1*alphanum "-" *(
+     * alphanum / "-" ) alphanum ) ; LDH rule plus additional TLD restrictions ;
+     * (see [RFC3696], Section 2)
+     */
+    final String TOP_LABEL_REGEX = "(?:"
+            + ALPHA_DIGIT_PATTERN + "*" + SPFTermsRegexps.ALPHA_PATTERN
+            + "{1}" + ALPHA_DIGIT_PATTERN + "*|(?:"
+            + ALPHA_DIGIT_PATTERN + "+" + "\\-" + "(?:"
+            + ALPHA_DIGIT_PATTERN + "|\\-)*"
+            + ALPHA_DIGIT_PATTERN + "))";
+
+    /**
+     * ABNF: domain-end = ( "." toplabel [ "." ] ) / macro-expand
+     */
+    final String DOMAIN_END_REGEX = "(?:\\." + TOP_LABEL_REGEX
+            + "\\.?" + "|" + SPFTermsRegexps.MACRO_EXPAND_REGEX + ")";
+
+    /**
+     * ABNF: domain-spec = macro-string domain-end
+     */
+    final String DOMAIN_SPEC_REGEX = "("
+            + SPFTermsRegexps.MACRO_STRING_REGEX + DOMAIN_END_REGEX + ")";
+
+
+}

Propchange: james/jspf/trunk/src/main/java/org/apache/james/jspf/util/SPFTermsRegexps.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java (original)
+++ james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java Wed Oct  4 04:20:34 2006
@@ -20,7 +20,8 @@
 package org.apache.james.jspf;
 
 import org.apache.james.jspf.core.DNSService;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.core.SPFRecordParser;
+import org.apache.james.jspf.parser.DefaultSPF1Parser;
 import org.jvyaml.Constructor;
 import org.jvyaml.DefaultYAMLFactory;
 import org.jvyaml.YAMLFactory;
@@ -42,7 +43,7 @@
     SPFYamlTestSuite data;
     String test;
     protected SPF spf;
-    protected static SPF1Parser parser;
+    protected static SPFRecordParser parser;
 
     protected AbstractYamlTest(SPFYamlTestSuite def, String test) {
         super(def.getComment()+" #"+test);
@@ -116,7 +117,7 @@
         System.out.println("testing "+next+": "+currentTest.get("description"));
     
         if (parser == null) {
-            parser = new SPF1Parser(new ConsoleLogger());
+            parser = new DefaultSPF1Parser(new ConsoleLogger());
             System.err.println("--------------------------------------------");
         }
         spf = new SPF(new LoggingDNSService(getDNSService()), parser, new ConsoleLogger());

Modified: james/jspf/trunk/src/test/java/org/apache/james/jspf/SPF1ParserTest.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/test/java/org/apache/james/jspf/SPF1ParserTest.java?view=diff&rev=452836&r1=452835&r2=452836
==============================================================================
--- james/jspf/trunk/src/test/java/org/apache/james/jspf/SPF1ParserTest.java (original)
+++ james/jspf/trunk/src/test/java/org/apache/james/jspf/SPF1ParserTest.java Wed Oct  4 04:20:34 2006
@@ -28,9 +28,10 @@
 import java.util.Iterator;
 import java.util.regex.Pattern;
 
+import org.apache.james.jspf.core.SPFRecordParser;
 import org.apache.james.jspf.exceptions.NoneException;
 import org.apache.james.jspf.exceptions.PermErrorException;
-import org.apache.james.jspf.parser.SPF1Parser;
+import org.apache.james.jspf.parser.DefaultSPF1Parser;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -50,7 +51,7 @@
             }
         }
         assertNotNull(data);
-        parser = new SPF1Parser(new ConsoleLogger());
+        parser = new DefaultSPF1Parser(new ConsoleLogger());
     }
 
     public static Test suite() throws IOException {
@@ -59,9 +60,9 @@
 
     private SPF1RecordTestDef data;
 
-    private SPF1Parser parser;
+    private SPFRecordParser parser;
 
-    public SPF1ParserTest(SPF1RecordTestDef def, SPF1Parser parser) {
+    public SPF1ParserTest(SPF1RecordTestDef def, SPFRecordParser parser) {
         super(def.recIn);
         this.data = def;
         this.parser = parser;
@@ -176,7 +177,7 @@
             super();
             List tests = loadTests();
             Iterator i = tests.iterator();
-            SPF1Parser parser = new SPF1Parser(new ConsoleLogger());
+            SPFRecordParser parser = new DefaultSPF1Parser(new ConsoleLogger());
             while (i.hasNext()) {
                 addTest(new SPF1ParserTest((SPF1RecordTestDef) i.next(), parser));
             }



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