james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r801912 - in /james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf: core/ executor/ impl/ parser/ policies/ policies/local/ terms/ wiring/
Date Fri, 07 Aug 2009 08:43:58 GMT
Author: norman
Date: Fri Aug  7 08:43:57 2009
New Revision: 801912

URL: http://svn.apache.org/viewvc?rev=801912&view=rev
Log:
More Generics (JSPF-78)

Modified:
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/DNSService.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/SPF1Record.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponse.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponseImpl.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/StagedMultipleSPFExecutor.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermDefinition.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermsFactory.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermDefinition.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermsFactory.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/NeutralIfNotMatchPolicy.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/SPFStrictCheckerRetriever.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/AMechanism.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExpModifier.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/wiring/WiringServiceTable.java

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/DNSService.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/DNSService.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/DNSService.java (original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/DNSService.java Fri
Aug  7 08:43:57 2009
@@ -36,7 +36,7 @@
      * @return an array of Strings representing the records
      * @throws TimeoutException
      */
-    public List getRecords(DNSRequest request) throws TimeoutException;
+    public List<String> getRecords(DNSRequest request) throws TimeoutException;
 
     /**
      * Try to get all domain names for the running host

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/SPF1Record.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/SPF1Record.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/SPF1Record.java (original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/SPF1Record.java Fri
Aug  7 08:43:57 2009
@@ -24,6 +24,9 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.james.jspf.terms.Directive;
+import org.apache.james.jspf.terms.Modifier;
+
 /**
  * The Class represent the SPF1 Record and provide methods to get all directives
  * and modifiers.
@@ -32,8 +35,8 @@
 public class SPF1Record {
     
     private String record;
-    private List directives = new ArrayList();
-    private List modifiers = new ArrayList();
+    private List<Directive> directives = new ArrayList<Directive>();
+    private List<Modifier> modifiers = new ArrayList<Modifier>();
 
     public SPF1Record() {
         this.record = null;
@@ -49,7 +52,7 @@
      * @return directives Collection of all qualifier+mechanism which should be
      *         used
      */
-    public List getDirectives() {
+    public List<Directive> getDirectives() {
         return directives;
     }
 
@@ -58,7 +61,7 @@
      * 
      * @return modifiers Collection of all modifiers which should be used
      */
-    public List getModifiers() {
+    public List<Modifier> getModifiers() {
         return modifiers;
     }
 
@@ -74,7 +77,8 @@
      * 
      * @return a chained iterator of the terms
      */
-    public Iterator iterator() {
+    @SuppressWarnings("unchecked")
+	public Iterator<SPFChecker> iterator() {
         return new Iterator() {
             boolean first = true;
             Iterator current = getDirectives().iterator();

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponse.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponse.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponse.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponse.java
Fri Aug  7 08:43:57 2009
@@ -19,6 +19,8 @@
 
 package org.apache.james.jspf.executor;
 
+import java.util.List;
+
 public interface IResponse {
     
     /**
@@ -33,7 +35,7 @@
      * 
      * @return object
      */
-    public Object getValue();
+    public List<String> getValue();
     
     /**
      * Return the exception which was stored for the IResponse object

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponseImpl.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponseImpl.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponseImpl.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/IResponseImpl.java
Fri Aug  7 08:43:57 2009
@@ -28,7 +28,7 @@
  */
 public class IResponseImpl implements IResponse {
     private Exception exception = null;
-    private List value = null;
+    private List<String> value = null;
     private Object id = null;
     
     public IResponseImpl(Object id, Exception e) {
@@ -36,7 +36,7 @@
         this.id = id;
     }
     
-    public IResponseImpl(Object id, List result) {
+    public IResponseImpl(Object id, List<String> result) {
         this.value = result;
         this.id = id;
     }
@@ -58,7 +58,7 @@
     /**
      * @see org.apache.james.jspf.executor.IResponse#getValue()
      */
-    public Object getValue() {
+    public List<String> getValue() {
         return value;
     }
 }
\ No newline at end of file

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/StagedMultipleSPFExecutor.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/StagedMultipleSPFExecutor.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/StagedMultipleSPFExecutor.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/executor/StagedMultipleSPFExecutor.java
Fri Aug  7 08:43:57 2009
@@ -31,7 +31,6 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -184,7 +183,7 @@
             if (resp.getException() != null) {
                 response = new DNSResponse((TimeoutException) resp.getException());
             } else {
-                response = new DNSResponse((List) resp.getValue());
+                response = new DNSResponse(resp.getValue());
             }
             
             

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java
Fri Aug  7 08:43:57 2009
@@ -19,6 +19,8 @@
 
 package org.apache.james.jspf.impl;
 
+import java.util.List;
+
 import org.apache.james.jspf.core.DNSRequest;
 import org.apache.james.jspf.core.exceptions.TimeoutException;
 import org.apache.james.jspf.executor.DNSAsynchLookupService;
@@ -85,7 +87,7 @@
                             return id;
                         }
 
-                        public Object getValue() {
+                        public List<String> getValue() {
                             return (DNSServiceXBillImpl.convertRecordsToList(lookup.getAnswers()));
                         }
                         

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java
Fri Aug  7 08:43:57 2009
@@ -130,7 +130,7 @@
     /**
      * @see org.apache.james.jspf.core.DNSService#getRecords(org.apache.james.jspf.core.DNSRequest)
      */
-    public List getRecords(DNSRequest request)
+    public List<String> getRecords(DNSRequest request)
             throws TimeoutException {
         String recordTypeDescription;
         int dnsJavaType;
@@ -159,7 +159,7 @@
                 throw new TimeoutException(query.getErrorString());
             }
             
-            List records = convertRecordsToList(rr);
+            List<String> records = convertRecordsToList(rr);
             
             log.debug("Found " + (rr != null ? rr.length : 0) + " "+recordTypeDescription+"-Records");
             return records;
@@ -176,10 +176,11 @@
      * @param rr Record array
      * @return list
      */
-    public static List convertRecordsToList(Record[] rr) {
-        List records;
+    @SuppressWarnings("unchecked")
+	public static List<String> convertRecordsToList(Record[] rr) {
+        List<String> records;
         if (rr != null && rr.length > 0) {
-            records = new ArrayList();
+            records = new ArrayList<String>();
             for (int i = 0; i < rr.length; i++) {
                 switch (rr[i].getType()) {
                     case Type.A:
@@ -201,10 +202,10 @@
                     case Type.TXT:
                         TXTRecord txt = (TXTRecord) rr[i];
                         if (txt.getStrings().size() == 1) {
-                            records.add(txt.getStrings().get(0));
+                            records.add((String)txt.getStrings().get(0));
                         } else {
                             StringBuffer sb = new StringBuffer();
-                            for (Iterator it = txt.getStrings().iterator(); it
+                            for (Iterator<String> it = txt.getStrings().iterator();
it
                                     .hasNext();) {
                                 String k = (String) it.next();
                                 sb.append(k);
@@ -215,10 +216,10 @@
                     case Type.SPF:
                         SPFRecord spf = (SPFRecord) rr[i];
                         if (spf.getStrings().size() == 1) {
-                            records.add(spf.getStrings().get(0));
+                            records.add((String)spf.getStrings().get(0));
                         } else {
                             StringBuffer sb = new StringBuffer();
-                            for (Iterator it = spf.getStrings().iterator(); it
+                            for (Iterator<String> it = spf.getStrings().iterator();
it
                                     .hasNext();) {
                                 String k = (String) it.next();
                                 sb.append(k);

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermDefinition.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermDefinition.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermDefinition.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermDefinition.java
Fri Aug  7 08:43:57 2009
@@ -33,11 +33,11 @@
 
     private Pattern pattern;
 
-    private Class termDef;
+    private Class<?> termDef;
 
     private int matchSize = 0;
 
-    public DefaultTermDefinition(Class tClass) throws IllegalArgumentException,
+    public DefaultTermDefinition(Class<?> tClass) throws IllegalArgumentException,
             SecurityException, IllegalAccessException, NoSuchFieldException {
         String pString = (String) tClass.getField("REGEX").get(null);
         pattern = Pattern.compile(pString);
@@ -76,7 +76,7 @@
     /**
      * @see org.apache.james.jspf.parser.TermDefinition#getTermDef()
      */
-    public Class getTermDef() {
+    public Class<?> getTermDef() {
         return termDef;
     }
 

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermsFactory.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermsFactory.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermsFactory.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/DefaultTermsFactory.java
Fri Aug  7 08:43:57 2009
@@ -22,6 +22,7 @@
 import org.apache.james.jspf.core.LogEnabled;
 import org.apache.james.jspf.core.Logger;
 import org.apache.james.jspf.core.exceptions.PermErrorException;
+import org.apache.james.jspf.parser.TermDefinition;
 import org.apache.james.jspf.parser.TermsFactory;
 import org.apache.james.jspf.terms.Configuration;
 import org.apache.james.jspf.terms.ConfigurationEnabled;
@@ -43,9 +44,9 @@
     
     private String termFile = "org/apache/james/jspf/parser/jspf.default.terms";
     
-    private Collection mechanismsCollection;
+    private Collection<TermDefinition> mechanismsCollection;
 
-    private Collection modifiersCollection;
+    private Collection<TermDefinition> modifiersCollection;
 
     private Logger log;
     
@@ -80,7 +81,7 @@
             String mods = p.getProperty("modifiers");
             String[] classes;
             classes = mechs.split(",");
-            Class[] knownMechanisms = new Class[classes.length];
+            Class<?>[] knownMechanisms = new Class[classes.length];
             for (int i = 0; i < classes.length; i++) {
                 log.debug("Add following class as known mechanismn: "
                         + classes[i]);
@@ -89,7 +90,7 @@
             }
             mechanismsCollection = createTermDefinitionCollection(knownMechanisms);
             classes = mods.split(",");
-            Class[] knownModifiers = new Class[classes.length];
+            Class<?>[] knownModifiers = new Class[classes.length];
             for (int i = 0; i < classes.length; i++) {
                 log.debug("Add following class as known modifier: "
                         + classes[i]);
@@ -117,8 +118,8 @@
      *            static field to concatenate
      * @return map <Class,Pattern>
      */
-    private Collection createTermDefinitionCollection(Class[] classes) {
-        Collection l = new ArrayList();
+    private Collection<TermDefinition> createTermDefinitionCollection(Class<?>[]
classes) {
+        Collection<TermDefinition> l = new ArrayList<TermDefinition>();
         for (int j = 0; j < classes.length; j++) {
             try {
                 l.add(new DefaultTermDefinition(classes[j]));
@@ -135,7 +136,7 @@
     /**
      * @see org.apache.james.jspf.parser.TermsFactory#createTerm(java.lang.Class, org.apache.james.jspf.terms.Configuration)
      */
-    public Object createTerm(Class termDef, Configuration subres) throws PermErrorException,
InstantiationException {
+    public Object createTerm(Class<?> termDef, Configuration subres) throws PermErrorException,
InstantiationException {
         try {
             Object term = termDef.newInstance();
             
@@ -164,7 +165,7 @@
     /**
      * @see org.apache.james.jspf.parser.TermsFactory#getMechanismsCollection()
      */
-    public Collection getMechanismsCollection() {
+    public Collection<TermDefinition> getMechanismsCollection() {
         return mechanismsCollection;
     }
 
@@ -172,7 +173,7 @@
     /**
      * @see org.apache.james.jspf.parser.TermsFactory#getModifiersCollection()
      */
-    public Collection getModifiersCollection() {
+    public Collection<TermDefinition> getModifiersCollection() {
         return modifiersCollection;
     }
 

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java (original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/impl/SPF.java Fri Aug  7
08:43:57 2009
@@ -81,16 +81,16 @@
             // make sure we cleanup the record, for recursion support
             spfData.removeAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
             
-            LinkedList policyCheckers = new LinkedList();
+            LinkedList<SPFChecker> policyCheckers = new LinkedList<SPFChecker>();
             
-            Iterator i = spfRecord.iterator();
+            Iterator<SPFChecker> i = spfRecord.iterator();
             while (i.hasNext()) {
-                SPFChecker checker = (SPFChecker) i.next();
+                SPFChecker checker = i.next();
                 policyCheckers.add(checker);
             }
 
             while (policyCheckers.size() > 0) {
-                SPFChecker removeLast = (SPFChecker) policyCheckers.removeLast();
+                SPFChecker removeLast = policyCheckers.removeLast();
                 spfData.pushChecker(removeLast);
             }
 
@@ -100,9 +100,9 @@
 
     private static final class PolicyChecker implements SPFChecker {
         
-        private LinkedList policies;
+        private LinkedList<SPFChecker> policies;
         
-        public PolicyChecker(LinkedList policies) {
+        public PolicyChecker(LinkedList<SPFChecker> policies) {
             this.policies = policies;
         }
         
@@ -114,7 +114,7 @@
                 NeutralException, NoneException {
             
             while (policies.size() > 0) {
-                SPFChecker removeLast = (SPFChecker) policies.removeLast();
+                SPFChecker removeLast = policies.removeLast();
                 spfData.pushChecker(removeLast);
             }
             
@@ -344,9 +344,9 @@
     /**
      * Return a default policy for SPF
      */
-    public LinkedList getPolicies() {
+    public LinkedList<SPFChecker> getPolicies() {
 
-        LinkedList policies = new LinkedList();
+        LinkedList<SPFChecker> policies = new LinkedList<SPFChecker>();
         
         if (override != null) {
             policies.add(new SPFPolicyChecker(override));

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java
Fri Aug  7 08:43:57 2009
@@ -105,7 +105,7 @@
 
     private int TERM_STEP_REGEX_MODIFIER_POS;
 
-    private List matchResultPositions;
+    private List<TermDefinition> matchResultPositions;
 
     private Logger log;
 
@@ -160,21 +160,21 @@
      * regex.
      */
     private void initializePositions() {
-        ArrayList matchResultPositions = new ArrayList();
+        ArrayList<TermDefinition> matchResultPositions = new ArrayList<TermDefinition>();
 
         // FULL MATCH
         int posIndex = 0;
         matchResultPositions.ensureCapacity(posIndex + 1);
         matchResultPositions.add(posIndex, null);
 
-        Iterator i;
+        Iterator<TermDefinition> 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();
+            TermDefinition td = i.next();
             int size = td.getMatchSize() + 1;
             for (int k = 0; k < size; k++) {
                 posIndex++;
@@ -192,7 +192,7 @@
         matchResultPositions.add(TERM_STEP_REGEX_MECHANISM_POS, null);
         i = termsFactory.getMechanismsCollection().iterator();
         while (i.hasNext()) {
-            TermDefinition td = (TermDefinition) i.next();
+            TermDefinition td = i.next();
             int size = td.getMatchSize() + 1;
             for (int k = 0; k < size; k++) {
                 posIndex++;
@@ -230,9 +230,9 @@
      *            static field to concatenate
      * @return regex The regex
      */
-    private String createRegex(Collection commandMap) {
+    private String createRegex(Collection<TermDefinition> commandMap) {
         StringBuffer modifierRegex = new StringBuffer();
-        Iterator i = commandMap.iterator();
+        Iterator<TermDefinition> i = commandMap.iterator();
         boolean first = true;
         while (i.hasNext()) {
             if (first) {
@@ -241,7 +241,7 @@
             } else {
                 modifierRegex.append(")|(");
             }
-            Pattern pattern = ((TermDefinition) i.next()).getPattern();
+            Pattern pattern = i.next().getPattern();
             modifierRegex.append(pattern.pattern());
         }
         modifierRegex.append("))");
@@ -290,7 +290,7 @@
                             TERM_STEP_REGEX_MODIFIER_POS);
 
                     if (mod.enforceSingleInstance()) {
-                        Iterator it = result.getModifiers().iterator();
+                        Iterator<Modifier> it = result.getModifiers().iterator();
                         while (it.hasNext()) {
                             if (it.next().getClass().equals(mod.getClass())) {
                                 throw new PermErrorException("More than one "

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermDefinition.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermDefinition.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermDefinition.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermDefinition.java
Fri Aug  7 08:43:57 2009
@@ -39,7 +39,7 @@
      * 
      * @return the class object.
      */
-    public Class getTermDef();
+    public Class<?> getTermDef();
 
     /**
      * Return the number of groups to be expected from the pattern of this

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermsFactory.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermsFactory.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermsFactory.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/parser/TermsFactory.java
Fri Aug  7 08:43:57 2009
@@ -39,7 +39,7 @@
      * @throws PermErrorException if something goes wrong
      * @throws InstantiationException 
      */
-    public Object createTerm(Class klass, Configuration subres)
+    public Object createTerm(Class<?> klass, Configuration subres)
             throws PermErrorException, InstantiationException;
 
     /**
@@ -47,13 +47,13 @@
      * 
      * @return a Collection of TermDefinition 
      */
-    public Collection getMechanismsCollection();
+    public Collection<TermDefinition> getMechanismsCollection();
 
     /**
      * Return the collection of known Modifiers
      * 
      * @return a Collection of TermDefinition 
      */
-    public Collection getModifiersCollection();
+    public Collection<TermDefinition> getModifiersCollection();
 
 }
\ No newline at end of file

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/NeutralIfNotMatchPolicy.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/NeutralIfNotMatchPolicy.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/NeutralIfNotMatchPolicy.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/NeutralIfNotMatchPolicy.java
Fri Aug  7 08:43:57 2009
@@ -23,18 +23,18 @@
 import org.apache.james.jspf.core.SPF1Constants;
 import org.apache.james.jspf.core.SPFSession;
 import org.apache.james.jspf.core.SPF1Record;
-import org.apache.james.jspf.core.SPFChecker;
 import org.apache.james.jspf.core.exceptions.NeutralException;
 import org.apache.james.jspf.core.exceptions.NoneException;
 import org.apache.james.jspf.core.exceptions.PermErrorException;
 import org.apache.james.jspf.core.exceptions.TempErrorException;
+import org.apache.james.jspf.terms.Modifier;
 
 /**
  * Sets the result to NEUTRAL if no directive is found 
  */
 public class NeutralIfNotMatchPolicy implements PolicyPostFilter {
     
-    private final class NeutralIfNotMatchModifier implements SPFChecker {
+    private final class NeutralIfNotMatchModifier implements Modifier {
         
         /**
          * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
@@ -50,6 +50,14 @@
         public String toString() {
             return "defaultresult";
         }
+
+        /**
+         * (non-Javadoc)
+         * @see org.apache.james.jspf.terms.Modifier#enforceSingleInstance()
+         */
+		public boolean enforceSingleInstance() {
+			return false;
+		}
     }
 
     /**

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/SPFStrictCheckerRetriever.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/SPFStrictCheckerRetriever.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/SPFStrictCheckerRetriever.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/SPFStrictCheckerRetriever.java
Fri Aug  7 08:43:57 2009
@@ -48,14 +48,15 @@
         /**
          * @see org.apache.james.jspf.core.SPFCheckerDNSResponseListener#onDNSResponse(org.apache.james.jspf.core.DNSResponse,
org.apache.james.jspf.core.SPFSession)
          */
-        public DNSLookupContinuation onDNSResponse(
+        @SuppressWarnings("unchecked")
+		public DNSLookupContinuation onDNSResponse(
                 DNSResponse response, SPFSession session)
                 throws PermErrorException,
                 NoneException, TempErrorException,
                 NeutralException {
             
-            List spfR = (List) session.getAttribute(ATTRIBUTE_SPFSTRICT_CHECK_SPFRECORDS);
-            List spfTxtR = null;
+            List<String> spfR = (List<String>) session.getAttribute(ATTRIBUTE_SPFSTRICT_CHECK_SPFRECORDS);
+            List<String> spfTxtR = null;
             try {
                 spfTxtR = response.getResponse();
             } catch (TimeoutException e) {
@@ -84,7 +85,7 @@
                 throws PermErrorException, NoneException,
                 TempErrorException, NeutralException {
             try {
-                List spfR = response.getResponse();
+                List<String> spfR = response.getResponse();
                 
                 session.setAttribute(ATTRIBUTE_SPFSTRICT_CHECK_SPFRECORDS, spfR);
                 
@@ -117,7 +118,7 @@
     }
 
 
-    private static String calculateSpfRecord(List spfR, List spfTxtR)
+    private static String calculateSpfRecord(List<String> spfR, List<String>
spfTxtR)
             throws PermErrorException {
         String spfR1 = null;
         String spfR2 = null;

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
Fri Aug  7 08:43:57 2009
@@ -32,6 +32,7 @@
 import org.apache.james.jspf.core.exceptions.PermErrorException;
 import org.apache.james.jspf.core.exceptions.TempErrorException;
 import org.apache.james.jspf.policies.PolicyPostFilter;
+import org.apache.james.jspf.terms.Modifier;
 
 /**
  * Policy to add a default explanation
@@ -61,7 +62,7 @@
         }
     }
 
-    private final class DefaultExplanationChecker implements SPFChecker {
+    private final class DefaultExplanationChecker implements Modifier {
         
         private SPFChecker explanationCheckr = new ExplanationChecker();
         
@@ -94,6 +95,14 @@
                 return "defaultExplanation="+defExplanation;
             }
         }
+
+        /**
+         * (non-Javadoc)
+         * @see org.apache.james.jspf.terms.Modifier#enforceSingleInstance()
+         */
+		public boolean enforceSingleInstance() {
+			return false;
+		}
     }
 
     private static final String ATTRIBUTE_DEFAULT_EXPLANATION_POLICY_EXPLANATION = "DefaultExplanationPolicy.explanation";

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/AMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/AMechanism.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/AMechanism.java (original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/AMechanism.java Fri
Aug  7 08:43:57 2009
@@ -76,7 +76,7 @@
                 spfData.setAttribute(ATTRIBUTE_AMECHANISM_IPV4CHECK, Boolean.valueOf(validIPV4Address));
                 if (validIPV4Address) {
 
-                    List aRecords = getARecords(host);
+                    List<String> aRecords = getARecords(host);
                     if (aRecords == null) {
                         try {
                             DNSRequest request = new DNSRequest(host, DNSRequest.A);
@@ -90,7 +90,7 @@
          
                 } else {
                     
-                    List aaaaRecords = getAAAARecords(host);
+                    List<String> aaaaRecords = getAAAARecords(host);
                     if (aaaaRecords == null) {
                         try {
                             DNSRequest request = new DNSRequest(host, DNSRequest.AAAA);
@@ -159,10 +159,10 @@
      * @return true or false
      * @throws PermErrorException 
      */
-    public boolean checkAddressList(IPAddr checkAddress, List addressList, int cidr) throws
PermErrorException {
+    public boolean checkAddressList(IPAddr checkAddress, List<String> addressList,
int cidr) throws PermErrorException {
 
         for (int i = 0; i < addressList.size(); i++) {
-            String ip = (String) addressList.get(i);
+            String ip = addressList.get(i);
 
             // Check for empty record
             if (ip != null) {
@@ -221,11 +221,11 @@
     /**
      * Retrieve a list of AAAA records
      */
-    public List getAAAARecords(String strServer) {
-        List listAAAAData = null;
+    public List<String> getAAAARecords(String strServer) {
+        List<String> listAAAAData = null;
         if (IPAddr.isIPV6(strServer)) {
             // Address is already an IP address, so add it to list
-            listAAAAData = new ArrayList();
+            listAAAAData = new ArrayList<String>();
             listAAAAData.add(strServer);
         }
         return listAAAAData;
@@ -239,10 +239,10 @@
      *            The hostname or ipAddress whe should get the A-Records for
      * @return The ipAddresses
      */
-    public List getARecords(String strServer) {
-        List listAData = null;
+    public List<String> getARecords(String strServer) {
+        List<String> listAData = null;
         if (IPAddr.isIPAddr(strServer)) {
-            listAData = new ArrayList();
+            listAData = new ArrayList<String>();
             listAData.add(strServer);
         }
         return listAData;
@@ -253,7 +253,7 @@
      */
     public DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession)
         throws PermErrorException, TempErrorException, NoneException, NeutralException {
-        List listAData = null;
+        List<String> listAData = null;
         try {
             listAData = response.getResponse();
         } catch (TimeoutException e) {

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExistsMechanism.java
Fri Aug  7 08:43:57 2009
@@ -78,7 +78,7 @@
      * @see org.apache.james.jspf.core.SPFCheckerDNSResponseListener#onDNSResponse(org.apache.james.jspf.core.DNSResponse,
org.apache.james.jspf.core.SPFSession)
      */
     public DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession)
throws PermErrorException, TempErrorException {
-        List aRecords;
+        List<String> aRecords;
         
         try {
             aRecords = response.getResponse();

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExpModifier.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExpModifier.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExpModifier.java (original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/ExpModifier.java Fri
Aug  7 08:43:57 2009
@@ -152,7 +152,7 @@
      */
     public DNSLookupContinuation onDNSResponse(DNSResponse lookup, SPFSession spfData) throws
PermErrorException, TempErrorException, NeutralException, NoneException {
         try {
-            List records = lookup.getResponse();
+            List<String> records = lookup.getResponse();
         
             if (records == null) {
                 return null;
@@ -170,7 +170,7 @@
                 
             } else {
                 
-                String exp = (String) records.get(0);
+                String exp = records.get(0);
                 if (exp.length()>=2 && exp.charAt(0) == '"' && exp.charAt(exp.length()
-1 ) == '"') {
                     exp = exp.substring(1, exp.length() - 1);
                 }

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/MXMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/MXMechanism.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/MXMechanism.java (original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/MXMechanism.java Fri
Aug  7 08:43:57 2009
@@ -86,12 +86,13 @@
     /**
      * @see org.apache.james.jspf.terms.AMechanism#onDNSResponse(org.apache.james.jspf.core.DNSResponse,
org.apache.james.jspf.core.SPFSession)
      */
-    public DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession)
+    @SuppressWarnings("unchecked")
+	public DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession)
         throws PermErrorException, TempErrorException, NoneException, NeutralException {
         try {
             
-            List records = (List) spfSession.getAttribute(ATTRIBUTE_CHECK_RECORDS);
-            List mxR = (List) spfSession.getAttribute(ATTRIBUTE_MX_RECORDS);
+            List<String> records = (List<String>) spfSession.getAttribute(ATTRIBUTE_CHECK_RECORDS);
+            List<String> mxR = (List<String>) spfSession.getAttribute(ATTRIBUTE_MX_RECORDS);
 
             if (records == null) {
             
@@ -107,11 +108,11 @@
                 
             } else {
                 
-                List res = response.getResponse();
+                List<String> res = response.getResponse();
 
                 if (res != null) {
                     if (mxR == null) {
-                        mxR = new ArrayList();
+                        mxR = new ArrayList<String>();
                         spfSession.setAttribute(ATTRIBUTE_MX_RECORDS, mxR);
                     }
                     mxR.addAll(res);
@@ -123,7 +124,7 @@
             boolean isIPv6 = IPAddr.isIPV6(spfSession.getIpAddress());
 
             String mx;
-            while (records.size() > 0 && (mx = (String) records.remove(0)) !=
null && mx.length() > 0) {
+            while (records.size() > 0 && (mx = records.remove(0)) != null &&
mx.length() > 0) {
                 log.debug("Add MX-Record " + mx + " to list");
 
                 return new DNSLookupContinuation(new DNSRequest(mx, isIPv6 ? DNSRequest.AAAA
: DNSRequest.A), MXMechanism.this);

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/terms/PTRMechanism.java
Fri Aug  7 08:43:57 2009
@@ -120,10 +120,11 @@
     /**
      * @see org.apache.james.jspf.core.SPFCheckerDNSResponseListener#onDNSResponse(org.apache.james.jspf.core.DNSResponse,
org.apache.james.jspf.core.SPFSession)
      */
-    public DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession)
+    @SuppressWarnings("unchecked")
+	public DNSLookupContinuation onDNSResponse(DNSResponse response, SPFSession spfSession)
             throws PermErrorException, TempErrorException, NoneException, NeutralException
{
         
-        List domainList = (List) spfSession.getAttribute(ATTRIBUTE_DOMAIN_LIST);
+        List<String> domainList = (List<String>) spfSession.getAttribute(ATTRIBUTE_DOMAIN_LIST);
         try {
             if (domainList == null) {
             
@@ -150,7 +151,7 @@
                 String compareDomain = (String) spfSession.getAttribute(ATTRIBUTE_CURRENT_DOMAIN);
                 String host = (String) spfSession.getAttribute(ATTRIBUTE_EXPANDED_HOST);
     
-                List aList = response.getResponse();
+                List<String> aList = response.getResponse();
     
 
                 if (aList != null) {

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/wiring/WiringServiceTable.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/wiring/WiringServiceTable.java?rev=801912&r1=801911&r2=801912&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/wiring/WiringServiceTable.java
(original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/wiring/WiringServiceTable.java
Fri Aug  7 08:43:57 2009
@@ -29,7 +29,7 @@
  * This class associates "Enabling interfaces" to the service that provides the
  * dependency.
  */
-public class WiringServiceTable extends Hashtable implements WiringService {
+public class WiringServiceTable extends Hashtable<Class<?>,Object> implements
WiringService {
 
     private static final long serialVersionUID = -9151935136150279119L;
 
@@ -37,9 +37,9 @@
      * @see org.apache.james.jspf.wiring.WiringService#wire(java.lang.Object)
      */
     public void wire(Object component) throws WiringServiceException {
-        Iterator i = keySet().iterator();
+        Iterator<Class<?>> i = keySet().iterator();
         while (i.hasNext()) {
-            Class enablingClass = (Class) i.next();
+            Class<?> enablingClass = i.next();
             if (enablingClass.isInstance(component)) {
                 Method[] m = enablingClass.getDeclaredMethods();
                 if (m!=null && m.length == 1 && m[0] != null) {



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


Mime
View raw message