You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mailet-api@james.apache.org by ba...@apache.org on 2011/01/21 12:06:07 UTC

svn commit: r1061734 - in /james/mailet/api/trunk/src/main/java/org/apache/mailet: LookupException.java MailetContext.java TemporaryLookupException.java

Author: bago
Date: Fri Jan 21 11:06:06 2011
New Revision: 1061734

URL: http://svn.apache.org/viewvc?rev=1061734&view=rev
Log:
Add generic dns lookup support to MailetContext (MAILET-30)

Added:
    james/mailet/api/trunk/src/main/java/org/apache/mailet/LookupException.java   (with props)
    james/mailet/api/trunk/src/main/java/org/apache/mailet/TemporaryLookupException.java   (with props)
Modified:
    james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java

Added: james/mailet/api/trunk/src/main/java/org/apache/mailet/LookupException.java
URL: http://svn.apache.org/viewvc/james/mailet/api/trunk/src/main/java/org/apache/mailet/LookupException.java?rev=1061734&view=auto
==============================================================================
--- james/mailet/api/trunk/src/main/java/org/apache/mailet/LookupException.java (added)
+++ james/mailet/api/trunk/src/main/java/org/apache/mailet/LookupException.java Fri Jan 21 11:06:06 2011
@@ -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.mailet;
+
+import java.io.IOException;
+
+/**
+ * Defines a general exception raised by the MailetContext dns lookup methods. 
+ * 
+ * @since Mailet API v2.5
+ */
+public class LookupException extends IOException {
+
+	private static final long serialVersionUID = -2016705390234811363L;
+
+	/**
+     * Constructs a new lookup exception.
+     */
+    public LookupException() {
+        super();
+    }
+
+    /**
+     * Constructs a new lookup exception with the specified message.
+     */
+    public LookupException(String message) {
+        super(message);
+    }
+}

Propchange: james/mailet/api/trunk/src/main/java/org/apache/mailet/LookupException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java
URL: http://svn.apache.org/viewvc/james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java?rev=1061734&r1=1061733&r2=1061734&view=diff
==============================================================================
--- james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java (original)
+++ james/mailet/api/trunk/src/main/java/org/apache/mailet/MailetContext.java Fri Jan 21 11:06:06 2011
@@ -22,6 +22,7 @@ package org.apache.mailet;
 
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
@@ -58,8 +59,7 @@ public interface MailetContext {
     
     /**
      * Loglevel for logging operations
-     * 
-     *
+     * @since Mailet API v2.5
      */
     public enum LogLevel {
         DEBUG,
@@ -69,6 +69,14 @@ public interface MailetContext {
     }
     
     /**
+     * DNS Record Types for lookup operations
+     * @since Mailet API v2.5
+     */
+    public enum RecordType {
+    	A, AAAA, PTR, MX, TXT, SPF
+    }
+    
+    /**
      * Returns the major version number of the Mailet API that this mailet
      * container supports. For example, if the mailet container supports
      * version 1.2 of the Mailet API, this method returns 1.
@@ -348,4 +356,16 @@ public interface MailetContext {
     void bounce(Mail mail, String message, MailAddress bouncer) throws MessagingException;
     
 
+    /**
+     * Lookups the DNS system for a given record type.
+     * 
+     * @param name the host/domain name to lookup
+     * @param type the "IN" record type to lookup 
+     * @return a String list with result records with at least 1 element.
+     * @throws TemporaryLookupException on timeout or servfail
+     * @throws LookupException on host not found, record type not found, name syntax issues and other permanent exceptions.
+     * 
+     * @since Mailet API v2.5
+     */
+    List<String> dnsLookup(String name, RecordType type) throws TemporaryLookupException, LookupException;
 }

Added: james/mailet/api/trunk/src/main/java/org/apache/mailet/TemporaryLookupException.java
URL: http://svn.apache.org/viewvc/james/mailet/api/trunk/src/main/java/org/apache/mailet/TemporaryLookupException.java?rev=1061734&view=auto
==============================================================================
--- james/mailet/api/trunk/src/main/java/org/apache/mailet/TemporaryLookupException.java (added)
+++ james/mailet/api/trunk/src/main/java/org/apache/mailet/TemporaryLookupException.java Fri Jan 21 11:06:06 2011
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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.mailet;
+
+
+/**
+ * Defines a general exception raised by the MailetContext dns lookup methods.
+ * 
+ * @since Mailet API v2.5
+ */
+public class TemporaryLookupException extends LookupException {
+
+	private static final long serialVersionUID = 6732299701194103662L;
+
+	/**
+     * Constructs a new lookup exception.
+     */
+    public TemporaryLookupException() {
+        super();
+    }
+
+    /**
+     * Constructs a new lookup exception with the specified message.
+     */
+    public TemporaryLookupException(String message) {
+        super(message);
+    }
+}

Propchange: james/mailet/api/trunk/src/main/java/org/apache/mailet/TemporaryLookupException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain