james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r573848 - in /james/jspf/trunk/src: main/java/org/apache/james/jspf/ main/java/org/apache/james/jspf/core/ main/java/org/apache/james/jspf/dns/ main/java/org/apache/james/jspf/impl/ main/java/org/apache/james/jspf/macro/ main/java/org/apach...
Date Sat, 08 Sep 2007 14:51:06 GMT
Author: norman
Date: Sat Sep  8 07:51:05 2007
New Revision: 573848

URL: http://svn.apache.org/viewvc?rev=573848&view=rev
Log:
Add some more javadocs
Rename the DefaultSPF1Parser to RFC4408SPF1Parser and declare it final (because its a "RFC"
implementation)
Fix a synchronize issue..

Added:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java
      - copied, changed from r573326, james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java
Removed:
    james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.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/SPF1Record.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Utils.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerDNSResponseListener.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerExceptionCatcher.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFResult.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/dns/DNSRequest.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java
    james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.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?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- 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 Sat Sep  8 07:51:05 2007
@@ -41,7 +41,7 @@
 import org.apache.james.jspf.executor.SPFExecutor;
 import org.apache.james.jspf.executor.SynchronousSPFExecutor;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.parser.DefaultSPF1Parser;
+import org.apache.james.jspf.parser.RFC4408SPF1Parser;
 import org.apache.james.jspf.parser.DefaultTermsFactory;
 import org.apache.james.jspf.policies.InitialChecksPolicy;
 import org.apache.james.jspf.policies.NeutralIfNotMatchPolicy;
@@ -255,7 +255,7 @@
         wiringService.put(DNSServiceEnabled.class, this.dnsProbe);
         this.macroExpand = new MacroExpand(logger.getChildLogger("macroExpand"), this.dnsProbe);
         wiringService.put(MacroExpandEnabled.class, this.macroExpand);
-        this.parser = new DefaultSPF1Parser(logger.getChildLogger("parser"), new DefaultTermsFactory(logger.getChildLogger("termsfactory"),
wiringService));
+        this.parser = new RFC4408SPF1Parser(logger.getChildLogger("parser"), new DefaultTermsFactory(logger.getChildLogger("termsfactory"),
wiringService));
         // We add this after the parser creation because services cannot be null
         wiringService.put(SPFCheckEnabled.class, this);
         this.executor = new SynchronousSPFExecutor(log, dnsProbe);

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Record.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Record.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Record.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Record.java Sat Sep  8 07:51:05
2007
@@ -32,6 +32,8 @@
 public class SPF1Record {
     
     private String record;
+    private List directives = new ArrayList();
+    private List modifiers = new ArrayList();
 
     public SPF1Record() {
         this.record = null;
@@ -40,10 +42,6 @@
     public SPF1Record(String record) {
         this.record = record;
     }
-
-    private List directives = new ArrayList();
-
-    private List modifiers = new ArrayList();
 
     /**
      * Return the directives as Collection

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Utils.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Utils.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Utils.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPF1Utils.java Sat Sep  8 07:51:05
2007
@@ -33,8 +33,8 @@
 public class SPF1Utils {
 
     public static final String DEFAULT_EXPLANATION = "http://www.openspf.org/why.html?sender=%{S}&ip=%{I}";
-    
     public static final String BEST_GUESS_RECORD = "v=spf1 a/24 mx/24 ptr ?all";
+    public static final String ATTRIBUTE_SPF1_RECORD = "SPF.SPF1Record";
 
     /**
      * Convert raw SPF results to SPF names
@@ -72,7 +72,4 @@
             return false;
         }
     }
-
-    public static final String ATTRIBUTE_SPF1_RECORD = "SPF.SPF1Record";
-
 }

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerDNSResponseListener.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerDNSResponseListener.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerDNSResponseListener.java
(original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerDNSResponseListener.java
Sat Sep  8 07:51:05 2007
@@ -25,6 +25,11 @@
 import org.apache.james.jspf.exceptions.PermErrorException;
 import org.apache.james.jspf.exceptions.TempErrorException;
 
+/**
+ * 
+ * Listeners which should get called for a SPFCheck when the DNSResponse is aviable should
implement 
+ * this interface.
+ */
 public interface SPFCheckerDNSResponseListener {
     
     /**

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerExceptionCatcher.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerExceptionCatcher.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerExceptionCatcher.java
(original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFCheckerExceptionCatcher.java
Sat Sep  8 07:51:05 2007
@@ -26,7 +26,7 @@
 
 /**
  * 
- *
+ * Implementations get called when a SPFChecker throws an Exception
  */
 public interface SPFCheckerExceptionCatcher {
     

Modified: 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?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFRecordParser.java Sat Sep
 8 07:51:05 2007
@@ -23,6 +23,10 @@
 import org.apache.james.jspf.exceptions.NoneException;
 import org.apache.james.jspf.exceptions.PermErrorException;
 
+/**
+ * 
+ * Implementations of this interface should handle parsing of SPFRecords
+ */
 public interface SPFRecordParser {
 
     /**

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFResult.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFResult.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFResult.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/core/SPFResult.java Sat Sep  8 07:51:05
2007
@@ -31,7 +31,7 @@
 
     protected String headerTextAsString = "";
 
-    protected String headerName = "Received-SPF";
+    protected final static String HEADER_NAME = "Received-SPF";
     
     protected String result = null;
 
@@ -69,7 +69,7 @@
      * @return SPF-Header
      */
     public String getHeader() {
-        return headerName+": "+getHeaderText();
+        return HEADER_NAME+": "+getHeaderText();
     }
 
     /**
@@ -78,7 +78,7 @@
      * @return headername
      */
     public String getHeaderName() {
-        return headerName;
+        return HEADER_NAME;
     }
 
     /**

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/dns/DNSRequest.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/dns/DNSRequest.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/dns/DNSRequest.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/dns/DNSRequest.java Sat Sep  8 07:51:05
2007
@@ -46,7 +46,7 @@
      */
     private final int recordType;
 
-    public DNSRequest(String hostname, int recordType) throws NoneException {
+    public DNSRequest(final String hostname, final int recordType) throws NoneException {
         if (recordType == MX || recordType == A || recordType == AAAA) {
             try {
                 Name.fromString(hostname);

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/impl/DNSJnioAsynchService.java Sat
Sep  8 07:51:05 2007
@@ -104,7 +104,11 @@
         LookupAsynch.setDefaultResolver(resolver);
     }
     
-    public void setTimeout(int timeout) {
+    /**
+     * Set the timeout for the resolvers
+     * @param timeout
+     */
+    public synchronized void setTimeout(int timeout) {
         Resolver[] res = resolver.getResolvers();
         for (int i = 0; i < res.length; i++) {
             res[i].setTimeout(timeout);

Modified: james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/macro/MacroExpand.java Sat Sep  8
07:51:05 2007
@@ -71,7 +71,7 @@
     
     public static final boolean DOMAIN = false;
     
-    public static class RequireClientDomain extends Exception {
+    public static class RequireClientDomainException extends Exception {
         
     }
 
@@ -186,7 +186,7 @@
             } else {
                 return expandDomain(input, macroData);
             }
-        } catch (RequireClientDomain e) {
+        } catch (RequireClientDomainException e) {
             return null;
         }
     }
@@ -201,7 +201,7 @@
      *             Get thrown if invalid macros are used
      * @throws RequireClientDomain 
      */
-    private String expandExplanation(String input, MacroData macroData) throws PermErrorException,
RequireClientDomain {
+    private String expandExplanation(String input, MacroData macroData) throws PermErrorException,
RequireClientDomainException {
 
         log.debug("Start do expand explanation: " + input);
 
@@ -226,7 +226,7 @@
      *             This get thrown if invalid macros are used
      * @throws RequireClientDomain 
      */
-    private String expandDomain(String input, MacroData macroData) throws PermErrorException,
RequireClientDomain {
+    private String expandDomain(String input, MacroData macroData) throws PermErrorException,
RequireClientDomainException {
 
         log.debug("Start expand domain: " + input);
 
@@ -270,7 +270,7 @@
      *             This get thrown if invalid macros are used
      * @throws RequireClientDomain 
      */
-    private String expandMacroString(String input, MacroData macroData, boolean isExplanation)
throws PermErrorException, RequireClientDomain {
+    private String expandMacroString(String input, MacroData macroData, boolean isExplanation)
throws PermErrorException, RequireClientDomainException {
 
         StringBuffer decodedValue = new StringBuffer();
         Matcher inputMatcher = macroStringPattern.matcher(input);
@@ -316,7 +316,7 @@
      *             Get thrown if an error in processing happen
      * @throws RequireClientDomain 
      */
-    private String replaceCell(String replaceValue, MacroData macroData, boolean isExplanation)
throws PermErrorException, RequireClientDomain {
+    private String replaceCell(String replaceValue, MacroData macroData, boolean isExplanation)
throws PermErrorException, RequireClientDomainException {
 
         String variable = "";
         String domainNumber = "";
@@ -400,7 +400,7 @@
      * @throws RequireClientDomain requireClientDomain if the client domain is needed
      *             and not yet resolved.
      */
-    private String matchMacro(String macro, MacroData macroData) throws PermErrorException,
RequireClientDomain {
+    private String matchMacro(String macro, MacroData macroData) throws PermErrorException,
RequireClientDomainException {
 
         String rValue = null;
 
@@ -424,7 +424,7 @@
         } else if (variable.equalsIgnoreCase("p")) {
             rValue = macroData.getClientDomain();
             if (rValue == null) {
-                throw new RequireClientDomain();
+                throw new RequireClientDomainException();
             }
         } else if (variable.equalsIgnoreCase("o")) {
             rValue = macroData.getSenderDomain();

Copied: james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java
(from r573326, 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/RFC4408SPF1Parser.java?p2=james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java&p1=james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java&r1=573326&r2=573848&rev=573848&view=diff
==============================================================================
--- james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/DefaultSPF1Parser.java (original)
+++ james/jspf/trunk/src/main/java/org/apache/james/jspf/parser/RFC4408SPF1Parser.java Sat
Sep  8 07:51:05 2007
@@ -76,7 +76,7 @@
  * @see org.apache.james.jspf.core.SPF1Record
  * 
  */
-public class DefaultSPF1Parser implements SPFRecordParser {
+public final class RFC4408SPF1Parser implements SPFRecordParser {
 
     /**
      * Regex based on http://www.ietf.org/rfc/rfc4408.txt.
@@ -116,7 +116,7 @@
      * 
      * @param loggerThe logger to use
      */
-    public DefaultSPF1Parser(Logger logger, TermsFactory termsFactory) {
+    public RFC4408SPF1Parser(Logger logger, TermsFactory termsFactory) {
         this.log = logger;
         this.termsFactory = termsFactory;
         

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?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- 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 Sat Sep  8
07:51:05 2007
@@ -32,7 +32,7 @@
 import org.apache.james.jspf.impl.DNSServiceAsynchSimulator;
 import org.apache.james.jspf.impl.DNSServiceXBillImpl;
 import org.apache.james.jspf.macro.MacroExpand;
-import org.apache.james.jspf.parser.DefaultSPF1Parser;
+import org.apache.james.jspf.parser.RFC4408SPF1Parser;
 import org.apache.james.jspf.parser.DefaultTermsFactory;
 import org.apache.james.jspf.wiring.DNSServiceEnabled;
 import org.apache.james.jspf.wiring.LogEnabled;
@@ -173,7 +173,7 @@
             enabledServices = new WiringServiceTable();
             enabledServices.put(LogEnabled.class, log);
             */
-            parser = new DefaultSPF1Parser(log.getChildLogger("parser"), new DefaultTermsFactory(log.getChildLogger("termsfactory"),
new WiringService() {
+            parser = new RFC4408SPF1Parser(log.getChildLogger("parser"), new DefaultTermsFactory(log.getChildLogger("termsfactory"),
new WiringService() {
 
                 public void wire(Object component) throws WiringServiceException {
                     if (component instanceof LogEnabled) {

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?rev=573848&r1=573847&r2=573848&view=diff
==============================================================================
--- 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 Sat Sep  8 07:51:05
2007
@@ -23,7 +23,7 @@
 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.DefaultSPF1Parser;
+import org.apache.james.jspf.parser.RFC4408SPF1Parser;
 import org.apache.james.jspf.parser.DefaultTermsFactory;
 
 import java.io.BufferedReader;
@@ -52,7 +52,7 @@
             }
         }
         assertNotNull(data);
-        parser = new DefaultSPF1Parser(new ConsoleLogger(), new DefaultTermsFactory(new ConsoleLogger()));
+        parser = new RFC4408SPF1Parser(new ConsoleLogger(), new DefaultTermsFactory(new ConsoleLogger()));
     }
 
     public static Test suite() throws IOException {
@@ -171,7 +171,7 @@
             super();
             List tests = loadTests();
             Iterator i = tests.iterator();
-            SPFRecordParser parser = new DefaultSPF1Parser(new ConsoleLogger(), new DefaultTermsFactory(new
ConsoleLogger()));
+            SPFRecordParser parser = new RFC4408SPF1Parser(new ConsoleLogger(), new DefaultTermsFactory(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


Mime
View raw message