You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/08/02 06:43:36 UTC
[08/11] camel git commit: CAMEL-10197: Added plain get/set to
components for spring-boot configuration
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
index 081d364..10b5514 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
@@ -19,8 +19,11 @@ package org.apache.camel.component.mail;
import java.net.URI;
import java.util.HashSet;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
+import javax.mail.Message;
+import javax.mail.Session;
import javax.mail.search.SearchTerm;
import org.apache.camel.CamelContext;
@@ -28,6 +31,7 @@ import org.apache.camel.Endpoint;
import org.apache.camel.impl.UriEndpointComponent;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.jsse.SSLContextParameters;
/**
* Component for JavaMail.
@@ -107,7 +111,7 @@ public class MailComponent extends UriEndpointComponent {
}
/**
- * Sets the Mail configuration
+ * Sets the Mail configuration. Properties of the shared configuration can also be set individually.
*
* @param configuration the configuration to use by default for endpoints
*/
@@ -125,4 +129,484 @@ public class MailComponent extends UriEndpointComponent {
public void setContentTypeResolver(ContentTypeResolver contentTypeResolver) {
this.contentTypeResolver = contentTypeResolver;
}
+
+ /**
+ * Is the used protocol to be secure or not
+ */
+ public boolean isSecureProtocol() {
+ return getConfiguration().isSecureProtocol();
+ }
+
+ public boolean isStartTlsEnabled() {
+ return getConfiguration().isStartTlsEnabled();
+ }
+
+ public String getMailStoreLogInformation() {
+ return getConfiguration().getMailStoreLogInformation();
+ }
+
+ public JavaMailSender getJavaMailSender() {
+ return getConfiguration().getJavaMailSender();
+ }
+
+ /**
+ * To use a custom {@link JavaMailSender} for sending emails.
+ * @param javaMailSender
+ */
+ public void setJavaMailSender(JavaMailSender javaMailSender) {
+ getConfiguration().setJavaMailSender(javaMailSender);
+ }
+
+ public String getHost() {
+ return getConfiguration().getHost();
+ }
+
+ /**
+ * The mail server host name
+ * @param host
+ */
+ public void setHost(String host) {
+ getConfiguration().setHost(host);
+ }
+
+ public Properties getJavaMailProperties() {
+ return getConfiguration().getJavaMailProperties();
+ }
+
+ /**
+ * Sets the java mail options. Will clear any default properties and only use the properties
+ * provided for this method.
+ * @param javaMailProperties
+ */
+ public void setJavaMailProperties(Properties javaMailProperties) {
+ getConfiguration().setJavaMailProperties(javaMailProperties);
+ }
+
+ public Properties getAdditionalJavaMailProperties() {
+ return getConfiguration().getAdditionalJavaMailProperties();
+ }
+
+ /**
+ * Sets additional java mail properties, that will append/override any default properties
+ * that is set based on all the other options. This is useful if you need to add some
+ * special options but want to keep the others as is.
+ * @param additionalJavaMailProperties
+ */
+ public void setAdditionalJavaMailProperties(Properties additionalJavaMailProperties) {
+ getConfiguration().setAdditionalJavaMailProperties(additionalJavaMailProperties);
+ }
+
+ public String getPassword() {
+ return getConfiguration().getPassword();
+ }
+
+ /**
+ * The password for login
+ * @param password
+ */
+ public void setPassword(String password) {
+ getConfiguration().setPassword(password);
+ }
+
+ public String getSubject() {
+ return getConfiguration().getSubject();
+ }
+
+ /**
+ * The Subject of the message being sent. Note: Setting the subject in the header takes precedence over this option.
+ * @param subject
+ */
+ public void setSubject(String subject) {
+ getConfiguration().setSubject(subject);
+ }
+
+ public int getPort() {
+ return getConfiguration().getPort();
+ }
+
+ /**
+ * The port number of the mail server
+ * @param port
+ */
+ public void setPort(int port) {
+ getConfiguration().setPort(port);
+ }
+
+ public String getProtocol() {
+ return getConfiguration().getProtocol();
+ }
+
+ /**
+ * The protocol for communicating with the mail server
+ * @param protocol
+ */
+ public void setProtocol(String protocol) {
+ getConfiguration().setProtocol(protocol);
+ }
+
+ public Session getSession() {
+ return getConfiguration().getSession();
+ }
+
+ /**
+ * Specifies the mail session that camel should use for all mail interactions. Useful in scenarios where
+ * mail sessions are created and managed by some other resource, such as a JavaEE container.
+ * If this is not specified, Camel automatically creates the mail session for you.
+ * @param session
+ */
+ public void setSession(Session session) {
+ getConfiguration().setSession(session);
+ }
+
+ public String getUsername() {
+ return getConfiguration().getUsername();
+ }
+
+ /**
+ * The username for login
+ * @param username
+ */
+ public void setUsername(String username) {
+ getConfiguration().setUsername(username);
+ }
+
+ public String getFrom() {
+ return getConfiguration().getFrom();
+ }
+
+ /**
+ * The from email address
+ * @param from
+ */
+ public void setFrom(String from) {
+ getConfiguration().setFrom(from);
+ }
+
+ public boolean isDelete() {
+ return getConfiguration().isDelete();
+ }
+
+ /**
+ * 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.
+ * @param delete
+ */
+ public void setDelete(boolean delete) {
+ getConfiguration().setDelete(delete);
+ }
+
+ public boolean isMapMailMessage() {
+ return getConfiguration().isMapMailMessage();
+ }
+
+ /**
+ * Specifies whether Camel should map the received mail message to Camel body/headers.
+ * If set to true, the body of the mail message is mapped to the body of the Camel IN message and the mail headers are mapped to IN headers.
+ * If this option is set to false then the IN message contains a raw javax.mail.Message.
+ * You can retrieve this raw message by calling exchange.getIn().getBody(javax.mail.Message.class).
+ * @param mapMailMessage
+ */
+ public void setMapMailMessage(boolean mapMailMessage) {
+ getConfiguration().setMapMailMessage(mapMailMessage);
+ }
+
+ public String getFolderName() {
+ return getConfiguration().getFolderName();
+ }
+
+ /**
+ * The folder to poll.
+ * @param folderName
+ */
+ public void setFolderName(String folderName) {
+ getConfiguration().setFolderName(folderName);
+ }
+
+ public boolean isIgnoreUriScheme() {
+ return getConfiguration().isIgnoreUriScheme();
+ }
+
+ /**
+ * 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.
+ * @param ignoreUriScheme
+ */
+ public void setIgnoreUriScheme(boolean ignoreUriScheme) {
+ getConfiguration().setIgnoreUriScheme(ignoreUriScheme);
+ }
+
+ public boolean isUnseen() {
+ return getConfiguration().isUnseen();
+ }
+
+ /**
+ * Whether to limit by unseen mails only.
+ * @param unseen
+ */
+ public void setUnseen(boolean unseen) {
+ getConfiguration().setUnseen(unseen);
+ }
+
+ /**
+ * Sets the <tt>To</tt> email address. Separate multiple email addresses with comma.
+ * @param address
+ */
+ public void setTo(String address) {
+ getConfiguration().setTo(address);
+ }
+
+ public String getTo() {
+ return getConfiguration().getTo();
+ }
+
+ /**
+ * Sets the <tt>CC</tt> email address. Separate multiple email addresses with comma.
+ * @param address
+ */
+ public void setCc(String address) {
+ getConfiguration().setCc(address);
+ }
+
+ public String getCc() {
+ return getConfiguration().getCc();
+ }
+
+ /**
+ * Sets the <tt>BCC</tt> email address. Separate multiple email addresses with comma.
+ * @param address
+ */
+ public void setBcc(String address) {
+ getConfiguration().setBcc(address);
+ }
+
+ public String getBcc() {
+ return getConfiguration().getBcc();
+ }
+
+ public Map<Message.RecipientType, String> getRecipients() {
+ return getConfiguration().getRecipients();
+ }
+
+ public String getReplyTo() {
+ return getConfiguration().getReplyTo();
+ }
+
+ /**
+ * The Reply-To recipients (the receivers of the response mail). Separate multiple email addresses with a comma.
+ * @param replyTo
+ */
+ public void setReplyTo(String replyTo) {
+ getConfiguration().setReplyTo(replyTo);
+ }
+
+ public int getFetchSize() {
+ return getConfiguration().getFetchSize();
+ }
+
+ /**
+ * 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.
+ * @param fetchSize
+ */
+ public void setFetchSize(int fetchSize) {
+ getConfiguration().setFetchSize(fetchSize);
+ }
+
+ public boolean isDebugMode() {
+ return getConfiguration().isDebugMode();
+ }
+
+ /**
+ * Enable debug mode on the underlying mail framework. The SUN Mail framework logs the debug messages to System.out by default.
+ * @param debugMode
+ */
+ public void setDebugMode(boolean debugMode) {
+ getConfiguration().setDebugMode(debugMode);
+ }
+
+ public long getConnectionTimeout() {
+ return getConfiguration().getConnectionTimeout();
+ }
+
+ /**
+ * The connection timeout in milliseconds.
+ * @param connectionTimeout
+ */
+ public void setConnectionTimeout(int connectionTimeout) {
+ getConfiguration().setConnectionTimeout(connectionTimeout);
+ }
+
+ public boolean isDummyTrustManager() {
+ return getConfiguration().isDummyTrustManager();
+ }
+
+ /**
+ * To use a dummy security setting for trusting all certificates. Should only be used for development mode, and not production.
+ * @param dummyTrustManager
+ */
+ public void setDummyTrustManager(boolean dummyTrustManager) {
+ getConfiguration().setDummyTrustManager(dummyTrustManager);
+ }
+
+ public String getContentType() {
+ return getConfiguration().getContentType();
+ }
+
+ /**
+ * The mail message content type. Use text/html for HTML mails.
+ * @param contentType
+ */
+ public void setContentType(String contentType) {
+ getConfiguration().setContentType(contentType);
+ }
+
+ public String getAlternativeBodyHeader() {
+ return getConfiguration().getAlternativeBodyHeader();
+ }
+
+ /**
+ * 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.
+ * @param alternativeBodyHeader
+ */
+ public void setAlternativeBodyHeader(String alternativeBodyHeader) {
+ getConfiguration().setAlternativeBodyHeader(alternativeBodyHeader);
+ }
+
+ public boolean isUseInlineAttachments() {
+ return getConfiguration().isUseInlineAttachments();
+ }
+
+ /**
+ * Whether to use disposition inline or attachment.
+ * @param useInlineAttachments
+ */
+ public void setUseInlineAttachments(boolean useInlineAttachments) {
+ getConfiguration().setUseInlineAttachments(useInlineAttachments);
+ }
+
+ public boolean isIgnoreUnsupportedCharset() {
+ return getConfiguration().isIgnoreUnsupportedCharset();
+ }
+
+ /**
+ * 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.
+ * @param ignoreUnsupportedCharset
+ */
+ public void setIgnoreUnsupportedCharset(boolean ignoreUnsupportedCharset) {
+ getConfiguration().setIgnoreUnsupportedCharset(ignoreUnsupportedCharset);
+ }
+
+ public boolean isDisconnect() {
+ return getConfiguration().isDisconnect();
+ }
+
+ /**
+ * Whether the consumer should disconnect after polling. If enabled this forces Camel to connect on each poll.
+ * @param disconnect
+ */
+ public void setDisconnect(boolean disconnect) {
+ getConfiguration().setDisconnect(disconnect);
+ }
+
+ public boolean isCloseFolder() {
+ return getConfiguration().isCloseFolder();
+ }
+
+ /**
+ * 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.
+ * @param closeFolder
+ */
+ public void setCloseFolder(boolean closeFolder) {
+ getConfiguration().setCloseFolder(closeFolder);
+ }
+
+ public SSLContextParameters getSslContextParameters() {
+ return getConfiguration().getSslContextParameters();
+ }
+
+ /**
+ * To configure security using SSLContextParameters.
+ * @param sslContextParameters
+ */
+ public void setSslContextParameters(SSLContextParameters sslContextParameters) {
+ getConfiguration().setSslContextParameters(sslContextParameters);
+ }
+
+ public String getCopyTo() {
+ return getConfiguration().getCopyTo();
+ }
+
+ /**
+ * 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.
+ * @param copyTo
+ */
+ public void setCopyTo(String copyTo) {
+ getConfiguration().setCopyTo(copyTo);
+ }
+
+ public boolean isPeek() {
+ return getConfiguration().isPeek();
+ }
+
+ /**
+ * 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.
+ * @param peek
+ */
+ public void setPeek(boolean peek) {
+ getConfiguration().setPeek(peek);
+ }
+
+ public boolean isSkipFailedMessage() {
+ return getConfiguration().isSkipFailedMessage();
+ }
+
+ /**
+ * If the mail consumer cannot retrieve a given mail message, then this option allows to skip
+ * the message and move on to retrieve the next mail message.
+ * <p/>
+ * The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.
+ * @param skipFailedMessage
+ */
+ public void setSkipFailedMessage(boolean skipFailedMessage) {
+ getConfiguration().setSkipFailedMessage(skipFailedMessage);
+ }
+
+ public boolean isHandleFailedMessage() {
+ return getConfiguration().isHandleFailedMessage();
+ }
+
+ /**
+ * If the mail consumer cannot retrieve a given mail message, then this option allows to handle
+ * the caused exception by the consumer's error handler. By enable the bridge error handler on the consumer,
+ * then the Camel routing error handler can handle the exception instead.
+ * <p/>
+ * The default behavior would be the consumer throws an exception and no mails from the batch would be able to be routed by Camel.
+ * @param handleFailedMessage
+ */
+ public void setHandleFailedMessage(boolean handleFailedMessage) {
+ getConfiguration().setHandleFailedMessage(handleFailedMessage);
+ }
+
+ public AttachmentsContentTransferEncodingResolver getAttachmentsContentTransferEncodingResolver() {
+ return getConfiguration().getAttachmentsContentTransferEncodingResolver();
+ }
+
+ /**
+ * To use a custom AttachmentsContentTransferEncodingResolver to resolve what content-type-encoding to use for attachments.
+ * @param attachmentsContentTransferEncodingResolver
+ */
+ public void setAttachmentsContentTransferEncodingResolver(AttachmentsContentTransferEncodingResolver attachmentsContentTransferEncodingResolver) {
+ getConfiguration().setAttachmentsContentTransferEncodingResolver(attachmentsContentTransferEncodingResolver);
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mail/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
index 7b150d1..b5427e2 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
@@ -16,8 +16,13 @@
*/
package org.apache.camel.component.mail.springboot;
+import java.util.Properties;
+import javax.mail.Session;
+import org.apache.camel.component.mail.AttachmentsContentTransferEncodingResolver;
import org.apache.camel.component.mail.ContentTypeResolver;
+import org.apache.camel.component.mail.JavaMailSender;
import org.apache.camel.component.mail.MailConfiguration;
+import org.apache.camel.util.jsse.SSLContextParameters;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@@ -29,13 +34,209 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
public class MailComponentConfiguration {
/**
- * Sets the Mail configuration
+ * Sets the Mail configuration. Properties of the shared configuration can
+ * also be set individually.
*/
private MailConfiguration configuration;
/**
* Resolver to determine Content-Type for file attachments.
*/
private ContentTypeResolver contentTypeResolver;
+ /**
+ * To use a custom JavaMailSender for sending emails.
+ */
+ private JavaMailSender javaMailSender;
+ /**
+ * The mail server host name
+ */
+ private String host;
+ /**
+ * Sets the java mail options. Will clear any default properties and only
+ * use the properties provided for this method.
+ */
+ private Properties javaMailProperties;
+ /**
+ * Sets additional java mail properties that will append/override any
+ * default properties that is set based on all the other options. This is
+ * useful if you need to add some special options but want to keep the
+ * others as is.
+ */
+ private Properties additionalJavaMailProperties;
+ /**
+ * The password for login
+ */
+ private String password;
+ /**
+ * The Subject of the message being sent. Note: Setting the subject in the
+ * header takes precedence over this option.
+ */
+ private String subject;
+ /**
+ * The port number of the mail server
+ */
+ private Integer port;
+ /**
+ * The protocol for communicating with the mail server
+ */
+ private String protocol;
+ /**
+ * Specifies the mail session that camel should use for all mail
+ * interactions. Useful in scenarios where mail sessions are created and
+ * managed by some other resource such as a JavaEE container. If this is not
+ * specified Camel automatically creates the mail session for you.
+ */
+ private Session session;
+ /**
+ * The username for login
+ */
+ private String username;
+ /**
+ * The from email address
+ */
+ private String from;
+ /**
+ * 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.
+ */
+ private Boolean delete = false;
+ /**
+ * Specifies whether Camel should map the received mail message to Camel
+ * body/headers. If set to true the body of the mail message is mapped to
+ * the body of the Camel IN message and the mail headers are mapped to IN
+ * headers. If this option is set to false then the IN message contains a
+ * raw javax.mail.Message. You can retrieve this raw message by calling
+ * exchange.getIn().getBody(javax.mail.Message.class).
+ */
+ private Boolean mapMailMessage = false;
+ /**
+ * The folder to poll.
+ */
+ private String folderName;
+ /**
+ * 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.
+ */
+ private Boolean ignoreUriScheme = false;
+ /**
+ * Whether to limit by unseen mails only.
+ */
+ private Boolean unseen = false;
+ /**
+ * Sets the To email address. Separate multiple email addresses with comma.
+ */
+ private String to;
+ /**
+ * Sets the CC email address. Separate multiple email addresses with comma.
+ */
+ private String cc;
+ /**
+ * Sets the BCC email address. Separate multiple email addresses with comma.
+ */
+ private String bcc;
+ /**
+ * The Reply-To recipients (the receivers of the response mail). Separate
+ * multiple email addresses with a comma.
+ */
+ private String replyTo;
+ /**
+ * 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.
+ */
+ private Integer fetchSize;
+ /**
+ * Enable debug mode on the underlying mail framework. The SUN Mail
+ * framework logs the debug messages to System.out by default.
+ */
+ private Boolean debugMode = false;
+ /**
+ * The connection timeout in milliseconds.
+ */
+ private Integer connectionTimeout;
+ /**
+ * To use a dummy security setting for trusting all certificates. Should
+ * only be used for development mode and not production.
+ */
+ private Boolean dummyTrustManager = false;
+ /**
+ * The mail message content type. Use text/html for HTML mails.
+ */
+ private String contentType;
+ /**
+ * 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.
+ */
+ private String alternativeBodyHeader;
+ /**
+ * Whether to use disposition inline or attachment.
+ */
+ private Boolean useInlineAttachments = false;
+ /**
+ * 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.
+ */
+ private Boolean ignoreUnsupportedCharset = false;
+ /**
+ * Whether the consumer should disconnect after polling. If enabled this
+ * forces Camel to connect on each poll.
+ */
+ private Boolean disconnect = false;
+ /**
+ * 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.
+ */
+ private Boolean closeFolder = false;
+ /**
+ * To configure security using SSLContextParameters.
+ */
+ private SSLContextParameters sslContextParameters;
+ /**
+ * 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.
+ */
+ private String copyTo;
+ /**
+ * 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.
+ */
+ private Boolean peek = false;
+ /**
+ * If the mail consumer cannot retrieve a given mail message then this
+ * option allows to skip the message and move on to retrieve the next mail
+ * message. The default behavior would be the consumer throws an exception
+ * and no mails from the batch would be able to be routed by Camel.
+ */
+ private Boolean skipFailedMessage = false;
+ /**
+ * If the mail consumer cannot retrieve a given mail message then this
+ * option allows to handle the caused exception by the consumer's error
+ * handler. By enable the bridge error handler on the consumer then the
+ * Camel routing error handler can handle the exception instead. The default
+ * behavior would be the consumer throws an exception and no mails from the
+ * batch would be able to be routed by Camel.
+ */
+ private Boolean handleFailedMessage = false;
+ /**
+ * To use a custom AttachmentsContentTransferEncodingResolver to resolve
+ * what content-type-encoding to use for attachments.
+ */
+ private AttachmentsContentTransferEncodingResolver attachmentsContentTransferEncodingResolver;
public MailConfiguration getConfiguration() {
return configuration;
@@ -52,4 +253,295 @@ public class MailComponentConfiguration {
public void setContentTypeResolver(ContentTypeResolver contentTypeResolver) {
this.contentTypeResolver = contentTypeResolver;
}
+
+ public JavaMailSender getJavaMailSender() {
+ return javaMailSender;
+ }
+
+ public void setJavaMailSender(JavaMailSender javaMailSender) {
+ this.javaMailSender = javaMailSender;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public Properties getJavaMailProperties() {
+ return javaMailProperties;
+ }
+
+ public void setJavaMailProperties(Properties javaMailProperties) {
+ this.javaMailProperties = javaMailProperties;
+ }
+
+ public Properties getAdditionalJavaMailProperties() {
+ return additionalJavaMailProperties;
+ }
+
+ public void setAdditionalJavaMailProperties(
+ Properties additionalJavaMailProperties) {
+ this.additionalJavaMailProperties = additionalJavaMailProperties;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public Integer getPort() {
+ return port;
+ }
+
+ public void setPort(Integer port) {
+ this.port = port;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public Session getSession() {
+ return session;
+ }
+
+ public void setSession(Session session) {
+ this.session = session;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public Boolean getDelete() {
+ return delete;
+ }
+
+ public void setDelete(Boolean delete) {
+ this.delete = delete;
+ }
+
+ public Boolean getMapMailMessage() {
+ return mapMailMessage;
+ }
+
+ public void setMapMailMessage(Boolean mapMailMessage) {
+ this.mapMailMessage = mapMailMessage;
+ }
+
+ public String getFolderName() {
+ return folderName;
+ }
+
+ public void setFolderName(String folderName) {
+ this.folderName = folderName;
+ }
+
+ public Boolean getIgnoreUriScheme() {
+ return ignoreUriScheme;
+ }
+
+ public void setIgnoreUriScheme(Boolean ignoreUriScheme) {
+ this.ignoreUriScheme = ignoreUriScheme;
+ }
+
+ public Boolean getUnseen() {
+ return unseen;
+ }
+
+ public void setUnseen(Boolean unseen) {
+ this.unseen = unseen;
+ }
+
+ public String getTo() {
+ return to;
+ }
+
+ public void setTo(String to) {
+ this.to = to;
+ }
+
+ public String getCc() {
+ return cc;
+ }
+
+ public void setCc(String cc) {
+ this.cc = cc;
+ }
+
+ public String getBcc() {
+ return bcc;
+ }
+
+ public void setBcc(String bcc) {
+ this.bcc = bcc;
+ }
+
+ public String getReplyTo() {
+ return replyTo;
+ }
+
+ public void setReplyTo(String replyTo) {
+ this.replyTo = replyTo;
+ }
+
+ public Integer getFetchSize() {
+ return fetchSize;
+ }
+
+ public void setFetchSize(Integer fetchSize) {
+ this.fetchSize = fetchSize;
+ }
+
+ public Boolean getDebugMode() {
+ return debugMode;
+ }
+
+ public void setDebugMode(Boolean debugMode) {
+ this.debugMode = debugMode;
+ }
+
+ public Integer getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ public void setConnectionTimeout(Integer connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ public Boolean getDummyTrustManager() {
+ return dummyTrustManager;
+ }
+
+ public void setDummyTrustManager(Boolean dummyTrustManager) {
+ this.dummyTrustManager = dummyTrustManager;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getAlternativeBodyHeader() {
+ return alternativeBodyHeader;
+ }
+
+ public void setAlternativeBodyHeader(String alternativeBodyHeader) {
+ this.alternativeBodyHeader = alternativeBodyHeader;
+ }
+
+ public Boolean getUseInlineAttachments() {
+ return useInlineAttachments;
+ }
+
+ public void setUseInlineAttachments(Boolean useInlineAttachments) {
+ this.useInlineAttachments = useInlineAttachments;
+ }
+
+ public Boolean getIgnoreUnsupportedCharset() {
+ return ignoreUnsupportedCharset;
+ }
+
+ public void setIgnoreUnsupportedCharset(Boolean ignoreUnsupportedCharset) {
+ this.ignoreUnsupportedCharset = ignoreUnsupportedCharset;
+ }
+
+ public Boolean getDisconnect() {
+ return disconnect;
+ }
+
+ public void setDisconnect(Boolean disconnect) {
+ this.disconnect = disconnect;
+ }
+
+ public Boolean getCloseFolder() {
+ return closeFolder;
+ }
+
+ public void setCloseFolder(Boolean closeFolder) {
+ this.closeFolder = closeFolder;
+ }
+
+ public SSLContextParameters getSslContextParameters() {
+ return sslContextParameters;
+ }
+
+ public void setSslContextParameters(
+ SSLContextParameters sslContextParameters) {
+ this.sslContextParameters = sslContextParameters;
+ }
+
+ public String getCopyTo() {
+ return copyTo;
+ }
+
+ public void setCopyTo(String copyTo) {
+ this.copyTo = copyTo;
+ }
+
+ public Boolean getPeek() {
+ return peek;
+ }
+
+ public void setPeek(Boolean peek) {
+ this.peek = peek;
+ }
+
+ public Boolean getSkipFailedMessage() {
+ return skipFailedMessage;
+ }
+
+ public void setSkipFailedMessage(Boolean skipFailedMessage) {
+ this.skipFailedMessage = skipFailedMessage;
+ }
+
+ public Boolean getHandleFailedMessage() {
+ return handleFailedMessage;
+ }
+
+ public void setHandleFailedMessage(Boolean handleFailedMessage) {
+ this.handleFailedMessage = handleFailedMessage;
+ }
+
+ public AttachmentsContentTransferEncodingResolver getAttachmentsContentTransferEncodingResolver() {
+ return attachmentsContentTransferEncodingResolver;
+ }
+
+ public void setAttachmentsContentTransferEncodingResolver(
+ AttachmentsContentTransferEncodingResolver attachmentsContentTransferEncodingResolver) {
+ this.attachmentsContentTransferEncodingResolver = attachmentsContentTransferEncodingResolver;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mina/src/main/docs/mina.adoc
----------------------------------------------------------------------
diff --git a/components/camel-mina/src/main/docs/mina.adoc b/components/camel-mina/src/main/docs/mina.adoc
index 9584f29..3feb59c 100644
--- a/components/camel-mina/src/main/docs/mina.adoc
+++ b/components/camel-mina/src/main/docs/mina.adoc
@@ -65,8 +65,9 @@ Options
+
// component options: START
-The Mina component supports 1 options which are listed below.
+The Mina component supports 21 options which are listed below.
@@ -74,7 +75,27 @@ The Mina component supports 1 options which are listed below.
[width="100%",cols="2s,1m,8",options="header"]
|=======================================================================
| Name | Java Type | Description
-| configuration | MinaConfiguration | To use the shared mina configuration.
+| configuration | MinaConfiguration | To use the shared mina configuration. Properties of the shared configuration can also be set individually.
+| protocol | String | Protocol to use
+| host | String | Hostname to use. Use localhost or 0.0.0.0 for local server as consumer. For producer use the hostname or ip address of the remote server.
+| port | int | Port number
+| sync | boolean | Setting to set endpoint as one-way or request-response.
+| textline | boolean | Only used for TCP. If no codec is specified you can use this flag to indicate a text line based codec; if not specified or the value is false then Object Serialization is assumed over TCP.
+| textlineDelimiter | TextLineDelimiter | Only used for TCP and if textline=true. Sets the text line delimiter to use. If none provided Camel will use DEFAULT. This delimiter is used to mark the end of text.
+| codec | ProtocolCodecFactory | To use a custom minda codec implementation.
+| encoding | String | You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol. If not provided Camel will use the JVM default Charset
+| timeout | long | You can configure the timeout that specifies how long to wait for a response from a remote server. The timeout unit is in milliseconds so 60000 is 60 seconds.
+| lazySessionCreation | boolean | Sessions can be lazily created to avoid exceptions if the remote server is not up and running when the Camel producer is started.
+| transferExchange | boolean | Only used for TCP. You can transfer the exchange over the wire instead of just the body. The following fields are transferred: In body Out body fault body In headers Out headers fault headers exchange properties exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level.
+| encoderMaxLineLength | int | To set the textline protocol encoder max line length. By default the default value of Mina itself is used which are Integer.MAX_VALUE.
+| decoderMaxLineLength | int | To set the textline protocol decoder max line length. By default the default value of Mina itself is used which are 1024.
+| minaLogger | boolean | You can enable the Apache MINA logging filter. Apache MINA uses slf4j logging at INFO level to log all input and output.
+| filters | List | You can set a list of Mina IoFilters to use.
+| allowDefaultCodec | boolean | The mina component installs a default codec if both codec is null and textline is false. Setting allowDefaultCodec to false prevents the mina component from installing a default codec as the first element in the filter chain. This is useful in scenarios where another filter must be the first in the filter chain like the SSL filter.
+| disconnect | boolean | Whether or not to disconnect(close) from Mina session right after use. Can be used for both consumer and producer.
+| disconnectOnNoReply | boolean | If sync is enabled then this option dictates MinaConsumer if it should disconnect where there is no reply to send back.
+| noReplyLogLevel | LoggingLevel | If sync is enabled this option dictates MinaConsumer which logging level to use when logging a there is no reply to send back.
+| clientMode | boolean | If the clientMode is true mina consumer will connect the address as a TCP client.
|=======================================================================
{% endraw %}
// component options: END
@@ -84,6 +105,7 @@ The Mina component supports 1 options which are listed below.
+
// endpoint options: START
The Mina component supports 24 endpoint options which are listed below:
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
index aad0415..95da223 100644
--- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
+++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
@@ -27,6 +27,7 @@ import java.util.concurrent.ExecutorService;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.LoggingLevel;
import org.apache.camel.impl.UriEndpointComponent;
import org.apache.camel.util.ObjectHelper;
import org.apache.mina.common.DefaultIoFilterChainBuilder;
@@ -397,9 +398,277 @@ public class MinaComponent extends UriEndpointComponent {
}
/**
- * To use the shared mina configuration.
+ * To use the shared mina configuration. Properties of the shared configuration can also be set individually.
*/
public void setConfiguration(MinaConfiguration configuration) {
this.configuration = configuration;
}
+
+ private MinaConfiguration getConfigurationOrCreate() {
+ if (this.getConfiguration() == null) {
+ this.setConfiguration(new MinaConfiguration());
+ }
+ return this.getConfiguration();
+ }
+
+ public String getCharsetName() {
+ return getConfigurationOrCreate().getCharsetName();
+ }
+
+ public String getProtocol() {
+ return getConfigurationOrCreate().getProtocol();
+ }
+
+ /**
+ * Protocol to use
+ * @param protocol
+ */
+ public void setProtocol(String protocol) {
+ getConfigurationOrCreate().setProtocol(protocol);
+ }
+
+ public String getHost() {
+ return getConfigurationOrCreate().getHost();
+ }
+
+ /**
+ * Hostname to use. Use localhost or 0.0.0.0 for local server as consumer. For producer use the hostname or ip address of the remote server.
+ * @param host
+ */
+ public void setHost(String host) {
+ getConfigurationOrCreate().setHost(host);
+ }
+
+ public int getPort() {
+ return getConfigurationOrCreate().getPort();
+ }
+
+ /**
+ * Port number
+ * @param port
+ */
+ public void setPort(int port) {
+ getConfigurationOrCreate().setPort(port);
+ }
+
+ public boolean isSync() {
+ return getConfigurationOrCreate().isSync();
+ }
+
+ /**
+ * Setting to set endpoint as one-way or request-response.
+ * @param sync
+ */
+ public void setSync(boolean sync) {
+ getConfigurationOrCreate().setSync(sync);
+ }
+
+ public boolean isTextline() {
+ return getConfigurationOrCreate().isTextline();
+ }
+
+ /**
+ * Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec;
+ * if not specified or the value is false, then Object Serialization is assumed over TCP.
+ * @param textline
+ */
+ public void setTextline(boolean textline) {
+ getConfigurationOrCreate().setTextline(textline);
+ }
+
+ public TextLineDelimiter getTextlineDelimiter() {
+ return getConfigurationOrCreate().getTextlineDelimiter();
+ }
+
+ /**
+ * Only used for TCP and if textline=true. Sets the text line delimiter to use.
+ * If none provided, Camel will use DEFAULT.
+ * This delimiter is used to mark the end of text.
+ * @param textlineDelimiter
+ */
+ public void setTextlineDelimiter(TextLineDelimiter textlineDelimiter) {
+ getConfigurationOrCreate().setTextlineDelimiter(textlineDelimiter);
+ }
+
+ public ProtocolCodecFactory getCodec() {
+ return getConfigurationOrCreate().getCodec();
+ }
+
+ /**
+ * To use a custom minda codec implementation.
+ * @param codec
+ */
+ public void setCodec(ProtocolCodecFactory codec) {
+ getConfigurationOrCreate().setCodec(codec);
+ }
+
+ public String getEncoding() {
+ return getConfigurationOrCreate().getEncoding();
+ }
+
+ /**
+ * You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol.
+ * If not provided, Camel will use the JVM default Charset
+ * @param encoding
+ */
+ public void setEncoding(String encoding) {
+ getConfigurationOrCreate().setEncoding(encoding);
+ }
+
+ public long getTimeout() {
+ return getConfigurationOrCreate().getTimeout();
+ }
+
+ /**
+ * You can configure the timeout that specifies how long to wait for a response from a remote server.
+ * The timeout unit is in milliseconds, so 60000 is 60 seconds.
+ * @param timeout
+ */
+ public void setTimeout(long timeout) {
+ getConfigurationOrCreate().setTimeout(timeout);
+ }
+
+ public boolean isLazySessionCreation() {
+ return getConfigurationOrCreate().isLazySessionCreation();
+ }
+
+ /**
+ * Sessions can be lazily created to avoid exceptions, if the remote server is not up and running when the Camel producer is started.
+ * @param lazySessionCreation
+ */
+ public void setLazySessionCreation(boolean lazySessionCreation) {
+ getConfigurationOrCreate().setLazySessionCreation(lazySessionCreation);
+ }
+
+ public boolean isTransferExchange() {
+ return getConfigurationOrCreate().isTransferExchange();
+ }
+
+ /**
+ * Only used for TCP. You can transfer the exchange over the wire instead of just the body.
+ * The following fields are transferred: In body, Out body, fault body, In headers, Out headers, fault headers, exchange properties, exchange exception.
+ * This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level.
+ * @param transferExchange
+ */
+ public void setTransferExchange(boolean transferExchange) {
+ getConfigurationOrCreate().setTransferExchange(transferExchange);
+ }
+
+ /**
+ * To set the textline protocol encoder max line length. By default the default value of Mina itself is used which are Integer.MAX_VALUE.
+ * @param encoderMaxLineLength
+ */
+ public void setEncoderMaxLineLength(int encoderMaxLineLength) {
+ getConfigurationOrCreate().setEncoderMaxLineLength(encoderMaxLineLength);
+ }
+
+ public int getEncoderMaxLineLength() {
+ return getConfigurationOrCreate().getEncoderMaxLineLength();
+ }
+
+ /**
+ * To set the textline protocol decoder max line length. By default the default value of Mina itself is used which are 1024.
+ * @param decoderMaxLineLength
+ */
+ public void setDecoderMaxLineLength(int decoderMaxLineLength) {
+ getConfigurationOrCreate().setDecoderMaxLineLength(decoderMaxLineLength);
+ }
+
+ public int getDecoderMaxLineLength() {
+ return getConfigurationOrCreate().getDecoderMaxLineLength();
+ }
+
+ public boolean isMinaLogger() {
+ return getConfigurationOrCreate().isMinaLogger();
+ }
+
+ /**
+ * You can enable the Apache MINA logging filter. Apache MINA uses slf4j logging at INFO level to log all input and output.
+ * @param minaLogger
+ */
+ public void setMinaLogger(boolean minaLogger) {
+ getConfigurationOrCreate().setMinaLogger(minaLogger);
+ }
+
+ public List<IoFilter> getFilters() {
+ return getConfigurationOrCreate().getFilters();
+ }
+
+ /**
+ * You can set a list of Mina IoFilters to use.
+ * @param filters
+ */
+ public void setFilters(List<IoFilter> filters) {
+ getConfigurationOrCreate().setFilters(filters);
+ }
+
+ public boolean isDatagramProtocol() {
+ return getConfigurationOrCreate().isDatagramProtocol();
+ }
+
+ /**
+ * The mina component installs a default codec if both, codec is null and textline is false.
+ * Setting allowDefaultCodec to false prevents the mina component from installing a default codec as the first element in the filter chain.
+ * This is useful in scenarios where another filter must be the first in the filter chain, like the SSL filter.
+ * @param allowDefaultCodec
+ */
+ public void setAllowDefaultCodec(boolean allowDefaultCodec) {
+ getConfigurationOrCreate().setAllowDefaultCodec(allowDefaultCodec);
+ }
+
+ public boolean isAllowDefaultCodec() {
+ return getConfigurationOrCreate().isAllowDefaultCodec();
+ }
+
+ public boolean isDisconnect() {
+ return getConfigurationOrCreate().isDisconnect();
+ }
+
+ /**
+ * Whether or not to disconnect(close) from Mina session right after use. Can be used for both consumer and producer.
+ * @param disconnect
+ */
+ public void setDisconnect(boolean disconnect) {
+ getConfigurationOrCreate().setDisconnect(disconnect);
+ }
+
+ public boolean isDisconnectOnNoReply() {
+ return getConfigurationOrCreate().isDisconnectOnNoReply();
+ }
+
+ /**
+ * If sync is enabled then this option dictates MinaConsumer if it should disconnect where there is no reply to send back.
+ * @param disconnectOnNoReply
+ */
+ public void setDisconnectOnNoReply(boolean disconnectOnNoReply) {
+ getConfigurationOrCreate().setDisconnectOnNoReply(disconnectOnNoReply);
+ }
+
+ public LoggingLevel getNoReplyLogLevel() {
+ return getConfigurationOrCreate().getNoReplyLogLevel();
+ }
+
+ /**
+ * If sync is enabled this option dictates MinaConsumer which logging level to use when logging a there is no reply to send back.
+ * @param noReplyLogLevel
+ */
+ public void setNoReplyLogLevel(LoggingLevel noReplyLogLevel) {
+ getConfigurationOrCreate().setNoReplyLogLevel(noReplyLogLevel);
+ }
+
+ public boolean isClientMode() {
+ return getConfigurationOrCreate().isClientMode();
+ }
+
+ /**
+ * If the clientMode is true, mina consumer will connect the address as a TCP client.
+ * @param clientMode
+ */
+ public void setClientMode(boolean clientMode) {
+ getConfigurationOrCreate().setClientMode(clientMode);
+ }
+
+ public String getUriString() {
+ return getConfigurationOrCreate().getUriString();
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mina/src/main/java/org/apache/camel/component/mina/springboot/MinaComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/springboot/MinaComponentConfiguration.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/springboot/MinaComponentConfiguration.java
index 59c222e..0b169aa 100644
--- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/springboot/MinaComponentConfiguration.java
+++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/springboot/MinaComponentConfiguration.java
@@ -16,7 +16,12 @@
*/
package org.apache.camel.component.mina.springboot;
+import java.util.List;
+import org.apache.camel.LoggingLevel;
import org.apache.camel.component.mina.MinaConfiguration;
+import org.apache.camel.component.mina.TextLineDelimiter;
+import org.apache.mina.common.IoFilter;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@@ -28,9 +33,115 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
public class MinaComponentConfiguration {
/**
- * To use the shared mina configuration.
+ * To use the shared mina configuration. Properties of the shared
+ * configuration can also be set individually.
*/
private MinaConfiguration configuration;
+ /**
+ * Protocol to use
+ */
+ private String protocol;
+ /**
+ * Hostname to use. Use localhost or 0.0.0.0 for local server as consumer.
+ * For producer use the hostname or ip address of the remote server.
+ */
+ private String host;
+ /**
+ * Port number
+ */
+ private Integer port;
+ /**
+ * Setting to set endpoint as one-way or request-response.
+ */
+ private Boolean sync = false;
+ /**
+ * Only used for TCP. If no codec is specified you can use this flag to
+ * indicate a text line based codec; if not specified or the value is false
+ * then Object Serialization is assumed over TCP.
+ */
+ private Boolean textline = false;
+ /**
+ * Only used for TCP and if textline=true. Sets the text line delimiter to
+ * use. If none provided Camel will use DEFAULT. This delimiter is used to
+ * mark the end of text.
+ */
+ private TextLineDelimiter textlineDelimiter;
+ /**
+ * To use a custom minda codec implementation.
+ */
+ private ProtocolCodecFactory codec;
+ /**
+ * You can configure the encoding (a charset name) to use for the TCP
+ * textline codec and the UDP protocol. If not provided Camel will use the
+ * JVM default Charset
+ */
+ private String encoding;
+ /**
+ * You can configure the timeout that specifies how long to wait for a
+ * response from a remote server. The timeout unit is in milliseconds so
+ * 60000 is 60 seconds.
+ */
+ private long timeout;
+ /**
+ * Sessions can be lazily created to avoid exceptions if the remote server
+ * is not up and running when the Camel producer is started.
+ */
+ private Boolean lazySessionCreation = false;
+ /**
+ * Only used for TCP. You can transfer the exchange over the wire instead of
+ * just the body. The following fields are transferred: In body Out body
+ * fault body In headers Out headers fault headers exchange properties
+ * exchange exception. This requires that the objects are serializable.
+ * Camel will exclude any non-serializable objects and log it at WARN level.
+ */
+ private Boolean transferExchange = false;
+ /**
+ * To set the textline protocol encoder max line length. By default the
+ * default value of Mina itself is used which are Integer.MAX_VALUE.
+ */
+ private Integer encoderMaxLineLength;
+ /**
+ * To set the textline protocol decoder max line length. By default the
+ * default value of Mina itself is used which are 1024.
+ */
+ private Integer decoderMaxLineLength;
+ /**
+ * You can enable the Apache MINA logging filter. Apache MINA uses slf4j
+ * logging at INFO level to log all input and output.
+ */
+ private Boolean minaLogger = false;
+ /**
+ * You can set a list of Mina IoFilters to use.
+ */
+ private List<IoFilter> filters;
+ /**
+ * The mina component installs a default codec if both codec is null and
+ * textline is false. Setting allowDefaultCodec to false prevents the mina
+ * component from installing a default codec as the first element in the
+ * filter chain. This is useful in scenarios where another filter must be
+ * the first in the filter chain like the SSL filter.
+ */
+ private Boolean allowDefaultCodec = false;
+ /**
+ * Whether or not to disconnect(close) from Mina session right after use.
+ * Can be used for both consumer and producer.
+ */
+ private Boolean disconnect = false;
+ /**
+ * If sync is enabled then this option dictates MinaConsumer if it should
+ * disconnect where there is no reply to send back.
+ */
+ private Boolean disconnectOnNoReply = false;
+ /**
+ * If sync is enabled this option dictates MinaConsumer which logging level
+ * to use when logging a there is no reply to send back.
+ */
+ private LoggingLevel noReplyLogLevel;
+ /**
+ * If the clientMode is true mina consumer will connect the address as a TCP
+ * client.
+ */
+ private Boolean clientMode = false;
public MinaConfiguration getConfiguration() {
return configuration;
@@ -39,4 +150,164 @@ public class MinaComponentConfiguration {
public void setConfiguration(MinaConfiguration configuration) {
this.configuration = configuration;
}
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public Integer getPort() {
+ return port;
+ }
+
+ public void setPort(Integer port) {
+ this.port = port;
+ }
+
+ public Boolean getSync() {
+ return sync;
+ }
+
+ public void setSync(Boolean sync) {
+ this.sync = sync;
+ }
+
+ public Boolean getTextline() {
+ return textline;
+ }
+
+ public void setTextline(Boolean textline) {
+ this.textline = textline;
+ }
+
+ public TextLineDelimiter getTextlineDelimiter() {
+ return textlineDelimiter;
+ }
+
+ public void setTextlineDelimiter(TextLineDelimiter textlineDelimiter) {
+ this.textlineDelimiter = textlineDelimiter;
+ }
+
+ public ProtocolCodecFactory getCodec() {
+ return codec;
+ }
+
+ public void setCodec(ProtocolCodecFactory codec) {
+ this.codec = codec;
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public Boolean getLazySessionCreation() {
+ return lazySessionCreation;
+ }
+
+ public void setLazySessionCreation(Boolean lazySessionCreation) {
+ this.lazySessionCreation = lazySessionCreation;
+ }
+
+ public Boolean getTransferExchange() {
+ return transferExchange;
+ }
+
+ public void setTransferExchange(Boolean transferExchange) {
+ this.transferExchange = transferExchange;
+ }
+
+ public Integer getEncoderMaxLineLength() {
+ return encoderMaxLineLength;
+ }
+
+ public void setEncoderMaxLineLength(Integer encoderMaxLineLength) {
+ this.encoderMaxLineLength = encoderMaxLineLength;
+ }
+
+ public Integer getDecoderMaxLineLength() {
+ return decoderMaxLineLength;
+ }
+
+ public void setDecoderMaxLineLength(Integer decoderMaxLineLength) {
+ this.decoderMaxLineLength = decoderMaxLineLength;
+ }
+
+ public Boolean getMinaLogger() {
+ return minaLogger;
+ }
+
+ public void setMinaLogger(Boolean minaLogger) {
+ this.minaLogger = minaLogger;
+ }
+
+ public List<IoFilter> getFilters() {
+ return filters;
+ }
+
+ public void setFilters(List<IoFilter> filters) {
+ this.filters = filters;
+ }
+
+ public Boolean getAllowDefaultCodec() {
+ return allowDefaultCodec;
+ }
+
+ public void setAllowDefaultCodec(Boolean allowDefaultCodec) {
+ this.allowDefaultCodec = allowDefaultCodec;
+ }
+
+ public Boolean getDisconnect() {
+ return disconnect;
+ }
+
+ public void setDisconnect(Boolean disconnect) {
+ this.disconnect = disconnect;
+ }
+
+ public Boolean getDisconnectOnNoReply() {
+ return disconnectOnNoReply;
+ }
+
+ public void setDisconnectOnNoReply(Boolean disconnectOnNoReply) {
+ this.disconnectOnNoReply = disconnectOnNoReply;
+ }
+
+ public LoggingLevel getNoReplyLogLevel() {
+ return noReplyLogLevel;
+ }
+
+ public void setNoReplyLogLevel(LoggingLevel noReplyLogLevel) {
+ this.noReplyLogLevel = noReplyLogLevel;
+ }
+
+ public Boolean getClientMode() {
+ return clientMode;
+ }
+
+ public void setClientMode(Boolean clientMode) {
+ this.clientMode = clientMode;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mina2/src/main/docs/mina2.adoc
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/main/docs/mina2.adoc b/components/camel-mina2/src/main/docs/mina2.adoc
index f91afa3..94cfc23 100644
--- a/components/camel-mina2/src/main/docs/mina2.adoc
+++ b/components/camel-mina2/src/main/docs/mina2.adoc
@@ -66,8 +66,9 @@ Options
+
// component options: START
-The Mina2 component supports 1 options which are listed below.
+The Mina2 component supports 26 options which are listed below.
@@ -75,7 +76,32 @@ The Mina2 component supports 1 options which are listed below.
[width="100%",cols="2s,1m,8",options="header"]
|=======================================================================
| Name | Java Type | Description
-| configuration | Mina2Configuration | To use the shared mina configuration.
+| configuration | Mina2Configuration | To use the shared mina configuration. Properties of the shared configuration can also be set individually.
+| protocol | String | Protocol to use
+| host | String | Hostname to use. Use localhost or 0.0.0.0 for local server as consumer. For producer use the hostname or ip address of the remote server.
+| port | int | Port number
+| sync | boolean | Setting to set endpoint as one-way or request-response.
+| textline | boolean | Only used for TCP. If no codec is specified you can use this flag to indicate a text line based codec; if not specified or the value is false then Object Serialization is assumed over TCP.
+| textlineDelimiter | Mina2TextLineDelimiter | Only used for TCP and if textline=true. Sets the text line delimiter to use. If none provided Camel will use DEFAULT. This delimiter is used to mark the end of text.
+| codec | ProtocolCodecFactory | To use a custom minda codec implementation.
+| encoding | String | You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol. If not provided Camel will use the JVM default Charset
+| timeout | long | You can configure the timeout that specifies how long to wait for a response from a remote server. The timeout unit is in milliseconds so 60000 is 60 seconds.
+| lazySessionCreation | boolean | Sessions can be lazily created to avoid exceptions if the remote server is not up and running when the Camel producer is started.
+| transferExchange | boolean | Only used for TCP. You can transfer the exchange over the wire instead of just the body. The following fields are transferred: In body Out body fault body In headers Out headers fault headers exchange properties exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level.
+| encoderMaxLineLength | int | To set the textline protocol encoder max line length. By default the default value of Mina itself is used which are Integer.MAX_VALUE.
+| decoderMaxLineLength | int | To set the textline protocol decoder max line length. By default the default value of Mina itself is used which are 1024.
+| minaLogger | boolean | You can enable the Apache MINA logging filter. Apache MINA uses slf4j logging at INFO level to log all input and output.
+| filters | List | You can set a list of Mina IoFilters to use.
+| allowDefaultCodec | boolean | The mina component installs a default codec if both codec is null and textline is false. Setting allowDefaultCodec to false prevents the mina component from installing a default codec as the first element in the filter chain. This is useful in scenarios where another filter must be the first in the filter chain like the SSL filter.
+| disconnect | boolean | Whether or not to disconnect(close) from Mina session right after use. Can be used for both consumer and producer.
+| disconnectOnNoReply | boolean | If sync is enabled then this option dictates MinaConsumer if it should disconnect where there is no reply to send back.
+| noReplyLogLevel | LoggingLevel | If sync is enabled this option dictates MinaConsumer which logging level to use when logging a there is no reply to send back.
+| sslContextParameters | SSLContextParameters | To configure SSL security.
+| autoStartTls | boolean | Whether to auto start SSL handshake.
+| maximumPoolSize | int | Number of worker threads in the worker pool for TCP and UDP
+| orderedThreadPoolExecutor | boolean | Whether to use ordered thread pool to ensure events are processed orderly on the same channel.
+| cachedAddress | boolean | Whether to create the InetAddress once and reuse. Setting this to false allows to pickup DNS changes in the network.
+| clientMode | boolean | If the clientMode is true mina consumer will connect the address as a TCP client.
|=======================================================================
{% endraw %}
// component options: END
@@ -85,6 +111,7 @@ The Mina2 component supports 1 options which are listed below.
+
// endpoint options: START
The Mina2 component supports 29 endpoint options which are listed below:
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java
index 349b59a..279d3ba 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java
@@ -17,19 +17,23 @@
package org.apache.camel.component.mina2;
import java.net.URI;
+import java.util.List;
import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.LoggingLevel;
import org.apache.camel.impl.UriEndpointComponent;
import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.jsse.SSLContextParameters;
import org.apache.mina.core.filterchain.IoFilter;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
/**
* Component for Apache MINA 2.x.
*
- * @version
+ * @version
*/
public class Mina2Component extends UriEndpointComponent {
@@ -105,9 +109,337 @@ public class Mina2Component extends UriEndpointComponent {
}
/**
- * To use the shared mina configuration.
+ * To use the shared mina configuration. Properties of the shared configuration can also be set individually.
*/
public void setConfiguration(Mina2Configuration configuration) {
this.configuration = configuration;
}
+
+ private Mina2Configuration getConfigurationOrCreate() {
+ if (this.getConfiguration() == null) {
+ this.setConfiguration(new Mina2Configuration());
+ }
+ return this.getConfiguration();
+ }
+
+ public String getCharsetName() {
+ return getConfigurationOrCreate().getCharsetName();
+ }
+
+ public String getProtocol() {
+ return getConfigurationOrCreate().getProtocol();
+ }
+
+ /**
+ * Protocol to use
+ * @param protocol
+ */
+ public void setProtocol(String protocol) {
+ getConfigurationOrCreate().setProtocol(protocol);
+ }
+
+ public String getHost() {
+ return getConfigurationOrCreate().getHost();
+ }
+
+ /**
+ * Hostname to use. Use localhost or 0.0.0.0 for local server as consumer. For producer use the hostname or ip address of the remote server.
+ * @param host
+ */
+ public void setHost(String host) {
+ getConfigurationOrCreate().setHost(host);
+ }
+
+ public int getPort() {
+ return getConfigurationOrCreate().getPort();
+ }
+
+ /**
+ * Port number
+ * @param port
+ */
+ public void setPort(int port) {
+ getConfigurationOrCreate().setPort(port);
+ }
+
+ public boolean isSync() {
+ return getConfigurationOrCreate().isSync();
+ }
+
+ /**
+ * Setting to set endpoint as one-way or request-response.
+ * @param sync
+ */
+ public void setSync(boolean sync) {
+ getConfigurationOrCreate().setSync(sync);
+ }
+
+ public boolean isTextline() {
+ return getConfigurationOrCreate().isTextline();
+ }
+
+ /**
+ * Only used for TCP. If no codec is specified, you can use this flag to indicate a text line based codec;
+ * if not specified or the value is false, then Object Serialization is assumed over TCP.
+ * @param textline
+ */
+ public void setTextline(boolean textline) {
+ getConfigurationOrCreate().setTextline(textline);
+ }
+
+ public Mina2TextLineDelimiter getTextlineDelimiter() {
+ return getConfigurationOrCreate().getTextlineDelimiter();
+ }
+
+ /**
+ * Only used for TCP and if textline=true. Sets the text line delimiter to use.
+ * If none provided, Camel will use DEFAULT.
+ * This delimiter is used to mark the end of text.
+ * @param textlineDelimiter
+ */
+ public void setTextlineDelimiter(Mina2TextLineDelimiter textlineDelimiter) {
+ getConfigurationOrCreate().setTextlineDelimiter(textlineDelimiter);
+ }
+
+ public ProtocolCodecFactory getCodec() {
+ return getConfigurationOrCreate().getCodec();
+ }
+
+ /**
+ * To use a custom minda codec implementation.
+ * @param codec
+ */
+ public void setCodec(ProtocolCodecFactory codec) {
+ getConfigurationOrCreate().setCodec(codec);
+ }
+
+ public String getEncoding() {
+ return getConfigurationOrCreate().getEncoding();
+ }
+
+ /**
+ * You can configure the encoding (a charset name) to use for the TCP textline codec and the UDP protocol.
+ * If not provided, Camel will use the JVM default Charset
+ * @param encoding
+ */
+ public void setEncoding(String encoding) {
+ getConfigurationOrCreate().setEncoding(encoding);
+ }
+
+ public long getTimeout() {
+ return getConfigurationOrCreate().getTimeout();
+ }
+
+ /**
+ * You can configure the timeout that specifies how long to wait for a response from a remote server.
+ * The timeout unit is in milliseconds, so 60000 is 60 seconds.
+ * @param timeout
+ */
+ public void setTimeout(long timeout) {
+ getConfigurationOrCreate().setTimeout(timeout);
+ }
+
+ public boolean isLazySessionCreation() {
+ return getConfigurationOrCreate().isLazySessionCreation();
+ }
+
+ /**
+ * Sessions can be lazily created to avoid exceptions, if the remote server is not up and running when the Camel producer is started.
+ * @param lazySessionCreation
+ */
+ public void setLazySessionCreation(boolean lazySessionCreation) {
+ getConfigurationOrCreate().setLazySessionCreation(lazySessionCreation);
+ }
+
+ public boolean isTransferExchange() {
+ return getConfigurationOrCreate().isTransferExchange();
+ }
+
+ /**
+ * Only used for TCP. You can transfer the exchange over the wire instead of just the body.
+ * The following fields are transferred: In body, Out body, fault body, In headers, Out headers, fault headers, exchange properties, exchange exception.
+ * This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level.
+ * @param transferExchange
+ */
+ public void setTransferExchange(boolean transferExchange) {
+ getConfigurationOrCreate().setTransferExchange(transferExchange);
+ }
+
+ /**
+ * To set the textline protocol encoder max line length. By default the default value of Mina itself is used which are Integer.MAX_VALUE.
+ * @param encoderMaxLineLength
+ */
+ public void setEncoderMaxLineLength(int encoderMaxLineLength) {
+ getConfigurationOrCreate().setEncoderMaxLineLength(encoderMaxLineLength);
+ }
+
+ public int getEncoderMaxLineLength() {
+ return getConfigurationOrCreate().getEncoderMaxLineLength();
+ }
+
+ /**
+ * To set the textline protocol decoder max line length. By default the default value of Mina itself is used which are 1024.
+ * @param decoderMaxLineLength
+ */
+ public void setDecoderMaxLineLength(int decoderMaxLineLength) {
+ getConfigurationOrCreate().setDecoderMaxLineLength(decoderMaxLineLength);
+ }
+
+ public int getDecoderMaxLineLength() {
+ return getConfigurationOrCreate().getDecoderMaxLineLength();
+ }
+
+ public boolean isMinaLogger() {
+ return getConfigurationOrCreate().isMinaLogger();
+ }
+
+ /**
+ * You can enable the Apache MINA logging filter. Apache MINA uses slf4j logging at INFO level to log all input and output.
+ * @param minaLogger
+ */
+ public void setMinaLogger(boolean minaLogger) {
+ getConfigurationOrCreate().setMinaLogger(minaLogger);
+ }
+
+ public List<IoFilter> getFilters() {
+ return getConfigurationOrCreate().getFilters();
+ }
+
+ /**
+ * You can set a list of Mina IoFilters to use.
+ * @param filters
+ */
+ public void setFilters(List<IoFilter> filters) {
+ getConfigurationOrCreate().setFilters(filters);
+ }
+
+ public boolean isDatagramProtocol() {
+ return getConfigurationOrCreate().isDatagramProtocol();
+ }
+
+ /**
+ * The mina component installs a default codec if both, codec is null and textline is false.
+ * Setting allowDefaultCodec to false prevents the mina component from installing a default codec as the first element in the filter chain.
+ * This is useful in scenarios where another filter must be the first in the filter chain, like the SSL filter.
+ * @param allowDefaultCodec
+ */
+ public void setAllowDefaultCodec(boolean allowDefaultCodec) {
+ getConfigurationOrCreate().setAllowDefaultCodec(allowDefaultCodec);
+ }
+
+ public boolean isAllowDefaultCodec() {
+ return getConfigurationOrCreate().isAllowDefaultCodec();
+ }
+
+ public boolean isDisconnect() {
+ return getConfigurationOrCreate().isDisconnect();
+ }
+
+ /**
+ * Whether or not to disconnect(close) from Mina session right after use. Can be used for both consumer and producer.
+ * @param disconnect
+ */
+ public void setDisconnect(boolean disconnect) {
+ getConfigurationOrCreate().setDisconnect(disconnect);
+ }
+
+ public boolean isDisconnectOnNoReply() {
+ return getConfigurationOrCreate().isDisconnectOnNoReply();
+ }
+
+ /**
+ * If sync is enabled then this option dictates MinaConsumer if it should disconnect where there is no reply to send back.
+ * @param disconnectOnNoReply
+ */
+ public void setDisconnectOnNoReply(boolean disconnectOnNoReply) {
+ getConfigurationOrCreate().setDisconnectOnNoReply(disconnectOnNoReply);
+ }
+
+ public LoggingLevel getNoReplyLogLevel() {
+ return getConfigurationOrCreate().getNoReplyLogLevel();
+ }
+
+ /**
+ * If sync is enabled this option dictates MinaConsumer which logging level to use when logging a there is no reply to send back.
+ * @param noReplyLogLevel
+ */
+ public void setNoReplyLogLevel(LoggingLevel noReplyLogLevel) {
+ getConfigurationOrCreate().setNoReplyLogLevel(noReplyLogLevel);
+ }
+
+ public SSLContextParameters getSslContextParameters() {
+ return getConfigurationOrCreate().getSslContextParameters();
+ }
+
+ /**
+ * To configure SSL security.
+ * @param sslContextParameters
+ */
+ public void setSslContextParameters(SSLContextParameters sslContextParameters) {
+ getConfigurationOrCreate().setSslContextParameters(sslContextParameters);
+ }
+
+ public boolean isAutoStartTls() {
+ return getConfigurationOrCreate().isAutoStartTls();
+ }
+
+ /**
+ * Whether to auto start SSL handshake.
+ * @param autoStartTls
+ */
+ public void setAutoStartTls(boolean autoStartTls) {
+ getConfigurationOrCreate().setAutoStartTls(autoStartTls);
+ }
+
+ public int getMaximumPoolSize() {
+ return getConfigurationOrCreate().getMaximumPoolSize();
+ }
+
+ /**
+ * Number of worker threads in the worker pool for TCP and UDP
+ * @param maximumPoolSize
+ */
+ public void setMaximumPoolSize(int maximumPoolSize) {
+ getConfigurationOrCreate().setMaximumPoolSize(maximumPoolSize);
+ }
+
+ public boolean isOrderedThreadPoolExecutor() {
+ return getConfigurationOrCreate().isOrderedThreadPoolExecutor();
+ }
+
+ /**
+ * Whether to use ordered thread pool, to ensure events are processed orderly on the same channel.
+ * @param orderedThreadPoolExecutor
+ */
+ public void setOrderedThreadPoolExecutor(boolean orderedThreadPoolExecutor) {
+ getConfigurationOrCreate().setOrderedThreadPoolExecutor(orderedThreadPoolExecutor);
+ }
+
+ /**
+ * Whether to create the InetAddress once and reuse. Setting this to false allows to pickup DNS changes in the network.
+ * @param shouldCacheAddress
+ */
+ public void setCachedAddress(boolean shouldCacheAddress) {
+ getConfigurationOrCreate().setCachedAddress(shouldCacheAddress);
+ }
+
+ public boolean isCachedAddress() {
+ return getConfigurationOrCreate().isCachedAddress();
+ }
+
+ /**
+ * If the clientMode is true, mina consumer will connect the address as a TCP client.
+ * @param clientMode
+ */
+ public void setClientMode(boolean clientMode) {
+ getConfigurationOrCreate().setClientMode(clientMode);
+ }
+
+ public boolean isClientMode() {
+ return getConfigurationOrCreate().isClientMode();
+ }
+
+ public String getUriString() {
+ return getConfigurationOrCreate().getUriString();
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/bdab2fc6/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
index 38dcc81..9de1b29 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
@@ -16,7 +16,13 @@
*/
package org.apache.camel.component.mina2.springboot;
+import java.util.List;
+import org.apache.camel.LoggingLevel;
import org.apache.camel.component.mina2.Mina2Configuration;
+import org.apache.camel.component.mina2.Mina2TextLineDelimiter;
+import org.apache.camel.util.jsse.SSLContextParameters;
+import org.apache.mina.core.filterchain.IoFilter;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@@ -28,9 +34,137 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
public class Mina2ComponentConfiguration {
/**
- * To use the shared mina configuration.
+ * To use the shared mina configuration. Properties of the shared
+ * configuration can also be set individually.
*/
private Mina2Configuration configuration;
+ /**
+ * Protocol to use
+ */
+ private String protocol;
+ /**
+ * Hostname to use. Use localhost or 0.0.0.0 for local server as consumer.
+ * For producer use the hostname or ip address of the remote server.
+ */
+ private String host;
+ /**
+ * Port number
+ */
+ private Integer port;
+ /**
+ * Setting to set endpoint as one-way or request-response.
+ */
+ private Boolean sync = false;
+ /**
+ * Only used for TCP. If no codec is specified you can use this flag to
+ * indicate a text line based codec; if not specified or the value is false
+ * then Object Serialization is assumed over TCP.
+ */
+ private Boolean textline = false;
+ /**
+ * Only used for TCP and if textline=true. Sets the text line delimiter to
+ * use. If none provided Camel will use DEFAULT. This delimiter is used to
+ * mark the end of text.
+ */
+ private Mina2TextLineDelimiter textlineDelimiter;
+ /**
+ * To use a custom minda codec implementation.
+ */
+ private ProtocolCodecFactory codec;
+ /**
+ * You can configure the encoding (a charset name) to use for the TCP
+ * textline codec and the UDP protocol. If not provided Camel will use the
+ * JVM default Charset
+ */
+ private String encoding;
+ /**
+ * You can configure the timeout that specifies how long to wait for a
+ * response from a remote server. The timeout unit is in milliseconds so
+ * 60000 is 60 seconds.
+ */
+ private long timeout;
+ /**
+ * Sessions can be lazily created to avoid exceptions if the remote server
+ * is not up and running when the Camel producer is started.
+ */
+ private Boolean lazySessionCreation = false;
+ /**
+ * Only used for TCP. You can transfer the exchange over the wire instead of
+ * just the body. The following fields are transferred: In body Out body
+ * fault body In headers Out headers fault headers exchange properties
+ * exchange exception. This requires that the objects are serializable.
+ * Camel will exclude any non-serializable objects and log it at WARN level.
+ */
+ private Boolean transferExchange = false;
+ /**
+ * To set the textline protocol encoder max line length. By default the
+ * default value of Mina itself is used which are Integer.MAX_VALUE.
+ */
+ private Integer encoderMaxLineLength;
+ /**
+ * To set the textline protocol decoder max line length. By default the
+ * default value of Mina itself is used which are 1024.
+ */
+ private Integer decoderMaxLineLength;
+ /**
+ * You can enable the Apache MINA logging filter. Apache MINA uses slf4j
+ * logging at INFO level to log all input and output.
+ */
+ private Boolean minaLogger = false;
+ /**
+ * You can set a list of Mina IoFilters to use.
+ */
+ private List<IoFilter> filters;
+ /**
+ * The mina component installs a default codec if both codec is null and
+ * textline is false. Setting allowDefaultCodec to false prevents the mina
+ * component from installing a default codec as the first element in the
+ * filter chain. This is useful in scenarios where another filter must be
+ * the first in the filter chain like the SSL filter.
+ */
+ private Boolean allowDefaultCodec = false;
+ /**
+ * Whether or not to disconnect(close) from Mina session right after use.
+ * Can be used for both consumer and producer.
+ */
+ private Boolean disconnect = false;
+ /**
+ * If sync is enabled then this option dictates MinaConsumer if it should
+ * disconnect where there is no reply to send back.
+ */
+ private Boolean disconnectOnNoReply = false;
+ /**
+ * If sync is enabled this option dictates MinaConsumer which logging level
+ * to use when logging a there is no reply to send back.
+ */
+ private LoggingLevel noReplyLogLevel;
+ /**
+ * To configure SSL security.
+ */
+ private SSLContextParameters sslContextParameters;
+ /**
+ * Whether to auto start SSL handshake.
+ */
+ private Boolean autoStartTls = false;
+ /**
+ * Number of worker threads in the worker pool for TCP and UDP
+ */
+ private Integer maximumPoolSize;
+ /**
+ * Whether to use ordered thread pool to ensure events are processed orderly
+ * on the same channel.
+ */
+ private Boolean orderedThreadPoolExecutor = false;
+ /**
+ * Whether to create the InetAddress once and reuse. Setting this to false
+ * allows to pickup DNS changes in the network.
+ */
+ private Boolean cachedAddress = false;
+ /**
+ * If the clientMode is true mina consumer will connect the address as a TCP
+ * client.
+ */
+ private Boolean clientMode = false;
public Mina2Configuration getConfiguration() {
return configuration;
@@ -39,4 +173,205 @@ public class Mina2ComponentConfiguration {
public void setConfiguration(Mina2Configuration configuration) {
this.configuration = configuration;
}
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public Integer getPort() {
+ return port;
+ }
+
+ public void setPort(Integer port) {
+ this.port = port;
+ }
+
+ public Boolean getSync() {
+ return sync;
+ }
+
+ public void setSync(Boolean sync) {
+ this.sync = sync;
+ }
+
+ public Boolean getTextline() {
+ return textline;
+ }
+
+ public void setTextline(Boolean textline) {
+ this.textline = textline;
+ }
+
+ public Mina2TextLineDelimiter getTextlineDelimiter() {
+ return textlineDelimiter;
+ }
+
+ public void setTextlineDelimiter(Mina2TextLineDelimiter textlineDelimiter) {
+ this.textlineDelimiter = textlineDelimiter;
+ }
+
+ public ProtocolCodecFactory getCodec() {
+ return codec;
+ }
+
+ public void setCodec(ProtocolCodecFactory codec) {
+ this.codec = codec;
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public Boolean getLazySessionCreation() {
+ return lazySessionCreation;
+ }
+
+ public void setLazySessionCreation(Boolean lazySessionCreation) {
+ this.lazySessionCreation = lazySessionCreation;
+ }
+
+ public Boolean getTransferExchange() {
+ return transferExchange;
+ }
+
+ public void setTransferExchange(Boolean transferExchange) {
+ this.transferExchange = transferExchange;
+ }
+
+ public Integer getEncoderMaxLineLength() {
+ return encoderMaxLineLength;
+ }
+
+ public void setEncoderMaxLineLength(Integer encoderMaxLineLength) {
+ this.encoderMaxLineLength = encoderMaxLineLength;
+ }
+
+ public Integer getDecoderMaxLineLength() {
+ return decoderMaxLineLength;
+ }
+
+ public void setDecoderMaxLineLength(Integer decoderMaxLineLength) {
+ this.decoderMaxLineLength = decoderMaxLineLength;
+ }
+
+ public Boolean getMinaLogger() {
+ return minaLogger;
+ }
+
+ public void setMinaLogger(Boolean minaLogger) {
+ this.minaLogger = minaLogger;
+ }
+
+ public List<IoFilter> getFilters() {
+ return filters;
+ }
+
+ public void setFilters(List<IoFilter> filters) {
+ this.filters = filters;
+ }
+
+ public Boolean getAllowDefaultCodec() {
+ return allowDefaultCodec;
+ }
+
+ public void setAllowDefaultCodec(Boolean allowDefaultCodec) {
+ this.allowDefaultCodec = allowDefaultCodec;
+ }
+
+ public Boolean getDisconnect() {
+ return disconnect;
+ }
+
+ public void setDisconnect(Boolean disconnect) {
+ this.disconnect = disconnect;
+ }
+
+ public Boolean getDisconnectOnNoReply() {
+ return disconnectOnNoReply;
+ }
+
+ public void setDisconnectOnNoReply(Boolean disconnectOnNoReply) {
+ this.disconnectOnNoReply = disconnectOnNoReply;
+ }
+
+ public LoggingLevel getNoReplyLogLevel() {
+ return noReplyLogLevel;
+ }
+
+ public void setNoReplyLogLevel(LoggingLevel noReplyLogLevel) {
+ this.noReplyLogLevel = noReplyLogLevel;
+ }
+
+ public SSLContextParameters getSslContextParameters() {
+ return sslContextParameters;
+ }
+
+ public void setSslContextParameters(
+ SSLContextParameters sslContextParameters) {
+ this.sslContextParameters = sslContextParameters;
+ }
+
+ public Boolean getAutoStartTls() {
+ return autoStartTls;
+ }
+
+ public void setAutoStartTls(Boolean autoStartTls) {
+ this.autoStartTls = autoStartTls;
+ }
+
+ public Integer getMaximumPoolSize() {
+ return maximumPoolSize;
+ }
+
+ public void setMaximumPoolSize(Integer maximumPoolSize) {
+ this.maximumPoolSize = maximumPoolSize;
+ }
+
+ public Boolean getOrderedThreadPoolExecutor() {
+ return orderedThreadPoolExecutor;
+ }
+
+ public void setOrderedThreadPoolExecutor(Boolean orderedThreadPoolExecutor) {
+ this.orderedThreadPoolExecutor = orderedThreadPoolExecutor;
+ }
+
+ public Boolean getCachedAddress() {
+ return cachedAddress;
+ }
+
+ public void setCachedAddress(Boolean cachedAddress) {
+ this.cachedAddress = cachedAddress;
+ }
+
+ public Boolean getClientMode() {
+ return clientMode;
+ }
+
+ public void setClientMode(Boolean clientMode) {
+ this.clientMode = clientMode;
+ }
}
\ No newline at end of file