camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/8] camel git commit: Component documentation
Date Sat, 14 Mar 2015 07:15:57 GMT
Component documentation


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5174a1ca
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5174a1ca
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5174a1ca

Branch: refs/heads/master
Commit: 5174a1ca1a08c11815fd48fc0dfc4b1e92b34269
Parents: 2645065
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Mar 14 07:49:08 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Mar 14 08:03:21 2015 +0100

----------------------------------------------------------------------
 .../camel/component/mail/MailConfiguration.java | 111 ++++++++++++++++---
 .../camel/component/mail/MailEndpoint.java      |   6 +-
 2 files changed, 102 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5174a1ca/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
index d9cc01f..526e32c 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
@@ -41,9 +41,10 @@ import org.apache.camel.util.jsse.SSLContextParameters;
 @UriParams
 public class MailConfiguration implements Cloneable {
 
-    private JavaMailSender javaMailSender;
+    private Session session;
     private Properties javaMailProperties;
     private Properties additionalJavaMailProperties;
+
     // protocol is implied by component name so it should not be in UriPath
     private String protocol;
     @UriPath @Metadata(required = "true")
@@ -54,27 +55,28 @@ public class MailConfiguration implements Cloneable {
     private String username;
     @UriParam
     private String password;
-    @UriParam
+    @UriParam @Metadata(label = "producer")
     private String subject;
-    private Session session;
+    @UriParam @Metadata(label = "producer")
+    private JavaMailSender javaMailSender;
     @UriParam(defaultValue = "true")
     private boolean mapMailMessage = true;
-    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FROM)
+    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FROM) @Metadata(label = "producer")
     private String from = MailConstants.MAIL_DEFAULT_FROM;
-    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FOLDER)
+    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FOLDER) @Metadata(label = "consumer")
     private String folderName = MailConstants.MAIL_DEFAULT_FOLDER;
-    @UriParam
+    @UriParam @Metadata(label = "consumer")
     private boolean delete;
-    @UriParam
+    @UriParam @Metadata(label = "consumer")
     private String copyTo;
-    @UriParam(defaultValue = "true")
+    @UriParam(defaultValue = "true") @Metadata(label = "consumer")
     private boolean unseen = true;
     @UriParam
     private boolean ignoreUriScheme;
     private Map<Message.RecipientType, String> recipients = new HashMap<Message.RecipientType,
String>();
-    @UriParam
+    @UriParam @Metadata(label = "producer")
     private String replyTo;
-    @UriParam(defaultValue = "-1")
+    @UriParam(defaultValue = "-1") @Metadata(label = "consumer")
     private int fetchSize = -1;
     @UriParam
     private boolean debugMode;
@@ -90,11 +92,11 @@ public class MailConfiguration implements Cloneable {
     private boolean useInlineAttachments;
     @UriParam
     private boolean ignoreUnsupportedCharset;
-    @UriParam
+    @UriParam @Metadata(label = "consumer")
     private boolean disconnect;
-    @UriParam(defaultValue = "true")
+    @UriParam(defaultValue = "true") @Metadata(label = "consumer")
     private boolean closeFolder = true;
-    @UriParam(defaultValue = "true")
+    @UriParam(defaultValue = "true") @Metadata(label = "consumer")
     private boolean peek = true;
     @UriParam
     private SSLContextParameters sslContextParameters;
@@ -267,6 +269,9 @@ public class MailConfiguration implements Cloneable {
         return javaMailSender;
     }
 
+    /**
+     * To use a custom {@link org.apache.camel.component.mail.JavaMailSender} for sending
emails.
+     */
     public void setJavaMailSender(JavaMailSender javaMailSender) {
         this.javaMailSender = javaMailSender;
     }
@@ -275,6 +280,9 @@ public class MailConfiguration implements Cloneable {
         return host;
     }
 
+    /**
+     * The mail server host name
+     */
     public void setHost(String host) {
         this.host = host;
     }
@@ -311,6 +319,9 @@ public class MailConfiguration implements Cloneable {
         return password;
     }
 
+    /**
+     * The password for login
+     */
     public void setPassword(String password) {
         this.password = password;
     }
@@ -319,6 +330,9 @@ public class MailConfiguration implements Cloneable {
         return subject;
     }
 
+    /**
+     * The Subject of the message being sent. Note: Setting the subject in the header takes
precedence over this option.
+     */
     public void setSubject(String subject) {
         this.subject = subject;
     }
@@ -327,6 +341,9 @@ public class MailConfiguration implements Cloneable {
         return port;
     }
 
+    /**
+     * The port number of the mail server
+     */
     public void setPort(int port) {
         this.port = port;
     }
@@ -335,6 +352,9 @@ public class MailConfiguration implements Cloneable {
         return protocol;
     }
 
+    /**
+     * The protocol for communicating with the mail server
+     */
     public void setProtocol(String protocol) {
         this.protocol = protocol;
     }
@@ -351,6 +371,9 @@ public class MailConfiguration implements Cloneable {
         return username;
     }
 
+    /**
+     * The username for login
+     */
     public void setUsername(String username) {
         this.username = username;
         if (getRecipients().size() == 0) {
@@ -368,6 +391,9 @@ public class MailConfiguration implements Cloneable {
         return from;
     }
 
+    /**
+     * The from email address
+     */
     public void setFrom(String from) {
         this.from = from;
     }
@@ -376,6 +402,11 @@ public class MailConfiguration implements Cloneable {
         return delete;
     }
 
+    /**
+     * Deletes the messages after they have been processed. This is done by setting the DELETED
flag on the mail message.
+     * If false, the SEEN flag is set instead. As of Camel 2.10 you can override this configuration
option by setting a
+     * header with the key delete to determine if the mail should be deleted or not.
+     */
     public void setDelete(boolean delete) {
         this.delete = delete;
     }
@@ -392,6 +423,9 @@ public class MailConfiguration implements Cloneable {
         return folderName;
     }
 
+    /**
+     * The folder to poll.
+     */
     public void setFolderName(String folderName) {
         this.folderName = folderName;
     }
@@ -400,6 +434,10 @@ public class MailConfiguration implements Cloneable {
         return ignoreUriScheme;
     }
 
+    /**
+     * Option to let Camel ignore unsupported charset in the local JVM when sending mails.
If the charset is unsupported
+     * then charset=XXX (where XXX represents the unsupported charset) is removed from the
content-type and it relies on the platform default instead.
+     */
     public void setIgnoreUriScheme(boolean ignoreUriScheme) {
         this.ignoreUriScheme = ignoreUriScheme;
     }
@@ -408,6 +446,9 @@ public class MailConfiguration implements Cloneable {
         return unseen;
     }
 
+    /**
+     * Whether to limit by unseen mails only.
+     */
     public void setUnseen(boolean unseen) {
         this.unseen = unseen;
     }
@@ -441,6 +482,9 @@ public class MailConfiguration implements Cloneable {
         return replyTo;
     }
 
+    /**
+     * The Reply-To recipients (the receivers of the response mail). Separate multiple email
addresses with a comma.
+     */
     public void setReplyTo(String replyTo) {
         this.replyTo = replyTo;
     }
@@ -449,6 +493,11 @@ public class MailConfiguration implements Cloneable {
         return fetchSize;
     }
 
+    /**
+     * Sets the maximum number of messages to consume during a poll. This can be used to
avoid overloading a mail server,
+     * if a mailbox folder contains a lot of messages. Default value of -1 means no fetch
size and all messages will be consumed.
+     * Setting the value to 0 is a special corner case, where Camel will not consume any
messages at all.
+     */
     public void setFetchSize(int fetchSize) {
         this.fetchSize = fetchSize;
     }
@@ -457,6 +506,9 @@ public class MailConfiguration implements Cloneable {
         return debugMode;
     }
 
+    /**
+     * Enable debug mode on the underlying mail framework. The SUN Mail framework logs the
debug messages to System.out by default.
+     */
     public void setDebugMode(boolean debugMode) {
         this.debugMode = debugMode;
     }
@@ -465,6 +517,9 @@ public class MailConfiguration implements Cloneable {
         return connectionTimeout;
     }
 
+    /**
+     * The connection timeout in milliseconds.
+     */
     public void setConnectionTimeout(int connectionTimeout) {
         this.connectionTimeout = connectionTimeout;
     }
@@ -481,6 +536,9 @@ public class MailConfiguration implements Cloneable {
         return contentType;
     }
 
+    /**
+     * The mail message content type. Use text/html for HTML mails.
+     */
     public void setContentType(String contentType) {
         this.contentType = contentType;
     }
@@ -489,6 +547,11 @@ public class MailConfiguration implements Cloneable {
         return alternativeBodyHeader;
     }
 
+    /**
+     * Specifies the key to an IN message header that contains an alternative email body.
+     * For example, if you send emails in text/html format and want to provide an alternative
mail body for
+     * non-HTML email clients, set the alternative mail body with this key as a header.
+     */
     public void setAlternativeBodyHeader(String alternativeBodyHeader) {
         this.alternativeBodyHeader = alternativeBodyHeader;
     }
@@ -505,6 +568,11 @@ public class MailConfiguration implements Cloneable {
         return ignoreUnsupportedCharset;
     }
 
+    /**
+     * Option to let Camel ignore unsupported charset in the local JVM when sending mails.
+     * If the charset is unsupported then charset=XXX (where XXX represents the unsupported
charset)
+     * is removed from the content-type and it relies on the platform default instead.
+     */
     public void setIgnoreUnsupportedCharset(boolean ignoreUnsupportedCharset) {
         this.ignoreUnsupportedCharset = ignoreUnsupportedCharset;
     }
@@ -513,6 +581,9 @@ public class MailConfiguration implements Cloneable {
         return disconnect;
     }
 
+    /**
+     * Whether the consumer should disconnect after polling. If enabled this forces Camel
to connect on each poll.
+     */
     public void setDisconnect(boolean disconnect) {
         this.disconnect = disconnect;
     }
@@ -521,6 +592,10 @@ public class MailConfiguration implements Cloneable {
         return closeFolder;
     }
 
+    /**
+     * Whether the consumer should close the folder after polling. Setting this option to
false and having disconnect=false as well,
+     * then the consumer keep the folder open between polls.
+     */
     public void setCloseFolder(boolean closeFolder) {
         this.closeFolder = closeFolder;
     }
@@ -537,6 +612,11 @@ public class MailConfiguration implements Cloneable {
         return copyTo;
     }
 
+    /**
+     * After processing a mail message, it can be copied to a mail folder with the given
name.
+     * You can override this configuration value, with a header with the key copyTo, allowing
you to copy messages
+     * to folder names configured at runtime.
+     */
     public void setCopyTo(String copyTo) {
         this.copyTo = copyTo;
     }
@@ -545,6 +625,11 @@ public class MailConfiguration implements Cloneable {
         return peek;
     }
 
+    /**
+     * Will mark the javax.mail.Message as peeked before processing the mail message.
+     * This applies to IMAPMessage messages types only. By using peek the mail will not be
eager marked as SEEN on
+     * the mail server, which allows us to rollback the mail message if there is an error
processing in Camel.
+     */
     public void setPeek(boolean peek) {
         this.peek = peek;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/5174a1ca/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
index f2e0080..a7a89cd 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
@@ -20,7 +20,6 @@ import javax.mail.Message;
 import javax.mail.search.SearchTerm;
 
 import com.sun.mail.imap.SortTerm;
-
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -37,10 +36,13 @@ import org.apache.camel.spi.UriParam;
  */
 @UriEndpoint(scheme = "imap,imaps,pop3,pop3s,smtp,smtps", syntax = "imap:host:port", consumerClass
= MailConsumer.class, label = "mail")
 public class MailEndpoint extends ScheduledPollEndpoint {
-    private MailBinding binding;
     @UriParam
     private MailConfiguration configuration;
+    @UriParam
+    private MailBinding binding;
+    @UriParam
     private HeaderFilterStrategy headerFilterStrategy = new MailHeaderFilterStrategy();
+    @UriParam
     private ContentTypeResolver contentTypeResolver;
     @UriParam
     private int maxMessagesPerPoll;


Mime
View raw message