http://git-wip-us.apache.org/repos/asf/camel/blob/a04fb15b/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 10b5514..081d364 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,11 +19,8 @@ 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; @@ -31,7 +28,6 @@ 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. @@ -111,7 +107,7 @@ public class MailComponent extends UriEndpointComponent { } /** - * Sets the Mail configuration. Properties of the shared configuration can also be set individually. + * Sets the Mail configuration * * @param configuration the configuration to use by default for endpoints */ @@ -129,484 +125,4 @@ 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/a04fb15b/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 95da223..aad0415 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,7 +27,6 @@ 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; @@ -398,277 +397,9 @@ public class MinaComponent extends UriEndpointComponent { } /** - * To use the shared mina configuration. Properties of the shared configuration can also be set individually. + * To use the shared mina configuration. */ 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/a04fb15b/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 279d3ba..349b59a 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,23 +17,19 @@ 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 { @@ -109,337 +105,9 @@ public class Mina2Component extends UriEndpointComponent { } /** - * To use the shared mina configuration. Properties of the shared configuration can also be set individually. + * To use the shared mina configuration. */ 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/a04fb15b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosComponent.java b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosComponent.java index 987b40b..c86e347 100644 --- a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosComponent.java +++ b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosComponent.java @@ -19,8 +19,6 @@ package org.apache.camel.component.nagios; import java.net.URI; import java.util.Map; -import com.googlecode.jsendnsca.core.NagiosSettings; - import org.apache.camel.Endpoint; import org.apache.camel.impl.UriEndpointComponent; import org.apache.camel.util.ObjectHelper; @@ -59,82 +57,9 @@ public class NagiosComponent extends UriEndpointComponent { } /** - * To use a shared configuraiton. Properties of the shared configuration can also be set individually. + * To use a shared {@link NagiosConfiguration} */ public void setConfiguration(NagiosConfiguration configuration) { this.configuration = configuration; } - - - public String getHost() { - return configuration.getHost(); - } - - /** - * This is the address of the Nagios host where checks should be send. - * @param host - */ - public void setHost(String host) { - configuration.setHost(host); - } - - public int getPort() { - return configuration.getPort(); - } - - /** - * The port number of the host. - * @param port - */ - public void setPort(int port) { - configuration.setPort(port); - } - - public int getConnectionTimeout() { - return configuration.getConnectionTimeout(); - } - - /** - * Connection timeout in millis. - * @param connectionTimeout - */ - public void setConnectionTimeout(int connectionTimeout) { - configuration.setConnectionTimeout(connectionTimeout); - } - - public int getTimeout() { - return configuration.getTimeout(); - } - - /** - * Sending timeout in millis. - * @param timeout - */ - public void setTimeout(int timeout) { - configuration.setTimeout(timeout); - } - - public String getPassword() { - return configuration.getPassword(); - } - - /** - * Password to be authenticated when sending checks to Nagios. - * @param password - */ - public void setPassword(String password) { - configuration.setPassword(password); - } - - public NagiosEncryptionMethod getEncryptionMethod() { - return configuration.getEncryptionMethod(); - } - - /** - * To specify an encryption method. - * @param encryptionMethod - */ - public void setEncryptionMethod(NagiosEncryptionMethod encryptionMethod) { - configuration.setEncryptionMethod(encryptionMethod); - } } http://git-wip-us.apache.org/repos/asf/camel/blob/a04fb15b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java index 9e96de8..9565000 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyComponent.java @@ -18,24 +18,16 @@ package org.apache.camel.component.netty; import java.net.URI; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; -import org.apache.camel.LoggingLevel; import org.apache.camel.impl.UriEndpointComponent; import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.concurrent.CamelThreadFactory; -import org.apache.camel.util.jsse.SSLContextParameters; -import org.jboss.netty.channel.ChannelHandler; -import org.jboss.netty.channel.group.ChannelGroup; -import org.jboss.netty.channel.socket.nio.BossPool; -import org.jboss.netty.channel.socket.nio.WorkerPool; import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; -import org.jboss.netty.handler.ssl.SslHandler; import org.jboss.netty.util.HashedWheelTimer; import org.jboss.netty.util.Timer; @@ -101,7 +93,7 @@ public class NettyComponent extends UriEndpointComponent { } /** - * To use the NettyConfiguration as configuration when creating endpoints. Properties of the shared configuration can also be set individually. + * To use the NettyConfiguration as configuration when creating endpoints. */ public void setConfiguration(NettyConfiguration configuration) { this.configuration = configuration; @@ -120,144 +112,6 @@ public class NettyComponent extends UriEndpointComponent { this.maximumPoolSize = maximumPoolSize; } - public boolean isOrderedThreadPoolExecutor() { - return getConfigurationOrCreate().isOrderedThreadPoolExecutor(); - } - - /** - * Whether to use ordered thread pool, to ensure events are processed orderly on the same channel. - * See details at the netty javadoc of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor for more details. - * @param orderedThreadPoolExecutor - */ - public void setOrderedThreadPoolExecutor(boolean orderedThreadPoolExecutor) { - getConfigurationOrCreate().setOrderedThreadPoolExecutor(orderedThreadPoolExecutor); - } - - public int getProducerPoolMaxActive() { - return getConfigurationOrCreate().getProducerPoolMaxActive(); - } - - /** - * Sets the cap on the number of objects that can be allocated by the pool - * (checked out to clients, or idle awaiting checkout) at a given time. Use a negative value for no limit. - * @param producerPoolMaxActive - */ - public void setProducerPoolMaxActive(int producerPoolMaxActive) { - getConfigurationOrCreate().setProducerPoolMaxActive(producerPoolMaxActive); - } - - public int getProducerPoolMinIdle() { - return getConfigurationOrCreate().getProducerPoolMinIdle(); - } - - /** - * Sets the minimum number of instances allowed in the producer pool before the evictor thread (if active) spawns new objects. - * @param producerPoolMinIdle - */ - public void setProducerPoolMinIdle(int producerPoolMinIdle) { - getConfigurationOrCreate().setProducerPoolMinIdle(producerPoolMinIdle); - } - - public int getProducerPoolMaxIdle() { - return getConfigurationOrCreate().getProducerPoolMaxIdle(); - } - - /** - * Sets the cap on the number of "idle" instances in the pool. - * @param producerPoolMaxIdle - */ - public void setProducerPoolMaxIdle(int producerPoolMaxIdle) { - getConfigurationOrCreate().setProducerPoolMaxIdle(producerPoolMaxIdle); - } - - public long getProducerPoolMinEvictableIdle() { - return getConfigurationOrCreate().getProducerPoolMinEvictableIdle(); - } - - /** - * Sets the minimum amount of time (value in millis) an object may sit idle in the pool before it is eligible for eviction by the idle object evictor. - * @param producerPoolMinEvictableIdle - */ - public void setProducerPoolMinEvictableIdle(long producerPoolMinEvictableIdle) { - getConfigurationOrCreate().setProducerPoolMinEvictableIdle(producerPoolMinEvictableIdle); - } - - public boolean isProducerPoolEnabled() { - return getConfigurationOrCreate().isProducerPoolEnabled(); - } - - /** - * Whether producer pool is enabled or not. - * Important: Do not turn this off, as the pooling is needed for handling concurrency and reliable request/reply. - * @param producerPoolEnabled - */ - public void setProducerPoolEnabled(boolean producerPoolEnabled) { - getConfigurationOrCreate().setProducerPoolEnabled(producerPoolEnabled); - } - - public boolean isUdpConnectionlessSending() { - return getConfigurationOrCreate().isUdpConnectionlessSending(); - } - - /** - * This option supports connection less udp sending which is a real fire and forget. - * A connected udp send receive the PortUnreachableException if no one is listen on the receiving port. - * @param udpConnectionlessSending - */ - public void setUdpConnectionlessSending(boolean udpConnectionlessSending) { - getConfigurationOrCreate().setUdpConnectionlessSending(udpConnectionlessSending); - } - - public boolean isClientMode() { - return getConfigurationOrCreate().isClientMode(); - } - - /** - * If the clientMode is true, netty consumer will connect the address as a TCP client. - * @param clientMode - */ - public void setClientMode(boolean clientMode) { - getConfigurationOrCreate().setClientMode(clientMode); - } - - public boolean isUseChannelBuffer() { - return getConfigurationOrCreate().isUseChannelBuffer(); - } - - /** - * If the useChannelBuffer is true, netty producer will turn the message body into {@link ChannelBuffer} before sending it out. - * @param useChannelBuffer - */ - public void setUseChannelBuffer(boolean useChannelBuffer) { - getConfigurationOrCreate().setUseChannelBuffer(useChannelBuffer); - } - - public long getMaxChannelMemorySize() { - return getConfigurationOrCreate().getMaxChannelMemorySize(); - } - - /** - * The maximum total size of the queued events per channel when using orderedThreadPoolExecutor. - * Specify 0 to disable. - * @param maxChannelMemorySize - */ - public void setMaxChannelMemorySize(long maxChannelMemorySize) { - getConfigurationOrCreate().setMaxChannelMemorySize(maxChannelMemorySize); - } - - public long getMaxTotalMemorySize() { - return getConfigurationOrCreate().getMaxTotalMemorySize(); - } - - /** - * The maximum total size of the queued events for this pool when using orderedThreadPoolExecutor. - * Specify 0 to disable. - * @param maxTotalMemorySize - */ - public void setMaxTotalMemorySize(long maxTotalMemorySize) { - getConfigurationOrCreate().setMaxTotalMemorySize(maxTotalMemorySize); - } - public Timer getTimer() { return timer; } @@ -317,671 +171,4 @@ public class NettyComponent extends UriEndpointComponent { super.doStop(); } - private NettyConfiguration getConfigurationOrCreate() { - if (this.getConfiguration() == null) { - this.setConfiguration(new NettyConfiguration()); - } - return this.getConfiguration(); - } - - public String getAddress() { - return getConfigurationOrCreate().getAddress(); - } - - public boolean isTcp() { - return getConfigurationOrCreate().isTcp(); - } - - public String getProtocol() { - return getConfigurationOrCreate().getProtocol(); - } - - /** - * The protocol to use which can be tcp or udp. - * @param protocol - */ - public void setProtocol(String protocol) { - getConfigurationOrCreate().setProtocol(protocol); - } - - public String getHost() { - return getConfigurationOrCreate().getHost(); - } - - /** - * The hostname. - * <p/> - * For the consumer the hostname is localhost or 0.0.0.0 - * For the producer the hostname is the remote host to connect to - * @param host - */ - public void setHost(String host) { - getConfigurationOrCreate().setHost(host); - } - - public int getPort() { - return getConfigurationOrCreate().getPort(); - } - - /** - * The host port number - * @param port - */ - public void setPort(int port) { - getConfigurationOrCreate().setPort(port); - } - - public boolean isBroadcast() { - return getConfigurationOrCreate().isBroadcast(); - } - - /** - * Setting to choose Multicast over UDP - * @param broadcast - */ - public void setBroadcast(boolean broadcast) { - getConfigurationOrCreate().setBroadcast(broadcast); - } - - public long getSendBufferSize() { - return getConfigurationOrCreate().getSendBufferSize(); - } - - /** - * The TCP/UDP buffer sizes to be used during outbound communication. Size is bytes. - * @param sendBufferSize - */ - public void setSendBufferSize(long sendBufferSize) { - getConfigurationOrCreate().setSendBufferSize(sendBufferSize); - } - - public long getReceiveBufferSize() { - return getConfigurationOrCreate().getReceiveBufferSize(); - } - - /** - * The TCP/UDP buffer sizes to be used during inbound communication. Size is bytes. - * @param receiveBufferSize - */ - public void setReceiveBufferSize(long receiveBufferSize) { - getConfigurationOrCreate().setReceiveBufferSize(receiveBufferSize); - } - - public int getReceiveBufferSizePredictor() { - return getConfigurationOrCreate().getReceiveBufferSizePredictor(); - } - - /** - * Configures the buffer size predictor. See details at Jetty documentation and this mail thread. - * @param receiveBufferSizePredictor - */ - public void setReceiveBufferSizePredictor(int receiveBufferSizePredictor) { - getConfigurationOrCreate().setReceiveBufferSizePredictor(receiveBufferSizePredictor); - } - - public int getWorkerCount() { - return getConfigurationOrCreate().getWorkerCount(); - } - - /** - * When netty works on nio mode, it uses default workerCount parameter from Netty, which is cpu_core_threads*2. - * User can use this operation to override the default workerCount from Netty - * @param workerCount - */ - public void setWorkerCount(int workerCount) { - getConfigurationOrCreate().setWorkerCount(workerCount); - } - - public int getBossCount() { - return getConfigurationOrCreate().getBossCount(); - } - - /** - * When netty works on nio mode, it uses default bossCount parameter from Netty, which is 1. - * User can use this operation to override the default bossCount from Netty - * @param bossCount - */ - public void setBossCount(int bossCount) { - getConfigurationOrCreate().setBossCount(bossCount); - } - - public boolean isKeepAlive() { - return getConfigurationOrCreate().isKeepAlive(); - } - - /** - * Setting to ensure socket is not closed due to inactivity - * @param keepAlive - */ - public void setKeepAlive(boolean keepAlive) { - getConfigurationOrCreate().setKeepAlive(keepAlive); - } - - public boolean isTcpNoDelay() { - return getConfigurationOrCreate().isTcpNoDelay(); - } - - /** - * Setting to improve TCP protocol performance - * @param tcpNoDelay - */ - public void setTcpNoDelay(boolean tcpNoDelay) { - getConfigurationOrCreate().setTcpNoDelay(tcpNoDelay); - } - - public boolean isReuseAddress() { - return getConfigurationOrCreate().isReuseAddress(); - } - - /** - * Setting to facilitate socket multiplexing - * @param reuseAddress - */ - public void setReuseAddress(boolean reuseAddress) { - getConfigurationOrCreate().setReuseAddress(reuseAddress); - } - - public long getConnectTimeout() { - return getConfigurationOrCreate().getConnectTimeout(); - } - - /** - * Time to wait for a socket connection to be available. Value is in millis. - * @param connectTimeout - */ - public void setConnectTimeout(long connectTimeout) { - getConfigurationOrCreate().setConnectTimeout(connectTimeout); - } - - public int getBacklog() { - return getConfigurationOrCreate().getBacklog(); - } - - /** - * Allows to configure a backlog for netty consumer (server). - * Note the backlog is just a best effort depending on the OS. - * Setting this option to a value such as 200, 500 or 1000, tells the TCP stack how long the "accept" queue can be - * If this option is not configured, then the backlog depends on OS setting. - * @param backlog - */ - public void setBacklog(int backlog) { - getConfigurationOrCreate().setBacklog(backlog); - } - - public boolean isSsl() { - return getConfigurationOrCreate().isSsl(); - } - - /** - * Setting to specify whether SSL encryption is applied to this endpoint - * @param ssl - */ - public void setSsl(boolean ssl) { - getConfigurationOrCreate().setSsl(ssl); - } - - public boolean isSslClientCertHeaders() { - return getConfigurationOrCreate().isSslClientCertHeaders(); - } - - /** - * When enabled and in SSL mode, then the Netty consumer will enrich the Camel Message with headers having - * information about the client certificate such as subject name, issuer name, serial number, and the valid date range. - * @param sslClientCertHeaders - */ - public void setSslClientCertHeaders(boolean sslClientCertHeaders) { - getConfigurationOrCreate().setSslClientCertHeaders(sslClientCertHeaders); - } - - public SslHandler getSslHandler() { - return getConfigurationOrCreate().getSslHandler(); - } - - /** - * Reference to a class that could be used to return an SSL Handler - * @param sslHandler - */ - public void setSslHandler(SslHandler sslHandler) { - getConfigurationOrCreate().setSslHandler(sslHandler); - } - - public SSLContextParameters getSslContextParameters() { - return getConfigurationOrCreate().getSslContextParameters(); - } - - /** - * To configure security using SSLContextParameters - * @param sslContextParameters - */ - public void setSslContextParameters(SSLContextParameters sslContextParameters) { - getConfigurationOrCreate().setSslContextParameters(sslContextParameters); - } - - public boolean isNeedClientAuth() { - return getConfigurationOrCreate().isNeedClientAuth(); - } - - /** - * Configures whether the server needs client authentication when using SSL. - * @param needClientAuth - */ - public void setNeedClientAuth(boolean needClientAuth) { - getConfigurationOrCreate().setNeedClientAuth(needClientAuth); - } - - public String getKeyStoreResource() { - return getConfigurationOrCreate().getKeyStoreResource(); - } - - /** - * Client side certificate keystore to be used for encryption. Is loaded by default from classpath, - * but you can prefix with "classpath:", "file:", or "http:" to load the resource from different systems. - * @param keyStoreResource - */ - public void setKeyStoreResource(String keyStoreResource) { - getConfigurationOrCreate().setKeyStoreResource(keyStoreResource); - } - - public String getTrustStoreResource() { - return getConfigurationOrCreate().getTrustStoreResource(); - } - - /** - * Server side certificate keystore to be used for encryption. - * Is loaded by default from classpath, but you can prefix with "classpath:", "file:", or "http:" to load the resource from different systems. - * @param trustStoreResource - */ - public void setTrustStoreResource(String trustStoreResource) { - getConfigurationOrCreate().setTrustStoreResource(trustStoreResource); - } - - public String getKeyStoreFormat() { - return getConfigurationOrCreate().getKeyStoreFormat(); - } - - /** - * Keystore format to be used for payload encryption. Defaults to "JKS" if not set - * @param keyStoreFormat - */ - public void setKeyStoreFormat(String keyStoreFormat) { - getConfigurationOrCreate().setKeyStoreFormat(keyStoreFormat); - } - - public String getSecurityProvider() { - return getConfigurationOrCreate().getSecurityProvider(); - } - - /** - * Security provider to be used for payload encryption. Defaults to "SunX509" if not set. - * @param securityProvider - */ - public void setSecurityProvider(String securityProvider) { - getConfigurationOrCreate().setSecurityProvider(securityProvider); - } - - public String getCharsetName() { - return getConfigurationOrCreate().getCharsetName(); - } - - public String getPassphrase() { - return getConfigurationOrCreate().getPassphrase(); - } - - /** - * Password setting to use in order to encrypt/decrypt payloads sent using SSH - * @param passphrase - */ - public void setPassphrase(String passphrase) { - getConfigurationOrCreate().setPassphrase(passphrase); - } - - public ServerPipelineFactory getServerPipelineFactory() { - return getConfigurationOrCreate().getServerPipelineFactory(); - } - - public long getRequestTimeout() { - return getConfigurationOrCreate().getRequestTimeout(); - } - - /** - * To use a custom ServerPipelineFactory - * @param serverPipelineFactory - */ - public void setServerPipelineFactory(ServerPipelineFactory serverPipelineFactory) { - getConfigurationOrCreate().setServerPipelineFactory(serverPipelineFactory); - } - - public NettyServerBootstrapFactory getNettyServerBootstrapFactory() { - return getConfigurationOrCreate().getNettyServerBootstrapFactory(); - } - - /** - * Allows to use a timeout for the Netty producer when calling a remote server. - * By default no timeout is in use. The value is in milli seconds, so eg 30000 is 30 seconds. - * The requestTimeout is using Netty's ReadTimeoutHandler to trigger the timeout. - * @param requestTimeout - */ - public void setRequestTimeout(long requestTimeout) { - getConfigurationOrCreate().setRequestTimeout(requestTimeout); - } - - public boolean isSync() { - return getConfigurationOrCreate().isSync(); - } - - /** - * To use a custom NettyServerBootstrapFactory - * @param nettyServerBootstrapFactory - */ - public void setNettyServerBootstrapFactory(NettyServerBootstrapFactory nettyServerBootstrapFactory) { - getConfigurationOrCreate().setNettyServerBootstrapFactory(nettyServerBootstrapFactory); - } - - /** - * 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(); - } - - public Map<String, Object> getOptions() { - return getConfigurationOrCreate().getOptions(); - } - - /** - * 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); - } - - /** - * Allows to configure additional netty options using "option." as prefix. - * For example "option.child.keepAlive=false" to set the netty option "child.keepAlive=false". See the Netty documentation for possible options that can be used. - * @param options - */ - public void setOptions(Map<String, Object> options) { - getConfigurationOrCreate().setOptions(options); - } - - public int getDecoderMaxLineLength() { - return getConfigurationOrCreate().getDecoderMaxLineLength(); - } - - public BossPool getBossPool() { - return getConfigurationOrCreate().getBossPool(); - } - - /** - * The max line length to use for the textline codec. - * @param decoderMaxLineLength - */ - public void setDecoderMaxLineLength(int decoderMaxLineLength) { - getConfigurationOrCreate().setDecoderMaxLineLength(decoderMaxLineLength); - } - - public TextLineDelimiter getDelimiter() { - return getConfigurationOrCreate().getDelimiter(); - } - - /** - * To use a explicit org.jboss.netty.channel.socket.nio.BossPool as the boss thread pool. - * For example to share a thread pool with multiple consumers. By default each consumer has their own boss pool with 1 core thread. - * @param bossPool - */ - public void setBossPool(BossPool bossPool) { - getConfigurationOrCreate().setBossPool(bossPool); - } - - public WorkerPool getWorkerPool() { - return getConfigurationOrCreate().getWorkerPool(); - } - - /** - * The delimiter to use for the textline codec. Possible values are LINE and NULL. - * @param delimiter - */ - public void setDelimiter(TextLineDelimiter delimiter) { - getConfigurationOrCreate().setDelimiter(delimiter); - } - - public boolean isAutoAppendDelimiter() { - return getConfigurationOrCreate().isAutoAppendDelimiter(); - } - - /** - * Whether or not to auto append missing end delimiter when sending using the textline codec. - * @param autoAppendDelimiter - */ - public void setAutoAppendDelimiter(boolean autoAppendDelimiter) { - getConfigurationOrCreate().setAutoAppendDelimiter(autoAppendDelimiter); - } - - /** - * To use a explicit org.jboss.netty.channel.socket.nio.WorkerPool as the worker thread pool. - * For example to share a thread pool with multiple consumers. By default each consumer has their own worker pool with 2 x cpu count core threads. - * @param workerPool - */ - public void setWorkerPool(WorkerPool workerPool) { - getConfigurationOrCreate().setWorkerPool(workerPool); - } - - public ChannelGroup getChannelGroup() { - return getConfigurationOrCreate().getChannelGroup(); - } - - public String getEncoding() { - return getConfigurationOrCreate().getEncoding(); - } - - /** - * To use a explicit ChannelGroup. - * @param channelGroup - */ - public void setChannelGroup(ChannelGroup channelGroup) { - getConfigurationOrCreate().setChannelGroup(channelGroup); - } - - /** - * The encoding (a charset name) to use for the textline codec. If not provided, Camel will use the JVM default Charset. - * @param encoding - */ - public void setEncoding(String encoding) { - getConfigurationOrCreate().setEncoding(encoding); - } - - public String getNetworkInterface() { - return getConfigurationOrCreate().getNetworkInterface(); - } - - public List<ChannelHandler> getDecoders() { - return getConfigurationOrCreate().getDecoders(); - } - - /** - * When using UDP then this option can be used to specify a network interface by its name, such as eth0 to join a multicast group. - * @param networkInterface - */ - public void setNetworkInterface(String networkInterface) { - getConfigurationOrCreate().setNetworkInterface(networkInterface); - } - - public String getEnabledProtocols() { - return getConfigurationOrCreate().getEnabledProtocols(); - } - - /** - * A list of decoders to be used. - * You can use a String which have values separated by comma, and have the values be looked up in the Registry. - * Just remember to prefix the value with # so Camel knows it should lookup. - * @param decoders - */ - public void setDecoders(List<ChannelHandler> decoders) { - getConfigurationOrCreate().setDecoders(decoders); - } - - /** - * Which protocols to enable when using SSL - * @param enabledProtocols - */ - public void setEnabledProtocols(String enabledProtocols) { - getConfigurationOrCreate().setEnabledProtocols(enabledProtocols); - } - - public List<ChannelHandler> getEncoders() { - return getConfigurationOrCreate().getEncoders(); - } - - /** - * A list of encoders to be used. You can use a String which have values separated by comma, and have the values be looked up in the Registry. - * Just remember to prefix the value with # so Camel knows it should lookup. - * @param encoders - */ - public void setEncoders(List<ChannelHandler> encoders) { - getConfigurationOrCreate().setEncoders(encoders); - } - - public ChannelHandler getEncoder() { - return getConfigurationOrCreate().getEncoder(); - } - - /** - * A custom ChannelHandler class that can be used to perform special marshalling of outbound payloads. Must override org.jboss.netty.channel.ChannelDownStreamHandler. - * @param encoder - */ - public void setEncoder(ChannelHandler encoder) { - getConfigurationOrCreate().setEncoder(encoder); - } - - public ChannelHandler getDecoder() { - return getConfigurationOrCreate().getDecoder(); - } - - /** - * A custom ChannelHandler class that can be used to perform special marshalling of inbound payloads. Must override org.jboss.netty.channel.ChannelUpStreamHandler. - * @param decoder - */ - public void setDecoder(ChannelHandler decoder) { - getConfigurationOrCreate().setDecoder(decoder); - } - - public boolean isDisconnect() { - return getConfigurationOrCreate().isDisconnect(); - } - - /** - * Whether or not to disconnect(close) from Netty Channel right after use. Can be used for both consumer and producer. - * @param disconnect - */ - public void setDisconnect(boolean disconnect) { - getConfigurationOrCreate().setDisconnect(disconnect); - } - - public boolean isLazyChannelCreation() { - return getConfigurationOrCreate().isLazyChannelCreation(); - } - - /** - * Channels can be lazily created to avoid exceptions, if the remote server is not up and running when the Camel producer is started. - * @param lazyChannelCreation - */ - public void setLazyChannelCreation(boolean lazyChannelCreation) { - getConfigurationOrCreate().setLazyChannelCreation(lazyChannelCreation); - } - - 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); - } - - public boolean isDisconnectOnNoReply() { - return getConfigurationOrCreate().isDisconnectOnNoReply(); - } - - /** - * If sync is enabled then this option dictates NettyConsumer 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 NettyConsumer 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 LoggingLevel getServerExceptionCaughtLogLevel() { - return getConfigurationOrCreate().getServerExceptionCaughtLogLevel(); - } - - /** - * If the server (NettyConsumer) catches an exception then its logged using this logging level. - * @param serverExceptionCaughtLogLevel - */ - public void setServerExceptionCaughtLogLevel(LoggingLevel serverExceptionCaughtLogLevel) { - getConfigurationOrCreate().setServerExceptionCaughtLogLevel(serverExceptionCaughtLogLevel); - } - - public LoggingLevel getServerClosedChannelExceptionCaughtLogLevel() { - return getConfigurationOrCreate().getServerClosedChannelExceptionCaughtLogLevel(); - } - - /** - * If the server (NettyConsumer) catches an java.nio.channels.ClosedChannelException then its logged using this logging level. - * This is used to avoid logging the closed channel exceptions, as clients can disconnect abruptly and then cause a flood of closed exceptions in the Netty server. - * @param serverClosedChannelExceptionCaughtLogLevel - */ - public void setServerClosedChannelExceptionCaughtLogLevel(LoggingLevel serverClosedChannelExceptionCaughtLogLevel) { - getConfigurationOrCreate().setServerClosedChannelExceptionCaughtLogLevel(serverClosedChannelExceptionCaughtLogLevel); - } - - public boolean isAllowDefaultCodec() { - return getConfigurationOrCreate().isAllowDefaultCodec(); - } - - /** - * The netty component installs a default codec if both, encoder/deocder is null and textline is false. - * Setting allowDefaultCodec to false prevents the netty component from installing a default codec as the first element in the filter chain. - * @param allowDefaultCodec - */ - public void setAllowDefaultCodec(boolean allowDefaultCodec) { - getConfigurationOrCreate().setAllowDefaultCodec(allowDefaultCodec); - } - - /** - * To use a custom ClientPipelineFactory - * @param clientPipelineFactory - */ - public void setClientPipelineFactory(ClientPipelineFactory clientPipelineFactory) { - getConfigurationOrCreate().setClientPipelineFactory(clientPipelineFactory); - } - - public ClientPipelineFactory getClientPipelineFactory() { - return getConfigurationOrCreate().getClientPipelineFactory(); - } } \ No newline at end of file