Repository: camel Updated Branches: refs/heads/master 357dfe36a -> b5a479232
CAMEL-10197: Fixed options to be excluded for netty http components. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b5a47923 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b5a47923 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b5a47923 Branch: refs/heads/master Commit: b5a47923232d5279898862a1435ff7c5b30b862b Parents: 357dfe3 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Aug 2 09:33:36 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Aug 2 09:33:36 2016 +0200 ---------------------------------------------------------------------- .../NettyHttpComponentConfiguration.java | 133 ------------- .../NettyHttpComponentConfiguration.java | 185 ------------------- .../SpringBootAutoConfigurationMojo.java | 23 +++ 3 files changed, 23 insertions(+), 318 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/b5a47923/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java index 2ecdef6..6529012 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java @@ -23,7 +23,6 @@ import org.apache.camel.component.netty.ClientPipelineFactory; import org.apache.camel.component.netty.NettyConfiguration; import org.apache.camel.component.netty.NettyServerBootstrapFactory; import org.apache.camel.component.netty.ServerPipelineFactory; -import org.apache.camel.component.netty.TextLineDelimiter; import org.apache.camel.component.netty.http.NettyHttpBinding; import org.apache.camel.component.netty.http.NettyHttpSecurityConfiguration; import org.apache.camel.spi.HeaderFilterStrategy; @@ -104,17 +103,6 @@ public class NettyHttpComponentConfiguration { */ private Boolean producerPoolEnabled = false; /** - * 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. - */ - private Boolean udpConnectionlessSending = false; - /** - * If the clientMode is true netty consumer will connect the address as a - * TCP client. - */ - private Boolean clientMode = false; - /** * If the useChannelBuffer is true netty producer will turn the message body * into ChannelBuffer before sending it out. */ @@ -143,10 +131,6 @@ public class NettyHttpComponentConfiguration { */ private Integer port; /** - * Setting to choose Multicast over UDP - */ - private Boolean broadcast = false; - /** * The TCP/UDP buffer sizes to be used during outbound communication. Size * is bytes. */ @@ -267,12 +251,6 @@ public class NettyHttpComponentConfiguration { */ private Boolean sync = false; /** - * Only used for TCP. If no codec is specified you can use this flag to - * indicate a text line based codec; if not specified or the value is false - * then Object Serialization is assumed over TCP. - */ - private Boolean textline = false; - /** * 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 @@ -280,26 +258,12 @@ public class NettyHttpComponentConfiguration { */ private Map<String, Object> options; /** - * The max line length to use for the textline codec. - */ - private Integer decoderMaxLineLength; - /** * 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. */ private BossPool bossPool; /** - * The delimiter to use for the textline codec. Possible values are LINE and - * NULL. - */ - private TextLineDelimiter delimiter; - /** - * Whether or not to auto append missing end delimiter when sending using - * the textline codec. - */ - private Boolean autoAppendDelimiter = false; - /** * 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 @@ -311,16 +275,6 @@ public class NettyHttpComponentConfiguration { */ private ChannelGroup channelGroup; /** - * The encoding (a charset name) to use for the textline codec. If not - * provided Camel will use the JVM default Charset. - */ - private String encoding; - /** - * 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. - */ - private String 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. @@ -390,13 +344,6 @@ public class NettyHttpComponentConfiguration { */ private LoggingLevel serverClosedChannelExceptionCaughtLogLevel; /** - * 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. - */ - private Boolean allowDefaultCodec = false; - /** * To use a custom ClientPipelineFactory */ private ClientPipelineFactory clientPipelineFactory; @@ -492,22 +439,6 @@ public class NettyHttpComponentConfiguration { this.producerPoolEnabled = producerPoolEnabled; } - public Boolean getUdpConnectionlessSending() { - return udpConnectionlessSending; - } - - public void setUdpConnectionlessSending(Boolean udpConnectionlessSending) { - this.udpConnectionlessSending = udpConnectionlessSending; - } - - public Boolean getClientMode() { - return clientMode; - } - - public void setClientMode(Boolean clientMode) { - this.clientMode = clientMode; - } - public Boolean getUseChannelBuffer() { return useChannelBuffer; } @@ -556,14 +487,6 @@ public class NettyHttpComponentConfiguration { this.port = port; } - public Boolean getBroadcast() { - return broadcast; - } - - public void setBroadcast(Boolean broadcast) { - this.broadcast = broadcast; - } - public long getSendBufferSize() { return sendBufferSize; } @@ -759,14 +682,6 @@ public class NettyHttpComponentConfiguration { this.sync = sync; } - public Boolean getTextline() { - return textline; - } - - public void setTextline(Boolean textline) { - this.textline = textline; - } - public Map<String, Object> getOptions() { return options; } @@ -775,14 +690,6 @@ public class NettyHttpComponentConfiguration { this.options = options; } - public Integer getDecoderMaxLineLength() { - return decoderMaxLineLength; - } - - public void setDecoderMaxLineLength(Integer decoderMaxLineLength) { - this.decoderMaxLineLength = decoderMaxLineLength; - } - public BossPool getBossPool() { return bossPool; } @@ -791,22 +698,6 @@ public class NettyHttpComponentConfiguration { this.bossPool = bossPool; } - public TextLineDelimiter getDelimiter() { - return delimiter; - } - - public void setDelimiter(TextLineDelimiter delimiter) { - this.delimiter = delimiter; - } - - public Boolean getAutoAppendDelimiter() { - return autoAppendDelimiter; - } - - public void setAutoAppendDelimiter(Boolean autoAppendDelimiter) { - this.autoAppendDelimiter = autoAppendDelimiter; - } - public WorkerPool getWorkerPool() { return workerPool; } @@ -823,22 +714,6 @@ public class NettyHttpComponentConfiguration { this.channelGroup = channelGroup; } - public String getEncoding() { - return encoding; - } - - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - public String getNetworkInterface() { - return networkInterface; - } - - public void setNetworkInterface(String networkInterface) { - this.networkInterface = networkInterface; - } - public List<ChannelHandler> getDecoders() { return decoders; } @@ -937,14 +812,6 @@ public class NettyHttpComponentConfiguration { this.serverClosedChannelExceptionCaughtLogLevel = serverClosedChannelExceptionCaughtLogLevel; } - public Boolean getAllowDefaultCodec() { - return allowDefaultCodec; - } - - public void setAllowDefaultCodec(Boolean allowDefaultCodec) { - this.allowDefaultCodec = allowDefaultCodec; - } - public ClientPipelineFactory getClientPipelineFactory() { return clientPipelineFactory; } http://git-wip-us.apache.org/repos/asf/camel/blob/b5a47923/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java index 8acc6b7..f82c385 100644 --- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java +++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java @@ -28,7 +28,6 @@ import org.apache.camel.component.netty4.ClientInitializerFactory; import org.apache.camel.component.netty4.NettyConfiguration; import org.apache.camel.component.netty4.NettyServerBootstrapFactory; import org.apache.camel.component.netty4.ServerInitializerFactory; -import org.apache.camel.component.netty4.TextLineDelimiter; import org.apache.camel.component.netty4.http.NettyHttpBinding; import org.apache.camel.component.netty4.http.NettyHttpSecurityConfiguration; import org.apache.camel.spi.HeaderFilterStrategy; @@ -87,10 +86,6 @@ public class NettyHttpComponentConfiguration { */ private Integer port; /** - * Setting to choose Multicast over UDP - */ - private Boolean broadcast = false; - /** * The TCP/UDP buffer sizes to be used during outbound communication. Size * is bytes. */ @@ -218,12 +213,6 @@ public class NettyHttpComponentConfiguration { */ private Map<String, Object> options; /** - * Only used for TCP. If no codec is specified you can use this flag to - * indicate a text line based codec; if not specified or the value is false - * then Object Serialization is assumed over TCP. - */ - private Boolean textline = false; - /** * 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 @@ -232,25 +221,11 @@ public class NettyHttpComponentConfiguration { */ private Boolean nativeTransport = false; /** - * The max line length to use for the textline codec. - */ - private Integer decoderMaxLineLength; - /** * Set the BossGroup which could be used for handling the new connection of * the server side across the NettyEndpoint */ private EventLoopGroup bossGroup; /** - * The delimiter to use for the textline codec. Possible values are LINE and - * NULL. - */ - private TextLineDelimiter delimiter; - /** - * Whether or not to auto append missing end delimiter when sending using - * the textline codec. - */ - private Boolean autoAppendDelimiter = false; - /** * 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. @@ -261,16 +236,6 @@ public class NettyHttpComponentConfiguration { */ private ChannelGroup channelGroup; /** - * The encoding (a charset name) to use for the textline codec. If not - * provided Camel will use the JVM default Charset. - */ - private String encoding; - /** - * 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. - */ - private String 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. @@ -287,21 +252,11 @@ public class NettyHttpComponentConfiguration { */ private List<ChannelHandler> encoders; /** - * Used only in clientMode in consumer the consumer will attempt to - * reconnect on disconnection if this is enabled - */ - private Boolean reconnect = false; - /** * A custom ChannelHandler class that can be used to perform special * marshalling of outbound payloads. */ private ChannelHandler encoder; /** - * Used if reconnect and clientMode is enabled. The interval in milli - * seconds to attempt reconnection - */ - private Integer reconnectInterval; - /** * A custom ChannelHandler class that can be used to perform special * marshalling of inbound payloads. */ @@ -348,13 +303,6 @@ public class NettyHttpComponentConfiguration { */ private LoggingLevel serverClosedChannelExceptionCaughtLogLevel; /** - * 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. - */ - private Boolean allowDefaultCodec = false; - /** * To use a custom ClientInitializerFactory */ private ClientInitializerFactory clientInitializerFactory; @@ -391,27 +339,6 @@ public class NettyHttpComponentConfiguration { */ private Boolean producerPoolEnabled = false; /** - * 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. - */ - private Boolean udpConnectionlessSending = false; - /** - * If the clientMode is true netty consumer will connect the address as a - * TCP client. - */ - private Boolean clientMode = false; - /** - * If the useByteBuf is true netty producer will turn the message body into - * ByteBuf before sending it out. - */ - private Boolean useByteBuf = false; - /** - * For UDP only. If enabled the using byte array codec instead of Java - * serialization protocol. - */ - private Boolean udpByteArrayCodec = false; - /** * This option allows producers to reuse the same Netty Channel for the * lifecycle of processing the Exchange. This is useable if you need to call * a server multiple times in a Camel route and want to use the same network @@ -497,14 +424,6 @@ public class NettyHttpComponentConfiguration { this.port = port; } - public Boolean getBroadcast() { - return broadcast; - } - - public void setBroadcast(Boolean broadcast) { - this.broadcast = broadcast; - } - public Integer getSendBufferSize() { return sendBufferSize; } @@ -708,14 +627,6 @@ public class NettyHttpComponentConfiguration { this.options = options; } - public Boolean getTextline() { - return textline; - } - - public void setTextline(Boolean textline) { - this.textline = textline; - } - public Boolean getNativeTransport() { return nativeTransport; } @@ -724,14 +635,6 @@ public class NettyHttpComponentConfiguration { this.nativeTransport = nativeTransport; } - public Integer getDecoderMaxLineLength() { - return decoderMaxLineLength; - } - - public void setDecoderMaxLineLength(Integer decoderMaxLineLength) { - this.decoderMaxLineLength = decoderMaxLineLength; - } - public EventLoopGroup getBossGroup() { return bossGroup; } @@ -740,22 +643,6 @@ public class NettyHttpComponentConfiguration { this.bossGroup = bossGroup; } - public TextLineDelimiter getDelimiter() { - return delimiter; - } - - public void setDelimiter(TextLineDelimiter delimiter) { - this.delimiter = delimiter; - } - - public Boolean getAutoAppendDelimiter() { - return autoAppendDelimiter; - } - - public void setAutoAppendDelimiter(Boolean autoAppendDelimiter) { - this.autoAppendDelimiter = autoAppendDelimiter; - } - public EventLoopGroup getWorkerGroup() { return workerGroup; } @@ -772,22 +659,6 @@ public class NettyHttpComponentConfiguration { this.channelGroup = channelGroup; } - public String getEncoding() { - return encoding; - } - - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - public String getNetworkInterface() { - return networkInterface; - } - - public void setNetworkInterface(String networkInterface) { - this.networkInterface = networkInterface; - } - public List<ChannelHandler> getDecoders() { return decoders; } @@ -812,14 +683,6 @@ public class NettyHttpComponentConfiguration { this.encoders = encoders; } - public Boolean getReconnect() { - return reconnect; - } - - public void setReconnect(Boolean reconnect) { - this.reconnect = reconnect; - } - public ChannelHandler getEncoder() { return encoder; } @@ -828,14 +691,6 @@ public class NettyHttpComponentConfiguration { this.encoder = encoder; } - public Integer getReconnectInterval() { - return reconnectInterval; - } - - public void setReconnectInterval(Integer reconnectInterval) { - this.reconnectInterval = reconnectInterval; - } - public ChannelHandler getDecoder() { return decoder; } @@ -902,14 +757,6 @@ public class NettyHttpComponentConfiguration { this.serverClosedChannelExceptionCaughtLogLevel = serverClosedChannelExceptionCaughtLogLevel; } - public Boolean getAllowDefaultCodec() { - return allowDefaultCodec; - } - - public void setAllowDefaultCodec(Boolean allowDefaultCodec) { - this.allowDefaultCodec = allowDefaultCodec; - } - public ClientInitializerFactory getClientInitializerFactory() { return clientInitializerFactory; } @@ -968,38 +815,6 @@ public class NettyHttpComponentConfiguration { this.producerPoolEnabled = producerPoolEnabled; } - public Boolean getUdpConnectionlessSending() { - return udpConnectionlessSending; - } - - public void setUdpConnectionlessSending(Boolean udpConnectionlessSending) { - this.udpConnectionlessSending = udpConnectionlessSending; - } - - public Boolean getClientMode() { - return clientMode; - } - - public void setClientMode(Boolean clientMode) { - this.clientMode = clientMode; - } - - public Boolean getUseByteBuf() { - return useByteBuf; - } - - public void setUseByteBuf(Boolean useByteBuf) { - this.useByteBuf = useByteBuf; - } - - public Boolean getUdpByteArrayCodec() { - return udpByteArrayCodec; - } - - public void setUdpByteArrayCodec(Boolean udpByteArrayCodec) { - this.udpByteArrayCodec = udpByteArrayCodec; - } - public Boolean getReuseChannel() { return reuseChannel; } http://git-wip-us.apache.org/repos/asf/camel/blob/b5a47923/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java index 92e85b4..27b49b6 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java @@ -283,6 +283,12 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", prefix); for (ComponentOptionModel option : model.getComponentOptions()) { + + if (skipComponentOption(model, option)) { + // some component options should be skipped + continue; + } + // remove <?> as generic type as Roaster (Eclipse JDT) cannot use that String type = option.getJavaType(); type = type.replaceAll("\\<\\?\\>", ""); @@ -354,6 +360,21 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { } } + // CHECKSTYLE:OFF + private static boolean skipComponentOption(ComponentModel model, ComponentOptionModel option) { + if ("netty4-http".equals(model.getScheme()) || "netty-http".equals(model.getScheme())) { + String name = option.getName(); + if (name.equals("textline") || name.equals("delimiter") || name.equals("autoAppendDelimiter") || name.equals("decoderMaxLineLength") + || name.equals("encoding") || name.equals("allowDefaultCodec") || name.equals("udpConnectionlessSending") || name.equals("networkInterface") + || name.equals("clientMode") || name.equals("reconnect") || name.equals("reconnectInterval") || name.equals("useByteBuf") + || name.equals("udpByteArrayCodec") || name.equals("broadcast")) { + return true; + } + } + return false; + } + // CHECKSTYLE:ON + private void createDataFormatConfigurationSource(String packageName, DataFormatModel model, String overrideDataFormatName) throws MojoFailureException { final JavaClassSource javaClass = Roaster.create(JavaClassSource.class); @@ -473,6 +494,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { if ("id".equals(option.getName()) || "expression".equals(option.getName()) || "resultType".equals(option.getName())) { continue; } + // CHECKSTYLE:OFF if ("bean".equals(model.getName())) { // and skip following as they are not global options if ("bean".equals(option.getName()) || "ref".equals(option.getName()) || "method".equals(option.getName()) || "beanType".equals(option.getName())) { @@ -501,6 +523,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { continue; } } + // CHECKSTYLE:ON // remove <?> as generic type as Roaster (Eclipse JDT) cannot use that String type = option.getJavaType();