CAMEL-8038: Fixed @UriPath
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/caa5045e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/caa5045e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/caa5045e Branch: refs/heads/master Commit: caa5045e3052b23009e0699a5f3d7a62e72b84a9 Parents: aeacbfe Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Nov 25 07:48:09 2014 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Nov 25 07:54:56 2014 +0100 ---------------------------------------------------------------------- .../component/netty/NettyConfiguration.java | 38 +++++++------- .../camel/component/netty/NettyEndpoint.java | 2 +- .../NettyServerBootstrapConfiguration.java | 52 ++++++++++++++------ .../component/netty/TextLineDelimiter.java | 2 +- ...ponentConfigurationAndDocumentationTest.java | 1 + .../component/netty4/NettyConfiguration.java | 40 +++++++-------- .../camel/component/netty4/NettyEndpoint.java | 2 +- .../NettyServerBootstrapConfiguration.java | 51 +++++++++++++------ .../component/netty4/TextLineDelimiter.java | 2 +- ...ponentConfigurationAndDocumentationTest.java | 1 + 10 files changed, 120 insertions(+), 71 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java index b232511..a53e212 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java @@ -44,53 +44,53 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem @UriParam private long requestTimeout; - @UriParam + @UriParam(defaultValue = "true") private boolean sync = true; - @UriParam + @UriParam(defaultValue = "false") private boolean textline; - @UriParam + @UriParam(defaultValue = "LINE") private TextLineDelimiter delimiter = TextLineDelimiter.LINE; - @UriParam + @UriParam(defaultValue = "true") private boolean autoAppendDelimiter = true; - @UriParam + @UriParam(defaultValue = "1024") private int decoderMaxLineLength = 1024; @UriParam private String encoding; private List<ChannelHandler> encoders = new ArrayList<ChannelHandler>(); private List<ChannelHandler> decoders = new ArrayList<ChannelHandler>(); - @UriParam + @UriParam(defaultValue = "false") private boolean disconnect; - @UriParam + @UriParam(defaultValue = "true") private boolean lazyChannelCreation = true; - @UriParam + @UriParam(defaultValue = "false") private boolean transferExchange; - @UriParam + @UriParam(defaultValue = "true") private boolean disconnectOnNoReply = true; - @UriParam + @UriParam(defaultValue = "WARN") private LoggingLevel noReplyLogLevel = LoggingLevel.WARN; - @UriParam + @UriParam(defaultValue = "WARN") private LoggingLevel serverExceptionCaughtLogLevel = LoggingLevel.WARN; - @UriParam + @UriParam(defaultValue = "DEBUG") private LoggingLevel serverClosedChannelExceptionCaughtLogLevel = LoggingLevel.DEBUG; - @UriParam + @UriParam(defaultValue = "true") private boolean allowDefaultCodec = true; @UriParam private ClientPipelineFactory clientPipelineFactory; //CAMEL-8031 Moved this option to NettyComponent private int maximumPoolSize = 16; - @UriParam + @UriParam(defaultValue = "true") private boolean orderedThreadPoolExecutor = true; - @UriParam + @UriParam(defaultValue = "-1") private int producerPoolMaxActive = -1; @UriParam private int producerPoolMinIdle; - @UriParam + @UriParam(defaultValue = "100") private int producerPoolMaxIdle = 100; - @UriParam + @UriParam(defaultValue = "" + 5 * 60 * 1000L) private long producerPoolMinEvictableIdle = 5 * 60 * 1000L; - @UriParam + @UriParam(defaultValue = "true") private boolean producerPoolEnabled = true; - @UriParam + @UriParam(defaultValue = "false") private boolean udpConnectionlessSending; /** http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java index 10c7aca..816c7bc 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyEndpoint.java @@ -37,7 +37,7 @@ import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.handler.ssl.SslHandler; import org.jboss.netty.util.Timer; -@UriEndpoint(scheme = "netty", consumerClass = NettyConsumer.class) +@UriEndpoint(scheme = "netty", consumerClass = NettyConsumer.class, label = "networking,tcp,udp") public class NettyEndpoint extends DefaultEndpoint { @UriParam private NettyConfiguration configuration; http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java index 3ecc7ed..e06d856 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java @@ -17,62 +17,86 @@ package org.apache.camel.component.netty; import java.io.File; -import java.util.Locale; import java.util.Map; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; import org.apache.camel.util.jsse.SSLContextParameters; import org.jboss.netty.channel.socket.nio.BossPool; import org.jboss.netty.channel.socket.nio.WorkerPool; import org.jboss.netty.handler.ssl.SslHandler; +@UriParams public class NettyServerBootstrapConfiguration implements Cloneable { - private static String defaultEnabledProtocols; + + public static final String DEFAULT_ENABLED_PROTOCOLS = "TLSv1,TLSv1.1,TLSv1.2"; + + @UriPath protected String protocol; + @UriPath protected String host; + @UriPath protected int port; + @UriParam(defaultValue = "false") protected boolean broadcast; + @UriParam(defaultValue = "65536") protected long sendBufferSize = 65536; + @UriParam(defaultValue = "65536") protected long receiveBufferSize = 65536; + @UriParam protected int receiveBufferSizePredictor; + @UriParam(defaultValue = "1") protected int bossCount = 1; + @UriParam protected int workerCount; + @UriParam(defaultValue = "true") protected boolean keepAlive = true; + @UriParam(defaultValue = "true") protected boolean tcpNoDelay = true; + @UriParam(defaultValue = "true") protected boolean reuseAddress = true; + @UriParam(defaultValue = "10000") protected long connectTimeout = 10000; + @UriParam protected int backlog; + @UriParam protected ServerPipelineFactory serverPipelineFactory; + @UriParam protected NettyServerBootstrapFactory nettyServerBootstrapFactory; protected Map<String, Object> options; // SSL options is also part of the server bootstrap as the server listener on port X is either plain or SSL + @UriParam(defaultValue = "false") protected boolean ssl; + @UriParam(defaultValue = "false") protected boolean sslClientCertHeaders; + @UriParam protected SslHandler sslHandler; + @UriParam protected SSLContextParameters sslContextParameters; + @UriParam(defaultValue = "false") protected boolean needClientAuth; + @UriParam protected File keyStoreFile; + @UriParam protected File trustStoreFile; + @UriParam protected String keyStoreResource; + @UriParam protected String trustStoreResource; + @UriParam(defaultValue = "JKS") protected String keyStoreFormat = "JKS"; + @UriParam(defaultValue = "SunX509") protected String securityProvider = "SunX509"; - protected String enabledProtocols = defaultEnabledProtocols; + @UriParam(defaultValue = DEFAULT_ENABLED_PROTOCOLS) + protected String enabledProtocols = DEFAULT_ENABLED_PROTOCOLS; + @UriParam protected String passphrase; protected BossPool bossPool; protected WorkerPool workerPool; + @UriParam protected String networkInterface; - // setup the default value of TLS - static { - // JDK6 doesn't support TLSv1.1,TLSv1.2 - String javaVersion = System.getProperty("java.version").toLowerCase(Locale.US); - if (javaVersion.startsWith("1.6")) { - defaultEnabledProtocols = "TLSv1"; - } else { - defaultEnabledProtocols = "TLSv1,TLSv1.1,TLSv1.2"; - } - } - public String getAddress() { return host + ":" + port; } http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty/src/main/java/org/apache/camel/component/netty/TextLineDelimiter.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/TextLineDelimiter.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/TextLineDelimiter.java index 72c4729..7c90418 100644 --- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/TextLineDelimiter.java +++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/TextLineDelimiter.java @@ -22,5 +22,5 @@ package org.apache.camel.component.netty; * @version */ public enum TextLineDelimiter { - LINE, NULL; + LINE, NULL } http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java index cfc39fc..d55360a 100644 --- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java +++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyComponentConfigurationAndDocumentationTest.java @@ -43,6 +43,7 @@ public class NettyComponentConfigurationAndDocumentationTest extends CamelTestSu String json = compConf.createParameterJsonSchema(); assertNotNull(json); + assertTrue(json.contains("\"host\": { \"kind\": \"path\", \"type\": \"string\"")); assertTrue(json.contains("\"producerPoolMinEvictableIdle\": { \"kind\": \"parameter\", \"type\": \"integer\"")); assertTrue(json.contains("\"allowDefaultCodec\": { \"kind\": \"parameter\", \"type\": \"boolean\"")); } http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java index 5e66b8d..467545d 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java @@ -44,53 +44,53 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem @UriParam private long requestTimeout; - @UriParam + @UriParam(defaultValue = "true") private boolean sync = true; - @UriParam + @UriParam(defaultValue = "false") private boolean textline; - @UriParam + @UriParam(defaultValue = "LINE") private TextLineDelimiter delimiter = TextLineDelimiter.LINE; - @UriParam + @UriParam(defaultValue = "true") private boolean autoAppendDelimiter = true; - @UriParam + @UriParam(defaultValue = "1024") private int decoderMaxLineLength = 1024; @UriParam private String encoding; private List<ChannelHandler> encoders = new ArrayList<ChannelHandler>(); private List<ChannelHandler> decoders = new ArrayList<ChannelHandler>(); - @UriParam + @UriParam(defaultValue = "false") private boolean disconnect; - @UriParam + @UriParam(defaultValue = "true") private boolean lazyChannelCreation = true; - @UriParam + @UriParam(defaultValue = "false") private boolean transferExchange; - @UriParam + @UriParam(defaultValue = "true") private boolean disconnectOnNoReply = true; - @UriParam + @UriParam(defaultValue = "WARN") private LoggingLevel noReplyLogLevel = LoggingLevel.WARN; - @UriParam + @UriParam(defaultValue = "WARN") private LoggingLevel serverExceptionCaughtLogLevel = LoggingLevel.WARN; - @UriParam + @UriParam(defaultValue = "DEBUG") private LoggingLevel serverClosedChannelExceptionCaughtLogLevel = LoggingLevel.DEBUG; - @UriParam + @UriParam(defaultValue = "false") private boolean allowDefaultCodec = true; @UriParam private ClientInitializerFactory clientInitializerFactory; - @UriParam + @UriParam(defaultValue = "16") private int maximumPoolSize = 16; - @UriParam + @UriParam(defaultValue = "true") private boolean usingExecutorService = true; - @UriParam + @UriParam(defaultValue = "-1") private int producerPoolMaxActive = -1; @UriParam private int producerPoolMinIdle; - @UriParam + @UriParam(defaultValue = "100") private int producerPoolMaxIdle = 100; - @UriParam + @UriParam(defaultValue = "" + 5 * 60 * 1000L) private long producerPoolMinEvictableIdle = 5 * 60 * 1000L; - @UriParam + @UriParam(defaultValue = "true") private boolean producerPoolEnabled = true; - @UriParam + @UriParam(defaultValue = "false") private boolean udpConnectionlessSending; /** http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java index 47ac900..d5eb692 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java @@ -37,7 +37,7 @@ import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.util.ObjectHelper; -@UriEndpoint(scheme = "netty4", consumerClass = NettyConsumer.class) +@UriEndpoint(scheme = "netty4", consumerClass = NettyConsumer.class, label = "networking,tcp,udp") public class NettyEndpoint extends DefaultEndpoint { @UriParam private NettyConfiguration configuration; http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java index a0a6bcb..16b3152 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java @@ -17,61 +17,84 @@ package org.apache.camel.component.netty4; import java.io.File; -import java.util.Locale; import java.util.Map; import io.netty.channel.EventLoopGroup; import io.netty.handler.ssl.SslHandler; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; import org.apache.camel.util.jsse.SSLContextParameters; +@UriParams public class NettyServerBootstrapConfiguration implements Cloneable { - private static String defaultEnabledProtocols; + public static final String DEFAULT_ENABLED_PROTOCOLS = "TLSv1,TLSv1.1,TLSv1.2"; + + @UriPath protected String protocol; + @UriPath protected String host; + @UriPath protected int port; + @UriParam(defaultValue = "false") protected boolean broadcast; + @UriParam(defaultValue = "65536") protected int sendBufferSize = 65536; + @UriParam(defaultValue = "65536") protected int receiveBufferSize = 65536; + @UriParam protected int receiveBufferSizePredictor; + @UriParam(defaultValue = "1") protected int bossCount = 1; + @UriParam protected int workerCount; + @UriParam(defaultValue = "true") protected boolean keepAlive = true; + @UriParam(defaultValue = "true") protected boolean tcpNoDelay = true; + @UriParam(defaultValue = "true") protected boolean reuseAddress = true; + @UriParam(defaultValue = "10000") protected int connectTimeout = 10000; + @UriParam protected int backlog; + @UriParam protected ServerInitializerFactory serverInitializerFactory; + @UriParam protected NettyServerBootstrapFactory nettyServerBootstrapFactory; protected Map<String, Object> options; // SSL options is also part of the server bootstrap as the server listener on port X is either plain or SSL + @UriParam(defaultValue = "false") protected boolean ssl; + @UriParam(defaultValue = "false") protected boolean sslClientCertHeaders; + @UriParam protected SslHandler sslHandler; + @UriParam protected SSLContextParameters sslContextParameters; + @UriParam(defaultValue = "false") protected boolean needClientAuth; + @UriParam protected File keyStoreFile; + @UriParam protected File trustStoreFile; + @UriParam protected String keyStoreResource; + @UriParam protected String trustStoreResource; + @UriParam protected String keyStoreFormat; + @UriParam protected String securityProvider; - protected String enabledProtocols = defaultEnabledProtocols; + @UriParam(defaultValue = DEFAULT_ENABLED_PROTOCOLS) + protected String enabledProtocols = DEFAULT_ENABLED_PROTOCOLS; + @UriParam protected String passphrase; protected EventLoopGroup bossGroup; protected EventLoopGroup workerGroup; + @UriParam protected String networkInterface; - // setup the default value of TLS - static { - // JDK6 doesn't support TLSv1.1,TLSv1.2 - String javaVersion = System.getProperty("java.version").toLowerCase(Locale.US); - if (javaVersion.startsWith("1.6")) { - defaultEnabledProtocols = "TLSv1"; - } else { - defaultEnabledProtocols = "TLSv1,TLSv1.1,TLSv1.2"; - } - } - public String getAddress() { return host + ":" + port; } http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/TextLineDelimiter.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/TextLineDelimiter.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/TextLineDelimiter.java index 9791e57..8d53e81 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/TextLineDelimiter.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/TextLineDelimiter.java @@ -22,5 +22,5 @@ package org.apache.camel.component.netty4; * @version */ public enum TextLineDelimiter { - LINE, NULL; + LINE, NULL } http://git-wip-us.apache.org/repos/asf/camel/blob/caa5045e/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentConfigurationAndDocumentationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentConfigurationAndDocumentationTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentConfigurationAndDocumentationTest.java index 9c806fa..c48ddeb 100644 --- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentConfigurationAndDocumentationTest.java +++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyComponentConfigurationAndDocumentationTest.java @@ -43,6 +43,7 @@ public class NettyComponentConfigurationAndDocumentationTest extends CamelTestSu String json = compConf.createParameterJsonSchema(); assertNotNull(json); + assertTrue(json.contains("\"host\": { \"kind\": \"path\", \"type\": \"string\"")); assertTrue(json.contains("\"producerPoolMinEvictableIdle\": { \"kind\": \"parameter\", \"type\": \"integer\"")); assertTrue(json.contains("\"allowDefaultCodec\": { \"kind\": \"parameter\", \"type\": \"boolean\"")); }