http://git-wip-us.apache.org/repos/asf/camel/blob/a04fb15b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java index 33b814e..f515c94 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java @@ -18,24 +18,17 @@ package org.apache.camel.component.netty4; import java.net.URI; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.concurrent.ThreadFactory; -import io.netty.channel.ChannelHandler; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.group.ChannelGroup; -import io.netty.handler.ssl.SslHandler; import io.netty.util.concurrent.DefaultEventExecutorGroup; import io.netty.util.concurrent.EventExecutorGroup; 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; public class NettyComponent extends UriEndpointComponent { private NettyConfiguration configuration; @@ -109,7 +102,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; @@ -165,846 +158,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 int getSendBufferSize() { - return getConfigurationOrCreate().getSendBufferSize(); - } - - /** - * The TCP/UDP buffer sizes to be used during outbound communication. Size is bytes. - * @param sendBufferSize - */ - public void setSendBufferSize(int sendBufferSize) { - getConfigurationOrCreate().setSendBufferSize(sendBufferSize); - } - - public int getReceiveBufferSize() { - return getConfigurationOrCreate().getReceiveBufferSize(); - } - - /** - * The TCP/UDP buffer sizes to be used during inbound communication. Size is bytes. - * @param receiveBufferSize - */ - public void setReceiveBufferSize(int 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 int getConnectTimeout() { - return getConfigurationOrCreate().getConnectTimeout(); - } - - /** - * Time to wait for a socket connection to be available. Value is in millis. - * @param connectTimeout - */ - public void setConnectTimeout(int 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 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 ServerInitializerFactory getServerInitializerFactory() { - return getConfigurationOrCreate().getServerInitializerFactory(); - } - - public String getCharsetName() { - return getConfigurationOrCreate().getCharsetName(); - } - - /** - * To use a custom ServerInitializerFactory - * @param serverInitializerFactory - */ - public void setServerInitializerFactory(ServerInitializerFactory serverInitializerFactory) { - getConfigurationOrCreate().setServerInitializerFactory(serverInitializerFactory); - } - - public NettyServerBootstrapFactory getNettyServerBootstrapFactory() { - return getConfigurationOrCreate().getNettyServerBootstrapFactory(); - } - - public long getRequestTimeout() { - return getConfigurationOrCreate().getRequestTimeout(); - } - - /** - * To use a custom NettyServerBootstrapFactory - * @param nettyServerBootstrapFactory - */ - public void setNettyServerBootstrapFactory(NettyServerBootstrapFactory nettyServerBootstrapFactory) { - getConfigurationOrCreate().setNettyServerBootstrapFactory(nettyServerBootstrapFactory); - } - - public Map<String, Object> getOptions() { - return getConfigurationOrCreate().getOptions(); - } - - /** - * 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(); - } - - /** - * Setting to set endpoint as one-way or request-response - * @param sync - */ - public void setSync(boolean sync) { - getConfigurationOrCreate().setSync(sync); - } - - /** - * 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 boolean isTextline() { - return getConfigurationOrCreate().isTextline(); - } - - public boolean isNativeTransport() { - return getConfigurationOrCreate().isNativeTransport(); - } - - /** - * 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 int getDecoderMaxLineLength() { - return getConfigurationOrCreate().getDecoderMaxLineLength(); - } - - /** - * Whether to use native transport instead of NIO. Native transport takes advantage of the host operating system and is only supported on some platforms. - * You need to add the netty JAR for the host operating system you are using. See more details at: http://netty.io/wiki/native-transports.html - * @param nativeTransport - */ - public void setNativeTransport(boolean nativeTransport) { - getConfigurationOrCreate().setNativeTransport(nativeTransport); - } - - /** - * The max line length to use for the textline codec. - * @param decoderMaxLineLength - */ - public void setDecoderMaxLineLength(int decoderMaxLineLength) { - getConfigurationOrCreate().setDecoderMaxLineLength(decoderMaxLineLength); - } - - public EventLoopGroup getBossGroup() { - return getConfigurationOrCreate().getBossGroup(); - } - - public TextLineDelimiter getDelimiter() { - return getConfigurationOrCreate().getDelimiter(); - } - - /** - * Set the BossGroup which could be used for handling the new connection of the server side across the NettyEndpoint - * @param bossGroup - */ - public void setBossGroup(EventLoopGroup bossGroup) { - getConfigurationOrCreate().setBossGroup(bossGroup); - } - - /** - * 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 EventLoopGroup getWorkerGroup() { - return getConfigurationOrCreate().getWorkerGroup(); - } - - 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 EventLoopGroup 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 workerGroup - */ - public void setWorkerGroup(EventLoopGroup workerGroup) { - getConfigurationOrCreate().setWorkerGroup(workerGroup); - } - - public String getEncoding() { - return getConfigurationOrCreate().getEncoding(); - } - - public ChannelGroup getChannelGroup() { - return getConfigurationOrCreate().getChannelGroup(); - } - - /** - * 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); - } - - /** - * 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); - } - - public String getEnabledProtocols() { - return getConfigurationOrCreate().getEnabledProtocols(); - } - - public List<ChannelHandler> getEncoders() { - return getConfigurationOrCreate().getEncoders(); - } - - /** - * Which protocols to enable when using SSL - * @param enabledProtocols - */ - public void setEnabledProtocols(String enabledProtocols) { - getConfigurationOrCreate().setEnabledProtocols(enabledProtocols); - } - - /** - * Used only in clientMode in consumer, the consumer will attempt to reconnect on disconnection if this is enabled - */ - public boolean isReconnect() { - return getConfigurationOrCreate().isReconnect(); - } - - /** - * 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 void setReconnect(boolean reconnect) { - getConfigurationOrCreate().setReconnect(reconnect); - } - - public ChannelHandler getEncoder() { - return getConfigurationOrCreate().getEncoder(); - } - - /** - * Used if reconnect and clientMode is enabled. The interval in milli seconds to attempt reconnection - */ - public int getReconnectInterval() { - return getConfigurationOrCreate().getReconnectInterval(); - } - - /** - * A custom ChannelHandler class that can be used to perform special marshalling of outbound payloads. - * @param encoder - */ - public void setEncoder(ChannelHandler encoder) { - getConfigurationOrCreate().setEncoder(encoder); - } - - public void setReconnectInterval(int reconnectInterval) { - getConfigurationOrCreate().setReconnectInterval(reconnectInterval); - } - - public ChannelHandler getDecoder() { - return getConfigurationOrCreate().getDecoder(); - } - - /** - * A custom ChannelHandler class that can be used to perform special marshalling of inbound payloads. - * @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); - } - - public ClientInitializerFactory getClientInitializerFactory() { - return getConfigurationOrCreate().getClientInitializerFactory(); - } - - /** - * To use a custom ClientInitializerFactory - * @param clientInitializerFactory - */ - public void setClientInitializerFactory(ClientInitializerFactory clientInitializerFactory) { - getConfigurationOrCreate().setClientInitializerFactory(clientInitializerFactory); - } - - public boolean isUsingExecutorService() { - return getConfigurationOrCreate().isUsingExecutorService(); - } - - /** - * Whether to use ordered thread pool, to ensure events are processed orderly on the same channel. - * @param usingExecutorService - */ - public void setUsingExecutorService(boolean usingExecutorService) { - getConfigurationOrCreate().setUsingExecutorService(usingExecutorService); - } - - 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 isUseByteBuf() { - return getConfigurationOrCreate().isUseByteBuf(); - } - - /** - * If the useByteBuf is true, netty producer will turn the message body into {@link ByteBuf} before sending it out. - * @param useByteBuf - */ - public void setUseByteBuf(boolean useByteBuf) { - getConfigurationOrCreate().setUseByteBuf(useByteBuf); - } - - public boolean isUdpByteArrayCodec() { - return getConfigurationOrCreate().isUdpByteArrayCodec(); - } - - /** - * For UDP only. If enabled the using byte array codec instead of Java serialization protocol. - * @param udpByteArrayCodec - */ - public void setUdpByteArrayCodec(boolean udpByteArrayCodec) { - getConfigurationOrCreate().setUdpByteArrayCodec(udpByteArrayCodec); - } - - public boolean isReuseChannel() { - return getConfigurationOrCreate().isReuseChannel(); - } - - /** - * This option allows producers to reuse the same Netty {@link Channel} for the lifecycle of processing the {@link Exchange}. - * This is useable if you need to call a server multiple times in a Camel route and want to use the same network connection. - * When using this the channel is not returned to the connection pool until the {@link Exchange} is done; or disconnected - * if the disconnect option is set to true. - * <p/> - * The reused {@link Channel} is stored on the {@link Exchange} as an exchange property with the key {@link NettyConstants#NETTY_CHANNEL} - * which allows you to obtain the channel during routing and use it as well. - * @param reuseChannel - */ - public void setReuseChannel(boolean reuseChannel) { - getConfigurationOrCreate().setReuseChannel(reuseChannel); - } }
http://git-wip-us.apache.org/repos/asf/camel/blob/a04fb15b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java ---------------------------------------------------------------------- diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java index ce950fd..35394df 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java +++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java @@ -93,7 +93,7 @@ public class Olingo2Component extends AbstractApiComponent<Olingo2ApiName, Oling } /** - * To use the shared configuration. Properties of the shared configuration can also be set individually. + * To use the shared configuration */ @Override public void setConfiguration(Olingo2Configuration configuration) { @@ -182,132 +182,4 @@ public class Olingo2Component extends AbstractApiComponent<Olingo2ApiName, Oling apiProxy.close(); } } - - private Olingo2Configuration getConfigurationOrCreate() { - if (this.getConfiguration() == null) { - this.setConfiguration(new Olingo2Configuration()); - } - return this.getConfiguration(); - } - - public Olingo2ApiName getApiName() { - return getConfigurationOrCreate().getApiName(); - } - - /** - * What kind of operation to perform - * @param apiName - */ - public void setApiName(Olingo2ApiName apiName) { - getConfigurationOrCreate().setApiName(apiName); - } - - public String getMethodName() { - return getConfigurationOrCreate().getMethodName(); - } - - /** - * What sub operation to use for the selected operation - * @param methodName - */ - public void setMethodName(String methodName) { - getConfigurationOrCreate().setMethodName(methodName); - } - - public String getServiceUri() { - return getConfigurationOrCreate().getServiceUri(); - } - - /** - * Target OData service base URI, e.g. http://services.odata.org/OData/OData.svc - * @param serviceUri - */ - public void setServiceUri(String serviceUri) { - getConfigurationOrCreate().setServiceUri(serviceUri); - } - - public String getContentType() { - return getConfigurationOrCreate().getContentType(); - } - - /** - * Content-Type header value can be used to specify JSON or XML message format, defaults to application/json;charset=utf-8 - * @param contentType - */ - public void setContentType(String contentType) { - getConfigurationOrCreate().setContentType(contentType); - } - - public Map<String, String> getHttpHeaders() { - return getConfigurationOrCreate().getHttpHeaders(); - } - - /** - * Custom HTTP headers to inject into every request, this could include OAuth tokens, etc. - * @param httpHeaders - */ - public void setHttpHeaders(Map<String, String> httpHeaders) { - getConfigurationOrCreate().setHttpHeaders(httpHeaders); - } - - public int getConnectTimeout() { - return getConfigurationOrCreate().getConnectTimeout(); - } - - /** - * HTTP connection creation timeout in milliseconds, defaults to 30,000 (30 seconds) - * @param connectTimeout - */ - public void setConnectTimeout(int connectTimeout) { - getConfigurationOrCreate().setConnectTimeout(connectTimeout); - } - - public int getSocketTimeout() { - return getConfigurationOrCreate().getSocketTimeout(); - } - - /** - * HTTP request timeout in milliseconds, defaults to 30,000 (30 seconds) - * @param socketTimeout - */ - public void setSocketTimeout(int socketTimeout) { - getConfigurationOrCreate().setSocketTimeout(socketTimeout); - } - - public HttpHost getProxy() { - return getConfigurationOrCreate().getProxy(); - } - - /** - * HTTP proxy server configuration - * @param proxy - */ - public void setProxy(HttpHost proxy) { - getConfigurationOrCreate().setProxy(proxy); - } - - public SSLContextParameters getSslContextParameters() { - return getConfigurationOrCreate().getSslContextParameters(); - } - - /** - * To configure security using SSLContextParameters - * @param sslContextParameters - */ - public void setSslContextParameters(SSLContextParameters sslContextParameters) { - getConfigurationOrCreate().setSslContextParameters(sslContextParameters); - } - - public HttpAsyncClientBuilder getHttpAsyncClientBuilder() { - return getConfigurationOrCreate().getHttpAsyncClientBuilder(); - } - - /** - * Custom HTTP async client builder for more complex HTTP client configuration, overrides connectionTimeout, socketTimeout, proxy and sslContext. - * Note that a socketTimeout MUST be specified in the builder, otherwise OData requests could block indefinitely - * @param httpAsyncClientBuilder - */ - public void setHttpAsyncClientBuilder(HttpAsyncClientBuilder httpAsyncClientBuilder) { - getConfigurationOrCreate().setHttpAsyncClientBuilder(httpAsyncClientBuilder); - } } http://git-wip-us.apache.org/repos/asf/camel/blob/a04fb15b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java index 7b7b81a..61357ea 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java @@ -28,21 +28,14 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.fasterxml.jackson.databind.ObjectMapper; - import org.apache.camel.CamelContext; import org.apache.camel.ComponentConfiguration; import org.apache.camel.Endpoint; import org.apache.camel.component.salesforce.api.SalesforceException; import org.apache.camel.component.salesforce.api.dto.AbstractQueryRecordsBase; import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; -import org.apache.camel.component.salesforce.api.dto.analytics.reports.ReportMetadata; -import org.apache.camel.component.salesforce.api.dto.bulk.ContentType; import org.apache.camel.component.salesforce.internal.OperationName; -import org.apache.camel.component.salesforce.internal.PayloadFormat; import org.apache.camel.component.salesforce.internal.SalesforceSession; -import org.apache.camel.component.salesforce.internal.dto.NotifyForFieldsEnum; -import org.apache.camel.component.salesforce.internal.dto.NotifyForOperationsEnum; import org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelper; import org.apache.camel.impl.UriEndpointComponent; import org.apache.camel.spi.EndpointCompleter; @@ -390,7 +383,7 @@ public class SalesforceComponent extends UriEndpointComponent implements Endpoin } /** - * To use the shared SalesforceLoginConfig as login configuration. Properties of the shared configuration can also be set individually. + * To use the shared SalesforceLoginConfig as login configuration */ public void setLoginConfig(SalesforceLoginConfig loginConfig) { this.loginConfig = loginConfig; @@ -401,7 +394,7 @@ public class SalesforceComponent extends UriEndpointComponent implements Endpoin } /** - * To use the shared SalesforceEndpointConfig as configuration. Properties of the shared configuration can also be set individually. + * To use the shared SalesforceLoginConfig as configuration */ public void setConfig(SalesforceEndpointConfig config) { this.config = config; @@ -578,510 +571,4 @@ public class SalesforceComponent extends UriEndpointComponent implements Endpoin public Map<String, Class<?>> getClassMap() { return classMap; } - - private SalesforceLoginConfig getLoginConfigOrCreate() { - if (this.getLoginConfig() == null) { - this.setLoginConfig(new SalesforceLoginConfig()); - } - return this.getLoginConfig(); - } - - private SalesforceEndpointConfig getConfigOrCreate() { - if (this.getConfig() == null) { - this.setConfig(new SalesforceEndpointConfig()); - } - return this.getConfig(); - } - - public String getLoginUrl() { - return getLoginConfigOrCreate().getLoginUrl(); - } - - /** - * Salesforce login URL, defaults to https://login.salesforce.com - * @param loginUrl - */ - public void setLoginUrl(String loginUrl) { - getLoginConfigOrCreate().setLoginUrl(loginUrl); - } - - public String getClientId() { - return getLoginConfigOrCreate().getClientId(); - } - - /** - * Salesforce connected application Consumer Key - * @param clientId - */ - public void setClientId(String clientId) { - getLoginConfigOrCreate().setClientId(clientId); - } - - public String getClientSecret() { - return getLoginConfigOrCreate().getClientSecret(); - } - - /** - * Salesforce connected application Consumer Secret - * @param clientSecret - */ - public void setClientSecret(String clientSecret) { - getLoginConfigOrCreate().setClientSecret(clientSecret); - } - - public String getUserName() { - return getLoginConfigOrCreate().getUserName(); - } - - /** - * Salesforce account user name - * @param userName - */ - public void setUserName(String userName) { - getLoginConfigOrCreate().setUserName(userName); - } - - public String getPassword() { - return getLoginConfigOrCreate().getPassword(); - } - - /** - * Salesforce account password - * @param password - */ - public void setPassword(String password) { - getLoginConfigOrCreate().setPassword(password); - } - - public boolean isLazyLogin() { - return getLoginConfigOrCreate().isLazyLogin(); - } - - /** - * Flag to enable/disable lazy OAuth, default is false. When enabled, OAuth token retrieval or generation is not done until the first API call - * @param lazyLogin - */ - public void setLazyLogin(boolean lazyLogin) { - getLoginConfigOrCreate().setLazyLogin(lazyLogin); - } - - public PayloadFormat getFormat() { - return getConfigOrCreate().getFormat(); - } - - /** - * Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON - * @param format - */ - public void setFormat(PayloadFormat format) { - getConfigOrCreate().setFormat(format); - } - - public String getApiVersion() { - return getConfigOrCreate().getApiVersion(); - } - - /** - * Salesforce API version, defaults to SalesforceEndpointConfig.DEFAULT_VERSION - * @param apiVersion - */ - public void setApiVersion(String apiVersion) { - getConfigOrCreate().setApiVersion(apiVersion); - } - - public String getSObjectName() { - return getConfigOrCreate().getSObjectName(); - } - - /** - * SObject name if required or supported by API - * @param sObjectName - */ - public void setSObjectName(String sObjectName) { - getConfigOrCreate().setSObjectName(sObjectName); - } - - public String getSObjectId() { - return getConfigOrCreate().getSObjectId(); - } - - /** - * SObject ID if required by API - * @param sObjectId - */ - public void setSObjectId(String sObjectId) { - getConfigOrCreate().setSObjectId(sObjectId); - } - - public String getSObjectFields() { - return getConfigOrCreate().getSObjectFields(); - } - - /** - * SObject fields to retrieve - * @param sObjectFields - */ - public void setSObjectFields(String sObjectFields) { - getConfigOrCreate().setSObjectFields(sObjectFields); - } - - public String getSObjectIdName() { - return getConfigOrCreate().getSObjectIdName(); - } - - /** - * SObject external ID field name - * @param sObjectIdName - */ - public void setSObjectIdName(String sObjectIdName) { - getConfigOrCreate().setSObjectIdName(sObjectIdName); - } - - public String getSObjectIdValue() { - return getConfigOrCreate().getSObjectIdValue(); - } - - /** - * SObject external ID field value - * @param sObjectIdValue - */ - public void setSObjectIdValue(String sObjectIdValue) { - getConfigOrCreate().setSObjectIdValue(sObjectIdValue); - } - - public String getSObjectBlobFieldName() { - return getConfigOrCreate().getSObjectBlobFieldName(); - } - - /** - * SObject blob field name - * @param sObjectBlobFieldName - */ - public void setSObjectBlobFieldName(String sObjectBlobFieldName) { - getConfigOrCreate().setSObjectBlobFieldName(sObjectBlobFieldName); - } - - public String getSObjectClass() { - return getConfigOrCreate().getSObjectClass(); - } - - /** - * Fully qualified SObject class name, usually generated using camel-salesforce-maven-plugin - * @param sObjectClass - */ - public void setSObjectClass(String sObjectClass) { - getConfigOrCreate().setSObjectClass(sObjectClass); - } - - public String getSObjectQuery() { - return getConfigOrCreate().getSObjectQuery(); - } - - /** - * Salesforce SOQL query string - * @param sObjectQuery - */ - public void setSObjectQuery(String sObjectQuery) { - getConfigOrCreate().setSObjectQuery(sObjectQuery); - } - - public String getSObjectSearch() { - return getConfigOrCreate().getSObjectSearch(); - } - - /** - * Salesforce SOSL search string - * @param sObjectSearch - */ - public void setSObjectSearch(String sObjectSearch) { - getConfigOrCreate().setSObjectSearch(sObjectSearch); - } - - public String getApexMethod() { - return getConfigOrCreate().getApexMethod(); - } - - /** - * APEX method name - * @param apexMethod - */ - public void setApexMethod(String apexMethod) { - getConfigOrCreate().setApexMethod(apexMethod); - } - - public String getApexUrl() { - return getConfigOrCreate().getApexUrl(); - } - - /** - * APEX method URL - * @param apexUrl - */ - public void setApexUrl(String apexUrl) { - getConfigOrCreate().setApexUrl(apexUrl); - } - - public Map<String, Object> getApexQueryParams() { - return getConfigOrCreate().getApexQueryParams(); - } - - /** - * Query params for APEX method - * @param apexQueryParams - */ - public void setApexQueryParams(Map<String, Object> apexQueryParams) { - getConfigOrCreate().setApexQueryParams(apexQueryParams); - } - - public ContentType getContentType() { - return getConfigOrCreate().getContentType(); - } - - /** - * Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV - * @param contentType - */ - public void setContentType(ContentType contentType) { - getConfigOrCreate().setContentType(contentType); - } - - public String getJobId() { - return getConfigOrCreate().getJobId(); - } - - /** - * Bulk API Job ID - * @param jobId - */ - public void setJobId(String jobId) { - getConfigOrCreate().setJobId(jobId); - } - - public String getBatchId() { - return getConfigOrCreate().getBatchId(); - } - - /** - * Bulk API Batch ID - * @param batchId - */ - public void setBatchId(String batchId) { - getConfigOrCreate().setBatchId(batchId); - } - - public String getResultId() { - return getConfigOrCreate().getResultId(); - } - - /** - * Bulk API Result ID - * @param resultId - */ - public void setResultId(String resultId) { - getConfigOrCreate().setResultId(resultId); - } - - public boolean isUpdateTopic() { - return getConfigOrCreate().isUpdateTopic(); - } - - /** - * Whether to update an existing Push Topic when using the Streaming API, defaults to false - * @param updateTopic - */ - public void setUpdateTopic(boolean updateTopic) { - getConfigOrCreate().setUpdateTopic(updateTopic); - } - - public NotifyForFieldsEnum getNotifyForFields() { - return getConfigOrCreate().getNotifyForFields(); - } - - /** - * Notify for fields, options are ALL, REFERENCED, SELECT, WHERE - * @param notifyForFields - */ - public void setNotifyForFields(NotifyForFieldsEnum notifyForFields) { - getConfigOrCreate().setNotifyForFields(notifyForFields); - } - - public NotifyForOperationsEnum getNotifyForOperations() { - return getConfigOrCreate().getNotifyForOperations(); - } - - /** - * Notify for operations, options are ALL, CREATE, EXTENDED, UPDATE (API version < 29.0) - * @param notifyForOperations - */ - public void setNotifyForOperations(NotifyForOperationsEnum notifyForOperations) { - getConfigOrCreate().setNotifyForOperations(notifyForOperations); - } - - public Boolean getNotifyForOperationCreate() { - return getConfigOrCreate().getNotifyForOperationCreate(); - } - - /** - * Notify for create operation, defaults to false (API version >= 29.0) - * @param notifyForOperationCreate - */ - public void setNotifyForOperationCreate(Boolean notifyForOperationCreate) { - getConfigOrCreate().setNotifyForOperationCreate(notifyForOperationCreate); - } - - public Boolean getNotifyForOperationUpdate() { - return getConfigOrCreate().getNotifyForOperationUpdate(); - } - - /** - * Notify for update operation, defaults to false (API version >= 29.0) - * @param notifyForOperationUpdate - */ - public void setNotifyForOperationUpdate(Boolean notifyForOperationUpdate) { - getConfigOrCreate().setNotifyForOperationUpdate(notifyForOperationUpdate); - } - - public Boolean getNotifyForOperationDelete() { - return getConfigOrCreate().getNotifyForOperationDelete(); - } - - /** - * Notify for delete operation, defaults to false (API version >= 29.0) - * @param notifyForOperationDelete - */ - public void setNotifyForOperationDelete(Boolean notifyForOperationDelete) { - getConfigOrCreate().setNotifyForOperationDelete(notifyForOperationDelete); - } - - public Boolean getNotifyForOperationUndelete() { - return getConfigOrCreate().getNotifyForOperationUndelete(); - } - - /** - * Notify for un-delete operation, defaults to false (API version >= 29.0) - * @param notifyForOperationUndelete - */ - public void setNotifyForOperationUndelete(Boolean notifyForOperationUndelete) { - getConfigOrCreate().setNotifyForOperationUndelete(notifyForOperationUndelete); - } - - public String getReportId() { - return getConfigOrCreate().getReportId(); - } - - /** - * Salesforce1 Analytics report Id - * @param reportId - */ - public void setReportId(String reportId) { - getConfigOrCreate().setReportId(reportId); - } - - public Boolean getIncludeDetails() { - return getConfigOrCreate().getIncludeDetails(); - } - - /** - * Include details in Salesforce1 Analytics report, defaults to false. - * @param includeDetails - */ - public void setIncludeDetails(Boolean includeDetails) { - getConfigOrCreate().setIncludeDetails(includeDetails); - } - - public ReportMetadata getReportMetadata() { - return getConfigOrCreate().getReportMetadata(); - } - - /** - * Salesforce1 Analytics report metadata for filtering - * @param reportMetadata - */ - public void setReportMetadata(ReportMetadata reportMetadata) { - getConfigOrCreate().setReportMetadata(reportMetadata); - } - - public String getInstanceId() { - return getConfigOrCreate().getInstanceId(); - } - - /** - * Salesforce1 Analytics report execution instance ID - * @param instanceId - */ - public void setInstanceId(String instanceId) { - getConfigOrCreate().setInstanceId(instanceId); - } - - /** - * Custom Jetty Http Client to use to connect to Salesforce. - * @param httpClient - */ - public void setHttpClient(SalesforceHttpClient httpClient) { - getConfigOrCreate().setHttpClient(httpClient); - } - - public SalesforceHttpClient getHttpClient() { - return getConfigOrCreate().getHttpClient(); - } - - public ObjectMapper getObjectMapper() { - return getConfigOrCreate().getObjectMapper(); - } - - /** - * Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects. - * @param objectMapper - */ - public void setObjectMapper(ObjectMapper objectMapper) { - getConfigOrCreate().setObjectMapper(objectMapper); - } - - public Integer getDefaultReplayId() { - return getConfigOrCreate().getDefaultReplayId(); - } - - /** - * Default replayId setting if no value is found in {@link #initialReplayIdMap} - * @param defaultReplayId - */ - public void setDefaultReplayId(Integer defaultReplayId) { - getConfigOrCreate().setDefaultReplayId(defaultReplayId); - } - - public Map<String, Integer> getInitialReplayIdMap() { - return getConfigOrCreate().getInitialReplayIdMap(); - } - - /** - * Replay IDs to start from per channel name. - * @param initialReplayIdMap - */ - public void setInitialReplayIdMap(Map<String, Integer> initialReplayIdMap) { - getConfigOrCreate().setInitialReplayIdMap(initialReplayIdMap); - } - - public long getBackoffIncrement() { - return getConfigOrCreate().getBackoffIncrement(); - } - - /** - * Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect. - * @param backoffIncrement - */ - public void setBackoffIncrement(long backoffIncrement) { - getConfigOrCreate().setBackoffIncrement(backoffIncrement); - } - - public long getMaxBackoff() { - return getConfigOrCreate().getMaxBackoff(); - } - - /** - * Maximum backoff interval for Streaming connection restart attempts for failures beyond CometD auto-reconnect. - * @param maxBackoff - */ - public void setMaxBackoff(long maxBackoff) { - getConfigOrCreate().setMaxBackoff(maxBackoff); - } } http://git-wip-us.apache.org/repos/asf/camel/blob/a04fb15b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java index 996da53..6a8eb43 100644 --- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java +++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java @@ -22,7 +22,6 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.impl.UriEndpointComponent; -import org.jsmpp.session.SessionStateListener; /** * @version @@ -90,563 +89,9 @@ public class SmppComponent extends UriEndpointComponent { } /** - * To use the shared SmppConfiguration as configuration. Properties of the shared configuration can also be set individually. + * To use the shared SmppConfiguration as configuration. */ public void setConfiguration(SmppConfiguration configuration) { this.configuration = configuration; } - - - private SmppConfiguration getConfigurationOrCreate() { - if (this.getConfiguration() == null) { - this.setConfiguration(new SmppConfiguration()); - } - return this.getConfiguration(); - } - - public String getHost() { - return getConfigurationOrCreate().getHost(); - } - - /** - * Hostname for the SMSC server to use. - * @param host - */ - public void setHost(String host) { - getConfigurationOrCreate().setHost(host); - } - - public Integer getPort() { - return getConfigurationOrCreate().getPort(); - } - - /** - * Port number for the SMSC server to use. - * @param port - */ - public void setPort(Integer port) { - getConfigurationOrCreate().setPort(port); - } - - public String getSystemId() { - return getConfigurationOrCreate().getSystemId(); - } - - /** - * The system id (username) for connecting to SMSC server. - * @param systemId - */ - public void setSystemId(String systemId) { - getConfigurationOrCreate().setSystemId(systemId); - } - - /** - * The password for connecting to SMSC server. - */ - public String getPassword() { - return getConfigurationOrCreate().getPassword(); - } - - public byte getDataCoding() { - return getConfigurationOrCreate().getDataCoding(); - } - - /** - * Defines the data coding according the SMPP 3.4 specification, section 5.2.19. - * Example data encodings are: - * <ul> - * <li>0: SMSC Default Alphabet</li> - * <li>3: Latin 1 (ISO-8859-1)</li> - * <li>4: Octet unspecified (8-bit binary)</li> - * <li>8: UCS2 (ISO/IEC-10646)</li> - * <li>13: Extended Kanji JIS(X 0212-1990)</li> - * </ul> - * @param dataCoding - */ - public void setDataCoding(byte dataCoding) { - getConfigurationOrCreate().setDataCoding(dataCoding); - } - - public byte getAlphabet() { - return getConfigurationOrCreate().getAlphabet(); - } - - /** - * Defines encoding of data according the SMPP 3.4 specification, section 5.2.19. - * <ul> - * <li>0: SMSC Default Alphabet - * <li>4: 8 bit Alphabet</li> - * <li>8: UCS2 Alphabet</li></li> - * </ul> - * @param alphabet - */ - public void setAlphabet(byte alphabet) { - getConfigurationOrCreate().setAlphabet(alphabet); - } - - public String getEncoding() { - return getConfigurationOrCreate().getEncoding(); - } - - /** - * Defines the encoding scheme of the short message user data. - * Only for SubmitSm, ReplaceSm and SubmitMulti. - * @param encoding - */ - public void setEncoding(String encoding) { - getConfigurationOrCreate().setEncoding(encoding); - } - - public void setPassword(String password) { - getConfigurationOrCreate().setPassword(password); - } - - public Integer getEnquireLinkTimer() { - return getConfigurationOrCreate().getEnquireLinkTimer(); - } - - /** - * Defines the interval in milliseconds between the confidence checks. - * The confidence check is used to test the communication path between an ESME and an SMSC. - * @param enquireLinkTimer - */ - public void setEnquireLinkTimer(Integer enquireLinkTimer) { - getConfigurationOrCreate().setEnquireLinkTimer(enquireLinkTimer); - } - - public Integer getTransactionTimer() { - return getConfigurationOrCreate().getTransactionTimer(); - } - - /** - * Defines the maximum period of inactivity allowed after a transaction, after which - * an SMPP entity may assume that the session is no longer active. - * This timer may be active on either communicating SMPP entity (i.e. SMSC or ESME). - * @param transactionTimer - */ - public void setTransactionTimer(Integer transactionTimer) { - getConfigurationOrCreate().setTransactionTimer(transactionTimer); - } - - public String getSystemType() { - return getConfigurationOrCreate().getSystemType(); - } - - /** - * This parameter is used to categorize the type of ESME (External Short Message Entity) that is binding to the SMSC (max. 13 characters). - * @param systemType - */ - public void setSystemType(String systemType) { - getConfigurationOrCreate().setSystemType(systemType); - } - - public byte getRegisteredDelivery() { - return getConfigurationOrCreate().getRegisteredDelivery(); - } - - /** - * Is used to request an SMSC delivery receipt and/or SME originated acknowledgements. The following values are defined: - * <ul> - * <li>0: No SMSC delivery receipt requested.</li> - * <li>1: SMSC delivery receipt requested where final delivery outcome is success or failure.</li> - * <li>2: SMSC delivery receipt requested where the final delivery outcome is delivery failure.</li> - * </ul> - * @param registeredDelivery - */ - public void setRegisteredDelivery(byte registeredDelivery) { - getConfigurationOrCreate().setRegisteredDelivery(registeredDelivery); - } - - public String getServiceType() { - return getConfigurationOrCreate().getServiceType(); - } - - /** - * The service type parameter can be used to indicate the SMS Application service associated with the message. - * The following generic service_types are defined: - * <ul> - * <li>CMT: Cellular Messaging</li> - * <li>CPT: Cellular Paging</li> - * <li>VMN: Voice Mail Notification</li> - * <li>VMA: Voice Mail Alerting</li> - * <li>WAP: Wireless Application Protocol</li> - * <li>USSD: Unstructured Supplementary Services Data</li> - * </ul> - * @param serviceType - */ - public void setServiceType(String serviceType) { - getConfigurationOrCreate().setServiceType(serviceType); - } - - public byte getSourceAddrTon() { - return getConfigurationOrCreate().getSourceAddrTon(); - } - - /** - * Defines the type of number (TON) to be used in the SME originator address parameters. - * The following TON values are defined: - * <ul> - * <li>0: Unknown</li> - * <li>1: International</li> - * <li>2: National</li> - * <li>3: Network Specific</li> - * <li>4: Subscriber Number</li> - * <li>5: Alphanumeric</li> - * <li>6: Abbreviated</li> - * </ul> - * @param sourceAddrTon - */ - public void setSourceAddrTon(byte sourceAddrTon) { - getConfigurationOrCreate().setSourceAddrTon(sourceAddrTon); - } - - public byte getDestAddrTon() { - return getConfigurationOrCreate().getDestAddrTon(); - } - - /** - * Defines the type of number (TON) to be used in the SME destination address parameters. - * Only for SubmitSm, SubmitMulti, CancelSm and DataSm. - * The following TON values are defined: - * <ul> - * <li>0: Unknown</li> - * <li>1: International</li> - * <li>2: National</li> - * <li>3: Network Specific</li> - * <li>4: Subscriber Number</li> - * <li>5: Alphanumeric</li> - * <li>6: Abbreviated</li> - * </ul> - * @param destAddrTon - */ - public void setDestAddrTon(byte destAddrTon) { - getConfigurationOrCreate().setDestAddrTon(destAddrTon); - } - - public byte getSourceAddrNpi() { - return getConfigurationOrCreate().getSourceAddrNpi(); - } - - /** - * Defines the numeric plan indicator (NPI) to be used in the SME originator address parameters. - * The following NPI values are defined: - * <ul> - * <li>0: Unknown</li> - * <li>1: ISDN (E163/E164)</li> - * <li>2: Data (X.121)</li> - * <li>3: Telex (F.69)</li> - * <li>6: Land Mobile (E.212)</li> - * <li>8: National</li> - * <li>9: Private</li> - * <li>10: ERMES</li> - * <li>13: Internet (IP)</li> - * <li>18: WAP Client Id (to be defined by WAP Forum)</li> - * </ul> - * @param sourceAddrNpi - */ - public void setSourceAddrNpi(byte sourceAddrNpi) { - getConfigurationOrCreate().setSourceAddrNpi(sourceAddrNpi); - } - - public byte getDestAddrNpi() { - return getConfigurationOrCreate().getDestAddrNpi(); - } - - /** - * Defines the type of number (TON) to be used in the SME destination address parameters. - * Only for SubmitSm, SubmitMulti, CancelSm and DataSm. - * The following NPI values are defined: - * <ul> - * <li>0: Unknown</li> - * <li>1: ISDN (E163/E164)</li> - * <li>2: Data (X.121)</li> - * <li>3: Telex (F.69)</li> - * <li>6: Land Mobile (E.212)</li> - * <li>8: National</li> - * <li>9: Private</li> - * <li>10: ERMES</li> - * <li>13: Internet (IP)</li> - * <li>18: WAP Client Id (to be defined by WAP Forum)</li> - * </ul> - * @param destAddrNpi - */ - public void setDestAddrNpi(byte destAddrNpi) { - getConfigurationOrCreate().setDestAddrNpi(destAddrNpi); - } - - public byte getProtocolId() { - return getConfigurationOrCreate().getProtocolId(); - } - - /** - * The protocol id - * @param protocolId - */ - public void setProtocolId(byte protocolId) { - getConfigurationOrCreate().setProtocolId(protocolId); - } - - public byte getPriorityFlag() { - return getConfigurationOrCreate().getPriorityFlag(); - } - - /** - * Allows the originating SME to assign a priority level to the short message. - * Only for SubmitSm and SubmitMulti. - * Four Priority Levels are supported: - * <ul> - * <li>0: Level 0 (lowest) priority</li> - * <li>1: Level 1 priority</li> - * <li>2: Level 2 priority</li> - * <li>3: Level 3 (highest) priority</li> - * </ul> - * @param priorityFlag - */ - public void setPriorityFlag(byte priorityFlag) { - getConfigurationOrCreate().setPriorityFlag(priorityFlag); - } - - public byte getReplaceIfPresentFlag() { - return getConfigurationOrCreate().getReplaceIfPresentFlag(); - } - - /** - * Used to request the SMSC to replace a previously submitted message, that is still pending delivery. - * The SMSC will replace an existing message provided that the source address, destination address and service - * type match the same fields in the new message. - * The following replace if present flag values are defined: - * <ul> - * <li>0: Don't replace</li> - * <li>1: Replace</li> - * </ul> - * @param replaceIfPresentFlag - */ - public void setReplaceIfPresentFlag(byte replaceIfPresentFlag) { - getConfigurationOrCreate().setReplaceIfPresentFlag(replaceIfPresentFlag); - } - - public String getSourceAddr() { - return getConfigurationOrCreate().getSourceAddr(); - } - - /** - * Defines the address of SME (Short Message Entity) which originated this message. - * @param sourceAddr - */ - public void setSourceAddr(String sourceAddr) { - getConfigurationOrCreate().setSourceAddr(sourceAddr); - } - - public String getDestAddr() { - return getConfigurationOrCreate().getDestAddr(); - } - - /** - * Defines the destination SME address. For mobile terminated messages, this is the directory number of the recipient MS. - * Only for SubmitSm, SubmitMulti, CancelSm and DataSm. - * @param destAddr - */ - public void setDestAddr(String destAddr) { - getConfigurationOrCreate().setDestAddr(destAddr); - } - - public byte getTypeOfNumber() { - return getConfigurationOrCreate().getTypeOfNumber(); - } - - /** - * Defines the type of number (TON) to be used in the SME. - * The following TON values are defined: - * <ul> - * <li>0: Unknown</li> - * <li>1: International</li> - * <li>2: National</li> - * <li>3: Network Specific</li> - * <li>4: Subscriber Number</li> - * <li>5: Alphanumeric</li> - * <li>6: Abbreviated</li> - * </ul> - * @param typeOfNumber - */ - public void setTypeOfNumber(byte typeOfNumber) { - getConfigurationOrCreate().setTypeOfNumber(typeOfNumber); - } - - public byte getNumberingPlanIndicator() { - return getConfigurationOrCreate().getNumberingPlanIndicator(); - } - - /** - * Defines the numeric plan indicator (NPI) to be used in the SME. - * The following NPI values are defined: - * <ul> - * <li>0: Unknown</li> - * <li>1: ISDN (E163/E164)</li> - * <li>2: Data (X.121)</li> - * <li>3: Telex (F.69)</li> - * <li>6: Land Mobile (E.212)</li> - * <li>8: National</li> - * <li>9: Private</li> - * <li>10: ERMES</li> - * <li>13: Internet (IP)</li> - * <li>18: WAP Client Id (to be defined by WAP Forum)</li> - * </ul> - * @param numberingPlanIndicator - */ - public void setNumberingPlanIndicator(byte numberingPlanIndicator) { - getConfigurationOrCreate().setNumberingPlanIndicator(numberingPlanIndicator); - } - - public boolean getUsingSSL() { - return getConfigurationOrCreate().getUsingSSL(); - } - - /** - * Whether using SSL with the smpps protocol - * @param usingSSL - */ - public void setUsingSSL(boolean usingSSL) { - getConfigurationOrCreate().setUsingSSL(usingSSL); - } - - public long getInitialReconnectDelay() { - return getConfigurationOrCreate().getInitialReconnectDelay(); - } - - /** - * Defines the initial delay in milliseconds after the consumer/producer tries to reconnect to the SMSC, after the connection was lost. - * @param initialReconnectDelay - */ - public void setInitialReconnectDelay(long initialReconnectDelay) { - getConfigurationOrCreate().setInitialReconnectDelay(initialReconnectDelay); - } - - public long getReconnectDelay() { - return getConfigurationOrCreate().getReconnectDelay(); - } - - /** - * Defines the interval in milliseconds between the reconnect attempts, if the connection to the SMSC was lost and the previous was not succeed. - * @param reconnectDelay - */ - public void setReconnectDelay(long reconnectDelay) { - getConfigurationOrCreate().setReconnectDelay(reconnectDelay); - } - - public boolean isLazySessionCreation() { - return getConfigurationOrCreate().isLazySessionCreation(); - } - - /** - * Sessions can be lazily created to avoid exceptions, if the SMSC is not available when the Camel producer is started. - * Camel will check the in message headers 'CamelSmppSystemId' and 'CamelSmppPassword' of the first exchange. - * If they are present, Camel will use these data to connect to the SMSC. - * @param lazySessionCreation - */ - public void setLazySessionCreation(boolean lazySessionCreation) { - getConfigurationOrCreate().setLazySessionCreation(lazySessionCreation); - } - - public String getHttpProxyHost() { - return getConfigurationOrCreate().getHttpProxyHost(); - } - - /** - * If you need to tunnel SMPP through a HTTP proxy, set this attribute to the hostname or ip address of your HTTP proxy. - * @param httpProxyHost - */ - public void setHttpProxyHost(String httpProxyHost) { - getConfigurationOrCreate().setHttpProxyHost(httpProxyHost); - } - - public Integer getHttpProxyPort() { - return getConfigurationOrCreate().getHttpProxyPort(); - } - - /** - * If you need to tunnel SMPP through a HTTP proxy, set this attribute to the port of your HTTP proxy. - * @param httpProxyPort - */ - public void setHttpProxyPort(Integer httpProxyPort) { - getConfigurationOrCreate().setHttpProxyPort(httpProxyPort); - } - - public String getHttpProxyUsername() { - return getConfigurationOrCreate().getHttpProxyUsername(); - } - - /** - * If your HTTP proxy requires basic authentication, set this attribute to the username required for your HTTP proxy. - * @param httpProxyUsername - */ - public void setHttpProxyUsername(String httpProxyUsername) { - getConfigurationOrCreate().setHttpProxyUsername(httpProxyUsername); - } - - public String getHttpProxyPassword() { - return getConfigurationOrCreate().getHttpProxyPassword(); - } - - /** - * If your HTTP proxy requires basic authentication, set this attribute to the password required for your HTTP proxy. - * @param httpProxyPassword - */ - public void setHttpProxyPassword(String httpProxyPassword) { - getConfigurationOrCreate().setHttpProxyPassword(httpProxyPassword); - } - - public SessionStateListener getSessionStateListener() { - return getConfigurationOrCreate().getSessionStateListener(); - } - - /** - * You can refer to a org.jsmpp.session.SessionStateListener in the Registry to receive callbacks when the session state changed. - * @param sessionStateListener - */ - public void setSessionStateListener(SessionStateListener sessionStateListener) { - getConfigurationOrCreate().setSessionStateListener(sessionStateListener); - } - - public String getAddressRange() { - return getConfigurationOrCreate().getAddressRange(); - } - - /** - * You can specify the address range for the SmppConsumer as defined in section 5.2.7 of the SMPP 3.4 specification. - * The SmppConsumer will receive messages only from SMSC's which target an address (MSISDN or IP address) within this range. - * @param addressRange - */ - public void setAddressRange(String addressRange) { - getConfigurationOrCreate().setAddressRange(addressRange); - } - - public SmppSplittingPolicy getSplittingPolicy() { - return getConfigurationOrCreate().getSplittingPolicy(); - } - - /** - * You can specify a policy for handling long messages: - * <ul> - * <li>ALLOW - the default, long messages are split to 140 bytes per message</li> - * <li>TRUNCATE - long messages are split and only the first fragment will be sent to the SMSC. - * Some carriers drop subsequent fragments so this reduces load on the SMPP connection sending parts of a message that will never be delivered.</li> - * <li>REJECT - if a message would need to be split, it is rejected with an SMPP NegativeResponseException and the reason code signifying the message is too long.</li> - * </ul> - * @param splittingPolicy - */ - public void setSplittingPolicy(SmppSplittingPolicy splittingPolicy) { - getConfigurationOrCreate().setSplittingPolicy(splittingPolicy); - } - - /** - * These headers will be passed to the proxy server while establishing the connection. - * @param proxyHeaders - */ - public void setProxyHeaders(Map<String, String> proxyHeaders) { - getConfigurationOrCreate().setProxyHeaders(proxyHeaders); - } - - public Map<String, String> getProxyHeaders() { - return getConfigurationOrCreate().getProxyHeaders(); - } } \ No newline at end of file