You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/09/29 00:07:33 UTC

svn commit: r699909 - in /webservices/commons/trunk/modules/transport: modules/base/src/main/java/org/apache/axis2/transport/base/ modules/mail/src/main/java/org/apache/axis2/transport/mail/ src/site/xdoc/

Author: veithen
Date: Sun Sep 28 15:07:33 2008
New Revision: 699909

URL: http://svn.apache.org/viewvc?rev=699909&view=rev
Log:
Improved documentation of the mail transport and added review comments to the code

Modified:
    webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java
    webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseConstants.java
    webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java
    webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java
    webservices/commons/trunk/modules/transport/src/site/xdoc/mail.xml

Modified: webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java?rev=699909&r1=699908&r2=699909&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java (original)
+++ webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListener.java Sun Sep 28 15:07:33 2008
@@ -274,6 +274,7 @@
                 try {
                     // check if an callback has register for this message
                     Map callBackMap = (Map) msgCtx.getConfigurationContext().getProperty(BaseConstants.CALLBACK_TABLE);
+                    // FIXME: transport headers are protocol specific; the correlation ID should be passed as argument to this method
                     Object replyToMessageID = trpHeaders.get(BaseConstants.HEADER_IN_REPLY_TO);
                     // if there is a call back register with this replyto ID then this has
                     // to handle as a synchronized message

Modified: webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseConstants.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseConstants.java?rev=699909&r1=699908&r2=699909&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseConstants.java (original)
+++ webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/BaseConstants.java Sun Sep 28 15:07:33 2008
@@ -90,5 +90,6 @@
     public static final String HEADER_IN_REPLY_TO = "In-Reply-To";
 
     // this is an property required by axis2
+    // FIXME: where is this required in Axis2?
     public final static String MAIL_CONTENT_TYPE = "mail.contenttype";
 }

Modified: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java?rev=699909&r1=699908&r2=699909&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java (original)
+++ webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java Sun Sep 28 15:07:33 2008
@@ -267,12 +267,14 @@
             }
         } catch (MessagingException ignore) {}
 
+        // FIXME: we should already skip these messages in the checkMail method
         // some times the mail server sends a special mail message which is not relavent
         // in processing. ignore this message.
         if ((trpHeaders.get("Status") != null) && (trpHeaders.get("Status").equals("RO"))){
             return;
         }
         // figure out content type of primary request. If the content type is specified, use it
+        // FIXME: shouldn't the content type always be specified by the message?
         String contentType = entry.getContentType();
         if (BaseUtils.isBlank(contentType)) {
 
@@ -471,6 +473,7 @@
 
             entry.setContentType(
                 ParamUtils.getOptionalParam(service, MailConstants.TRANSPORT_MAIL_CONTENT_TYPE));
+            // FIXME: the value of the transport.mail.ReplyAddress parameter is never used
             entry.setReplyAddress(
                 ParamUtils.getOptionalParam(service, MailConstants.TRANSPORT_MAIL_REPLY_ADDRESS));
 

Modified: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java?rev=699909&r1=699908&r2=699909&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java (original)
+++ webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java Sun Sep 28 15:07:33 2008
@@ -56,6 +56,7 @@
     /** The mail folder from which to check mail */
     private String folder;
     /** X-Service-Path custom header */
+    // FIXME: this value of this property is never set nor retrieved
     private String xServicePath;
     /** Content-Type to use for the message */
     private String contentType;

Modified: webservices/commons/trunk/modules/transport/src/site/xdoc/mail.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/src/site/xdoc/mail.xml?rev=699909&r1=699908&r2=699909&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/src/site/xdoc/mail.xml (original)
+++ webservices/commons/trunk/modules/transport/src/site/xdoc/mail.xml Sun Sep 28 15:07:33 2008
@@ -22,6 +22,13 @@
         <title>Mail transport</title>
     </properties>
     <body>
+        <section name="Introduction">
+            <p>The mail transport allows to send and receive messages using MIME compliant mail messages. The transport sender
+            transmits outgoing messages using SMTP, while the transport listener connects to one or more mail accounts
+            and periodically polls these accounts for new incoming messages. The implementation is based on
+            <a href="http://java.sun.com/products/javamail/">JavaMail</a> and therefore supports any mail store protocol
+            for which a JavaMail provider is available.</p>
+        </section>
         <section name="Transport configuration">
     <pre xml:space="preserve">    &lt;transportSender name="mailto" class="org.apache.synapse.transport.mail.MailTransportSender"&gt;
         &lt;parameter name="mail.smtp.host"&gt;smtp.gmail.com&lt;/parameter&gt;
@@ -33,5 +40,107 @@
         &lt;parameter name="mail.smtp.from"&gt;synapse.demo.0@gmail.com&lt;/parameter&gt;
     &lt;/transportSender&gt;</pre>
         </section>
+        <section name="Service configuration">
+            <p>In order receive messages using the mail transport, a service must be configured with a set of parameters
+            to access the corresponding mailbox account. All service parameters starting with <tt>mail.</tt> are
+            interpreted as JavaMail environment properties. The most relevant are <tt>mail.<em>&lt;protocol&gt;</em>.host</tt>
+            and <tt>mail.<em>&lt;protocol&gt;</em>.user</tt>, where <tt><em>&lt;protocol&gt;</em></tt> is typically <tt>pop3</tt>
+            or <tt>imap</tt>. Assuming that Sun's JavaMail implementation is used, the complete list of supported properties for these
+            two protocols can be found <a href="http://java.sun.com/products/javamail/javadocs/com/sun/mail/pop3/package-summary.html">here</a>
+            and <a href="http://java.sun.com/products/javamail/javadocs/com/sun/mail/imap/package-summary.html">here</a>.</p>
+            <p>In additional to the JavaMail environment properties, the following transport specific service parameters are
+            used:</p>
+            <table class="bodyTable">
+                <tr>
+                    <th>Parameter</th>
+                    <th>Required</th>
+                    <th>Description</th>
+                </tr>
+                <tr>
+                    <td>transport.PollInterval</td>
+                    <td>No</td>
+                    <td>The poll interval in seconds.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.Address</td>
+                    <td>Yes</td>
+                    <td>The address used to calculate the endpoint reference for the service. It is assumed that mails
+                    sent to this address will be delivered to the mailbox account configured for the service.
+                    Note that the transport has no means to validate this value and an incorrect address will not
+                    be detected.</td>
+                </tr>
+                <tr>
+                    <td>mail.<em>&lt;protocol&gt;</em>.password</td>
+                    <td>Yes</td>
+                    <td>The password for the mailbox account.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.Protocol</td>
+                    <td>Yes</td>
+                    <td>The mail store protocol to be used. The value must be protocol identifier recognized by JavaMail.
+                    Usual values are <tt>pop3</tt> and <tt>imap</tt>. Note that the SSL variants of these two protocols
+                    are not considered as distinct protocols. Rather, SSL is configured using the appropriate JavaMail
+                    environment properties.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.ContentType</td>
+                    <td>No</td>
+                    <td>[FIXME: why do we need a content type at this level if we assume that the mails are MIME messages???]</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.ReplyAddress</td>
+                    <td>No</td>
+                    <td>[FIXME: this parameter is recognized but actually never used]</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.PreserveHeaders, transport.mail.RemoveHeaders</td>
+                    <td>No</td>
+                    <td>These two properties control which MIME headers of the received message will be stored
+                    in the <tt>TRANSPORT_HEADERS</tt> property of the message context. Both parameters expect a
+                    comma separated list of header names as value. <tt>transport.mail.PreserveHeaders</tt> specifies
+                    a whitelist of headers to retain, while <tt>transport.mail.RemoveHeaders</tt> specifies a
+                    blacklist of headers to remove. Note that the two parameters should not be used simultaneously.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.ActionAfterProcess</td>
+                    <td>No</td>
+                    <td>Determines what the transport should do with the message after successful processing.
+                    Possible values are <tt>MOVE</tt> and <tt>DELETE</tt>. The default value is <tt>DELETE</tt>.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.ActionAfterFailure</td>
+                    <td>No</td>
+                    <td>Determines what the transport should do with the message if processing fails.
+                    Possible values are <tt>MOVE</tt> and <tt>DELETE</tt>. The default value is <tt>DELETE</tt>.
+                    [FIXME: we should reconsider this; it is dangerous!]</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.MoveAfterProcess</td>
+                    <td>Conditional</td>
+                    <td>Specifies the destination folder if <tt>transport.mail.ActionAfterProcess</tt>
+                    is <tt>MOVE</tt>.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.MoveAfterFailure</td>
+                    <td>Conditional</td>
+                    <td>Specifies the destination folder if <tt>transport.mail.ActionAfterFailure</tt>
+                    is <tt>MOVE</tt>.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.MaxRetryCount</td>
+                    <td>No</td>
+                    <td>The number of connection attempts. When the maximum number of retries is
+                    exceeded, a new poll is scheduled after the normal poll interval.
+                    The default value is 0, i.e. connection failures are simply ignored.</td>
+                </tr>
+                <tr>
+                    <td>transport.mail.ReconnectTimeout</td>
+                    <td>No</td>
+                    <td>The interval between two connection attempts if the first failed.
+                    The default value is 0, i.e. a new connection is attempted immediately.
+                    [FIXME: either it is not implemented as intended or the name of the property is misleading; it is not a timeout, but an interval]</td>
+                </tr>
+            </table>
+        </section>
     </body>
-</document>
\ No newline at end of file
+</document>