You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by lh...@apache.org on 2008/12/05 23:34:55 UTC
svn commit: r723907 - in
/servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail:
MailPollerEndpoint.java MailSenderEndpoint.java
Author: lhein
Date: Fri Dec 5 14:34:55 2008
New Revision: 723907
URL: http://svn.apache.org/viewvc?rev=723907&view=rev
Log:
fixed issue SM-1652
Modified:
servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java
servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
Modified: servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java?rev=723907&r1=723906&r2=723907&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java (original)
+++ servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailPollerEndpoint.java Fri Dec 5 14:34:55 2008
@@ -64,7 +64,7 @@
private String connection;
- private int maxFetchSize = 5;
+ private int maxFetchSize = -1;
private boolean processOnlyUnseenMessages;
@@ -72,10 +72,6 @@
private boolean debugMode;
- private boolean forgetTopHeaders;
-
- private boolean disableTop;
-
private Map<String, String> customProperties;
private List<String> foundMessagesInFolder = Collections.synchronizedList(new LinkedList<String>());
@@ -89,8 +85,6 @@
this.processOnlyUnseenMessages = true;
this.deleteProcessedMessages = false;
this.debugMode = false;
- this.forgetTopHeaders = false;
- this.disableTop = false;
}
/*
@@ -156,7 +150,7 @@
* org.apache.servicemix.common.ExchangeProcessor#process(javax.jbi.messaging
* .MessageExchange)
*/
- public void process(MessageExchange arg0) throws Exception {
+ public void process(MessageExchange exchange) throws Exception {
// Do nothing. In our case, this method should never be called
// as we only send synchronous InOnly exchange
}
@@ -184,8 +178,6 @@
try {
Properties props = MailUtils.getPropertiesForProtocol(this.config, this.customTrustManagers);
props.put("mail.debug", isDebugMode() ? "true" : "false");
- props.put("mail.pop3.forgettopheaders", isForgetTopHeaders() ? "true" : "false");
- props.put("mail.pop3.disabletop", isDisableTop() ? "true" : "false");
// apply the custom properties
applyCustomProperties(props);
@@ -348,75 +340,132 @@
}
}
- /**
- * @return the deleteProcessedMessages
- */
public boolean isDeleteProcessedMessages() {
return this.deleteProcessedMessages;
}
/**
- * @param deleteProcessedMessages the deleteProcessedMessages to set
+ * <p>This flag is used to indicate what happens to a processed mail polled
+ * from a mail folder. If it is set to <code>true</code> the mail will
+ * be deleted after it was sent into the bus successfully. If set to
+ * <code>false</code> the mail will reside inside the mail folder but will
+ * be marked as already seen.<br/>
+ * If the sending of the mail results in an error, the mail will not be
+ * deleted / marked and reprocessed on next run of the polling cycle.<p>
+ * <i> The default value is <b>false</b></i>
+ *
+ * @param deleteProcessedMessages
+ * a <code>boolean</code> value as flag
*/
public void setDeleteProcessedMessages(boolean deleteProcessedMessages) {
this.deleteProcessedMessages = deleteProcessedMessages;
}
- /**
- * @return the marshaler
- */
public AbstractMailMarshaler getMarshaler() {
return this.marshaler;
}
/**
- * @param marshaler the marshaler to set
+ * <p>With this method you can specify a marshaler class which provides the
+ * logic for converting a mail into a normalized message. This class has
+ * to extend the abstract class <code>AbstractMailMarshaler</code> or an
+ * extending class. If you don't specify a marshaler, the
+ * <code>DefaultMailMarshaler</code> will be used.</p>
+ *
+ * @param marshaler
+ * a class which extends <code>AbstractMailMarshaler</code>
*/
public void setMarshaler(AbstractMailMarshaler marshaler) {
this.marshaler = marshaler;
}
- /**
- * @return the maxFetchSize
- */
public int getMaxFetchSize() {
return this.maxFetchSize;
}
/**
- * @param maxFetchSize the maxFetchSize to set
+ * <p>This sets the maximum amount of mails to process within one polling cycle.
+ * If the maximum amount is reached all other mails in "unseen" state will
+ * be skipped.</p>
+ * <i> The default value is <b>-1 (unlimited)</b></i><br/><br/>
+ *
+ * @param maxFetchSize
+ * a <code>int</code> value for maximum to be polled messages
*/
public void setMaxFetchSize(int maxFetchSize) {
this.maxFetchSize = maxFetchSize;
}
- /**
- * @return the processOnlyUnseenMessages
- */
public boolean isProcessOnlyUnseenMessages() {
return this.processOnlyUnseenMessages;
}
/**
- * @param processOnlyUnseenMessages the processOnlyUnseenMessages to set
+ * <p>This flag is used to indicate whether all mails are polled from a
+ * mail folder or only the unseen mails are processed.<br/><br />
+ * If it is set to <b><code>true</code></b> only the unseen mails will be
+ * processed.<br />
+ * If it is set to <b><code>false</code></b> all mails will be processed.<br/></p>
+ * <i> The default value is <b>true</b></i><br/><br/>
+ *
+ * @param processOnlyUnseenMessages
+ * a <code>boolean</code> value as flag
*/
public void setProcessOnlyUnseenMessages(boolean processOnlyUnseenMessages) {
this.processOnlyUnseenMessages = processOnlyUnseenMessages;
}
- /**
- * returns the connection uri used for this poller endpoint
- *
- * @return Returns the connection.
- */
public String getConnection() {
return this.connection;
}
/**
- * sets the connection uri
+ * <p>Specifies the connection URI used to connect to a mail server.
+ * <br /><br />
+ * <b><u>Templates:</u></b> <br />
+ * <i><protocol>://<user>@<host>[:<port>][/<folder>]?password=<password></i>
+ * <br /><b> OR</b><br/>
+ * <i><protocol>://<host>[:<port>][/<folder>]?user=<user>;password=<password></i>
+ * <br /><br />
+ * <b><u>Details:</u></b><br /><br/>
+ * <table border="0" cellpadding="0" cellspacing="0">
+ * <tr>
+ * <td width="40%" align="left"><b><u>Name</u></b></td>
+ * <td width="60%" align="left"><b><u>Description</u></b></td>
+ * </tr>
+ * <tr>
+ * <td>protocol</td>
+ * <td>the protocol to use (example: pop3 or imap)</td>
+ * </tr>
+ * <tr>
+ * <td>user</td>
+ * <td>the user name used to log into an account</td>
+ * </tr>
+ * <tr>
+ * <td>host</td>
+ * <td>the name or ip address of the mail server</td>
+ * </tr>
+ * <tr>
+ * <td>port</td>
+ * <td>the port number to use (optional)</td>
+ * </tr>
+ * <tr>
+ * <td>folder</td>
+ * <td>the folder to poll from (optional)</td>
+ * </tr>
+ * <tr>
+ * <td>password</td>
+ * <td>the password for the login</td>
+ * </tr>
+ * </table>
+ * <br/>
+ * <b><u>Examples:</u></b><br />
+ * <i>imap://lhein@imapserver:143/INBOX?password=mypass</i><br />
+ * <i>pop3://pop3server/INBOX?user=me@myhome.org;password=mypass</i></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
*
- * @param connection The connection to set.
+ * @param connection
+ * a <code>String</code> value containing the connection details
*/
public void setConnection(String connection) {
this.connection = connection;
@@ -427,85 +476,83 @@
}
}
- /**
- * @return the debugMode
- */
public boolean isDebugMode() {
return this.debugMode;
}
/**
- * @param debugMode the debugMode to set
+ * <p>Specifies if the JavaMail is run in <code>DEBUG</code> mode. This means
+ * that while connecting to server and processing mails a detailed log
+ * is written to debug output. <br />
+ * This mode is very handy if you are experiencing problems with your
+ * mail server connection and you want to find out what is going wrong
+ * in communication with the server.
+ * <br /><br />
+ * <b>true</b> - <i>the debug mode is <b>enabled</b></i>
+ * <br />
+ * <b>false</b> - <i>the debug mode is <b>disabled</b></i></p>
+ * <i> The default value is <b>false</b></i><br/><br/>
+ *
+ * @param debugMode
+ * a <code>boolean</code> value for debug mode
*/
public void setDebugMode(boolean debugMode) {
this.debugMode = debugMode;
}
- /**
- * @return the customTrustManagers
- */
public String getCustomTrustManagers() {
return this.customTrustManagers;
}
/**
- * @param customTrustManagers the customTrustManagers to set
+ * <p>Specifies one or more trust manager classes separated by a semicolon (<b>;</b>).<br/>
+ * These classes have to implement the <code>Trustmanager</code> interface and need to provide
+ * an empty default constructor to be valid.<br/><br />
+ * If you want to accept all security certificates without a check you may
+ * consider using the <code>DummyTrustManager</code> class. It is actually only
+ * an empty stub without any checking logic. <br/><b>But be aware that this will be
+ * a security risk in production environments. </b></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
+ *
+ * @param customTrustManagers
+ * a <code>String</code> value containing one or more full class names separated by <b>;</b> char
*/
public void setCustomTrustManagers(String customTrustManagers) {
this.customTrustManagers = customTrustManagers;
}
- /**
- * @return the forgetTopHeaders
- */
- public boolean isForgetTopHeaders() {
- return this.forgetTopHeaders;
- }
-
- /**
- * @param forgetTopHeaders the forgetTopHeaders to set
- */
- public void setForgetTopHeaders(boolean forgetTopHeaders) {
- this.forgetTopHeaders = forgetTopHeaders;
- }
-
- /**
- * @return the disableTop
- */
- public boolean isDisableTop() {
- return this.disableTop;
- }
-
- /**
- * @param disableTop the disableTop to set
- */
- public void setDisableTop(boolean disableTop) {
- this.disableTop = disableTop;
- }
-
- /**
- * * @return Returns the customProperties.
- */
public Map<String, String> getCustomProperties() {
return this.customProperties;
}
/**
- * @param customProperties The customProperties to set.
+ * <p>Specifies a <code>java.util.Map</code> which may contain additional
+ * properties for the connection. <br/>
+ * <br/><b><u>Example for disabling TOP for POP3 headers:</u></b><br />
+ * <i><b>key</b>: "mail.pop3.disabletop"</i> <br />
+ * <i><b>value</b>: "true"</i></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
+ *
+ * @param customProperties
+ * a <code>java.util.Map<String, String></code> containing connection properties
*/
public void setCustomProperties(Map<String, String> customProperties) {
this.customProperties = customProperties;
}
- /**
- * * @return Returns the storage.
- */
public org.apache.servicemix.store.Store getStorage() {
return this.storage;
}
/**
- * @param storage The storage to set.
+ * <p>Specifies a <code>org.apache.servicemix.store.Store</code> object which
+ * will be used for storing the identifications of already processed messages.<br/>
+ * <b>This store is only used with the POP3 protocol and if unseen mails are
+ * processed only.</b></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
+ *
+ * @param storage
+ * a <code>org.apache.servicemix.store.Store</code> object for storing seen message idents
*/
public void setStorage(org.apache.servicemix.store.Store storage) {
this.storage = storage;
Modified: servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java?rev=723907&r1=723906&r2=723907&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java (original)
+++ servicemix/components/bindings/servicemix-mail/trunk/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java Fri Dec 5 14:34:55 2008
@@ -242,47 +242,89 @@
}
}
- /**
- * @return the marshaler
- */
public AbstractMailMarshaler getMarshaler() {
return this.marshaler;
}
/**
- * @param marshaler the marshaler to set
+ * <p>With this method you can specify a marshaler class which provides the
+ * logic for converting a normalized message into a mail. This class has
+ * to extend the abstract class <code>AbstractMailMarshaler</code> or an
+ * extending class. If you don't specify a marshaler, the
+ * <code>DefaultMailMarshaler</code> will be used.</p>
+ *
+ * @param marshaler
+ * a class which extends <code>AbstractMailMarshaler</code>
*/
public void setMarshaler(AbstractMailMarshaler marshaler) {
this.marshaler = marshaler;
}
- /**
- * @return the sender
- */
public String getSender() {
return this.sender;
}
/**
- * @param sender the sender to set
+ * <p>Specifies the sender address of the mail which is being sent.</p>
+ * <i> The default value is <b>no-reply@localhost</b></i><br/><br/>
+ *
+ * @param sender
+ * a <code>String</code> value containing the sender address
*/
public void setSender(String sender) {
this.sender = sender;
}
- /**
- * returns the connection uri used for this poller endpoint
- *
- * @return Returns the connection.
- */
public String getConnection() {
return this.connection;
}
/**
- * sets the connection uri
+ * <p>Specifies the connection URI used to connect to a mail server.
+ * <br /><br />
+ * <b><u>Templates:</u></b> <br />
+ * <i><protocol>://<user>@<host>[:<port>][/<folder>]?password=<password></i>
+ * <br /><b> OR</b><br/>
+ * <i><protocol>://<host>[:<port>][/<folder>]?user=<user>;password=<password></i>
+ * <br /><br />
+ * <b><u>Details:</u></b><br /><br/>
+ * <table border="0" cellpadding="0" cellspacing="0">
+ * <tr>
+ * <td width="40%" align="left"><b><u>Name</u></b></td>
+ * <td width="60%" align="left"><b><u>Description</u></b></td>
+ * </tr>
+ * <tr>
+ * <td>protocol</td>
+ * <td>the protocol to use (example: pop3 or imap)</td>
+ * </tr>
+ * <tr>
+ * <td>user</td>
+ * <td>the user name used to log into an account</td>
+ * </tr>
+ * <tr>
+ * <td>host</td>
+ * <td>the name or ip address of the mail server</td>
+ * </tr>
+ * <tr>
+ * <td>port</td>
+ * <td>the port number to use (optional)</td>
+ * </tr>
+ * <tr>
+ * <td>folder</td>
+ * <td>the folder to poll from (optional)</td>
+ * </tr>
+ * <tr>
+ * <td>password</td>
+ * <td>the password for the login</td>
+ * </tr>
+ * </table>
+ * <br/>
+ * <b><u>Example:</u></b><br />
+ * <i>smtp://lhein@myserver?password=myPass</i><br /></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
*
- * @param connection The connection to set.
+ * @param connection
+ * a <code>String</code> value containing the connection details
*/
public void setConnection(String connection) {
this.connection = connection;
@@ -293,72 +335,103 @@
}
}
- /**
- * @return the debugMode
- */
public boolean isDebugMode() {
return this.debugMode;
}
/**
- * @param debugMode the debugMode to set
+ * <p>Specifies if the JavaMail is run in <code>DEBUG</code> mode. This means
+ * that while connecting to server and processing mails a detailed log
+ * is written to debug output. <br />
+ * This mode is very handy if you are experiencing problems with your
+ * mail server connection and you want to find out what is going wrong
+ * in communication with the server.
+ * <br /><br />
+ * <b>true</b> - <i>the debug mode is <b>enabled</b></i>
+ * <br />
+ * <b>false</b> - <i>the debug mode is <b>disabled</b></i></p>
+ * <i> The default value is <b>false</b></i><br/><br/>
+ *
+ * @param debugMode
+ * a <code>boolean</code> value for debug mode
*/
public void setDebugMode(boolean debugMode) {
this.debugMode = debugMode;
}
- /**
- * @return the customTrustManagers
- */
public String getCustomTrustManagers() {
return this.customTrustManagers;
}
/**
- * @param customTrustManagers the customTrustManagers to set
+ * <p>Specifies one or more trust manager classes separated by a semicolon (<b>;</b>).<br/>
+ * These classes have to implement the <code>Trustmanager</code> interface and need to provide
+ * an empty default constructor to be valid.<br/><br />
+ * If you want to accept all security certificates without a check you may
+ * consider using the <code>DummyTrustManager</code> class. It is actually only
+ * an empty stub without any checking logic. <br/><b>But be aware that this will be
+ * a security risk in production environments. </b></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
+ *
+ * @param customTrustManagers
+ * a <code>String</code> value containing one or more full class names separated by <b>;</b> char
*/
public void setCustomTrustManagers(String customTrustManagers) {
this.customTrustManagers = customTrustManagers;
}
- /**
- * @return Returns the receiver.
- */
public String getReceiver() {
return this.receiver;
}
/**
- * @param receiver The receiver to set.
+ * <p>Specifies the receiver address(es) of the mail which is being sent.</p>
+ * <i> The default value is <b>null</b></i><br/><br/>
+ *
+ * @param receiver
+ * a <code>String</code> value containing the receiver address(es)
*/
public void setReceiver(String receiver) {
this.receiver = receiver;
}
- /**
- * * @return Returns the customProperties.
- */
public Map<String, String> getCustomProperties() {
return this.customProperties;
}
/**
- * @param customProperties The customProperties to set.
+ * <p>Specifies a <code>java.util.Map</code> which may contain additional
+ * properties for the connection. <br/>
+ * <br/><b><u>Example for disabling TOP for POP3 headers:</u></b><br />
+ * <i><b>key</b>: "mail.pop3.disabletop"</i> <br />
+ * <i><b>value</b>: "true"</i></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
+ *
+ * @param customProperties
+ * a <code>java.util.Map<String, String></code> containing connection properties
*/
public void setCustomProperties(Map<String, String> customProperties) {
this.customProperties = customProperties;
}
- /**
- * @return the ignoreMessageProperties
- */
public List<String> getIgnoreMessageProperties() {
return this.ignoreMessageProperties;
}
/**
- * @param ignoreMessageProperties the ignoreMessageProperties to set
- */
+ * <p>Specifies a <code>java.util.Map</code> which may contain additional
+ * properties for the connection. <br/>
+ * <br/><b><u>Example for skipping all kind of addresses from the normalized message:</u></b><br />
+ * <i><b>value</b>: "org.apache.servicemix.mail.to"</i> <br />
+ * <i><b>value</b>: "org.apache.servicemix.mail.cc"</i> <br />
+ * <i><b>value</b>: "org.apache.servicemix.mail.bcc"</i> <br />
+ * <i><b>value</b>: "org.apache.servicemix.mail.from"</i> <br />
+ * <i><b>value</b>: "org.apache.servicemix.mail.replyto"</i> <br /></p>
+ * <i> The default value is <b>null</b></i><br/><br/>
+ *
+ * @param ignoreMessageProperties
+ * a <code>java.util.List<String></code> containing keys of properties to ignore
+ */
public void setIgnoreMessageProperties(List<String> ignoreMessageProperties) {
this.ignoreMessageProperties = ignoreMessageProperties;
}