CAMEL-10197: Regenerated asciidoc and spring-boot starter configuration with NestedConfiguration support
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d485f2f0 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d485f2f0 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d485f2f0 Branch: refs/heads/master Commit: d485f2f00ea356e4ad9b3062691f7349ac51de23 Parents: 89d94df Author: Dhiraj Bokde <dhira...@yahoo.com> Authored: Tue Sep 20 12:48:04 2016 -0700 Committer: Dhiraj Bokde <dhira...@yahoo.com> Committed: Tue Sep 20 12:50:30 2016 -0700 ---------------------------------------------------------------------- .../AhcComponentAutoConfiguration.java | 20 + .../springboot/AhcComponentConfiguration.java | 6 + .../WsComponentAutoConfiguration.java | 20 + .../ws/springboot/WsComponentConfiguration.java | 6 + .../AMQPComponentAutoConfiguration.java | 20 + .../springboot/AMQPComponentConfiguration.java | 49 +- .../ApnsComponentAutoConfiguration.java | 20 + .../springboot/ApnsComponentConfiguration.java | 2 + .../WebsocketComponentAutoConfiguration.java | 20 + .../WebsocketComponentConfiguration.java | 5 + .../AvroComponentAutoConfiguration.java | 20 + .../springboot/AvroComponentConfiguration.java | 257 +-- .../BeanstalkComponentAutoConfiguration.java | 20 + .../BeanstalkComponentConfiguration.java | 2 + .../BoxComponentAutoConfiguration.java | 20 + .../springboot/BoxComponentConfiguration.java | 429 ++-- .../BraintreeComponentAutoConfiguration.java | 20 + .../BraintreeComponentConfiguration.java | 146 +- .../CacheComponentAutoConfiguration.java | 20 + .../springboot/CacheComponentConfiguration.java | 346 ++-- .../CometdComponentAutoConfiguration.java | 20 + .../CometdComponentConfiguration.java | 3 + .../DirectComponentAutoConfiguration.java | 20 + .../DirectComponentConfiguration.java | 6 +- .../DirectVmComponentAutoConfiguration.java | 20 + .../DirectVmComponentConfiguration.java | 8 +- .../LogComponentAutoConfiguration.java | 20 + .../springboot/LogComponentConfiguration.java | 2 + .../PropertiesComponentAutoConfiguration.java | 20 + .../PropertiesComponentConfiguration.java | 3 + .../RestComponentAutoConfiguration.java | 20 + .../SchedulerComponentAutoConfiguration.java | 20 + .../SedaComponentAutoConfiguration.java | 20 + .../springboot/SedaComponentConfiguration.java | 2 + .../StubComponentAutoConfiguration.java | 20 + .../springboot/StubComponentConfiguration.java | 2 + .../ValidatorComponentAutoConfiguration.java | 20 + .../ValidatorComponentConfiguration.java | 2 + .../VmComponentAutoConfiguration.java | 20 + .../vm/springboot/VmComponentConfiguration.java | 2 + .../XsltComponentAutoConfiguration.java | 20 + .../springboot/XsltComponentConfiguration.java | 34 +- ...italSignatureComponentAutoConfiguration.java | 20 + .../DigitalSignatureComponentConfiguration.java | 530 ++--- .../CxfRsComponentAutoConfiguration.java | 20 + .../springboot/CxfRsComponentConfiguration.java | 2 + .../CxfComponentAutoConfiguration.java | 20 + .../springboot/CxfComponentConfiguration.java | 2 + .../DisruptorComponentAutoConfiguration.java | 20 + .../DisruptorVmComponentAutoConfiguration.java | 20 + .../DockerComponentAutoConfiguration.java | 20 + .../DockerComponentConfiguration.java | 221 ++- .../EjbComponentAutoConfiguration.java | 20 + ...ElasticsearchComponentAutoConfiguration.java | 20 + .../ElasticsearchComponentConfiguration.java | 2 + .../ElsqlComponentAutoConfiguration.java | 20 + .../springboot/ElsqlComponentConfiguration.java | 2 + .../FacebookComponentAutoConfiguration.java | 20 + .../FacebookComponentConfiguration.java | 338 +++- .../FlinkComponentAutoConfiguration.java | 20 + .../springboot/FlinkComponentConfiguration.java | 5 + .../FreemarkerComponentAutoConfiguration.java | 20 + .../FreemarkerComponentConfiguration.java | 2 + .../GangliaComponentAutoConfiguration.java | 20 + .../GangliaComponentConfiguration.java | 354 ++-- ...oogleCalendarComponentAutoConfiguration.java | 20 + .../GoogleCalendarComponentConfiguration.java | 157 +- .../GoogleDriveComponentAutoConfiguration.java | 20 + .../GoogleDriveComponentConfiguration.java | 118 +- .../GoogleMailComponentAutoConfiguration.java | 20 + .../GoogleMailComponentConfiguration.java | 118 +- ...GuavaEventBusComponentAutoConfiguration.java | 20 + .../GuavaEventBusComponentConfiguration.java | 2 + .../HazelcastComponentAutoConfiguration.java | 20 + .../HazelcastComponentConfiguration.java | 2 + .../HBaseComponentAutoConfiguration.java | 20 + .../springboot/HBaseComponentConfiguration.java | 2 + .../HdfsComponentAutoConfiguration.java | 20 + .../HdfsComponentAutoConfiguration.java | 20 + .../HttpComponentAutoConfiguration.java | 20 + .../springboot/HttpComponentConfiguration.java | 6 + .../HttpComponentAutoConfiguration.java | 20 + .../springboot/HttpComponentConfiguration.java | 16 +- .../IBatisComponentAutoConfiguration.java | 20 + .../IBatisComponentConfiguration.java | 2 + .../JcloudsComponentAutoConfiguration.java | 20 + .../JdbcComponentAutoConfiguration.java | 20 + .../JettyHttpComponentAutoConfiguration9.java | 20 + .../JettyHttpComponentConfiguration9.java | 9 + .../JGroupsComponentAutoConfiguration.java | 20 + .../JGroupsComponentConfiguration.java | 2 + .../JmsComponentAutoConfiguration.java | 20 + .../springboot/JmsComponentConfiguration.java | 1379 ++++++++++++- .../JoltComponentAutoConfiguration.java | 20 + .../springboot/JoltComponentConfiguration.java | 2 + .../JpaComponentAutoConfiguration.java | 20 + .../springboot/JpaComponentConfiguration.java | 2 + .../ScpComponentAutoConfiguration.java | 20 + .../Jt400ComponentAutoConfiguration.java | 20 + .../springboot/Jt400ComponentConfiguration.java | 2 + .../KafkaComponentAutoConfiguration.java | 20 + .../KestrelComponentAutoConfiguration.java | 20 + .../KestrelComponentConfiguration.java | 48 +- .../LinkedInComponentAutoConfiguration.java | 20 + .../LinkedInComponentConfiguration.java | 292 +-- .../LuceneComponentAutoConfiguration.java | 20 + .../LuceneComponentConfiguration.java | 124 +- .../LumberjackComponentAutoConfiguration.java | 20 + .../LumberjackComponentConfiguration.java | 2 + .../MailComponentAutoConfiguration.java | 20 + .../springboot/MailComponentConfiguration.java | 924 ++++----- .../MetricsComponentAutoConfiguration.java | 20 + .../MetricsComponentConfiguration.java | 2 + .../Mina2ComponentAutoConfiguration.java | 20 + .../springboot/Mina2ComponentConfiguration.java | 671 +++---- .../MQTTComponentAutoConfiguration.java | 20 + .../MsvComponentAutoConfiguration.java | 20 + .../springboot/MsvComponentConfiguration.java | 2 + .../MustacheComponentAutoConfiguration.java | 20 + .../MustacheComponentConfiguration.java | 2 + .../MyBatisComponentAutoConfiguration.java | 20 + .../MyBatisComponentConfiguration.java | 2 + .../NagiosComponentAutoConfiguration.java | 20 + .../NagiosComponentConfiguration.java | 97 +- .../NettyHttpComponentAutoConfiguration.java | 20 + .../NettyHttpComponentConfiguration.java | 832 +------- .../NettyComponentAutoConfiguration.java | 20 + .../springboot/NettyComponentConfiguration.java | 1765 +++++++++-------- .../NettyHttpComponentAutoConfiguration.java | 20 + .../NettyHttpComponentConfiguration.java | 822 +------- .../NettyComponentAutoConfiguration.java | 20 + .../springboot/NettyComponentConfiguration.java | 1870 +++++++++--------- .../Olingo2ComponentAutoConfiguration.java | 20 + .../Olingo2ComponentConfiguration.java | 167 +- .../OpenShiftComponentAutoConfiguration.java | 20 + .../PahoComponentAutoConfiguration.java | 20 + .../springboot/PahoComponentConfiguration.java | 2 + .../QuartzComponentAutoConfiguration.java | 20 + .../QuartzComponentConfiguration.java | 3 + .../QuartzComponentAutoConfiguration.java | 20 + .../QuartzComponentConfiguration.java | 3 + .../QuickfixjComponentAutoConfiguration.java | 20 + .../QuickfixjComponentConfiguration.java | 4 + .../RestletComponentAutoConfiguration.java | 20 + .../RestletComponentConfiguration.java | 2 + .../SalesforceComponentAutoConfiguration.java | 20 + .../SalesforceComponentConfiguration.java | 1004 +++++----- .../XQueryComponentAutoConfiguration.java | 20 + .../XQueryComponentConfiguration.java | 2 + .../ServletComponentAutoConfiguration.java | 20 + .../ServletComponentConfiguration.java | 5 + .../SjmsBatchComponentAutoConfiguration.java | 20 + .../SjmsComponentAutoConfiguration.java | 20 + .../springboot/SjmsComponentConfiguration.java | 19 +- .../SlackComponentAutoConfiguration.java | 20 + .../SmppComponentAutoConfiguration.java | 20 + .../springboot/SmppComponentConfiguration.java | 1006 +++++----- .../SparkComponentAutoConfiguration.java | 20 + .../springboot/SparkComponentConfiguration.java | 98 +- .../SparkComponentAutoConfiguration.java | 20 + .../springboot/SparkComponentConfiguration.java | 3 + .../SplunkComponentAutoConfiguration.java | 20 + .../SplunkComponentConfiguration.java | 2 + .../SpringBatchComponentAutoConfiguration.java | 20 + .../SpringBatchComponentConfiguration.java | 3 + .../EventComponentAutoConfiguration.java | 20 + .../springboot/EventComponentConfiguration.java | 2 + .../SqlComponentAutoConfiguration.java | 20 + .../SqlStoredComponentAutoConfiguration.java | 20 + .../SshComponentAutoConfiguration.java | 20 + .../springboot/SshComponentConfiguration.java | 189 +- .../StompComponentAutoConfiguration.java | 20 + .../springboot/StompComponentConfiguration.java | 76 +- .../TelegramComponentAutoConfiguration.java | 20 + .../TwitterComponentAutoConfiguration.java | 20 + .../UndertowComponentAutoConfiguration.java | 20 + .../UndertowComponentConfiguration.java | 3 + .../VelocityComponentAutoConfiguration.java | 20 + .../VelocityComponentConfiguration.java | 2 + .../VertxComponentAutoConfiguration.java | 20 + .../springboot/VertxComponentConfiguration.java | 4 + .../WebsocketComponentAutoConfiguration.java | 20 + .../WebsocketComponentConfiguration.java | 3 + .../XmlSignatureComponentAutoConfiguration.java | 20 + .../XmlSignatureComponentConfiguration.java | 841 +++++++- .../YammerComponentAutoConfiguration.java | 20 + .../YammerComponentConfiguration.java | 184 +- .../ZooKeeperComponentAutoConfiguration.java | 20 + .../ZooKeeperComponentConfiguration.java | 248 +-- .../src/main/docs/avro-component.adoc | 14 +- .../camel-box/src/main/docs/box-component.adoc | 20 +- .../src/main/docs/braintree-component.adoc | 15 +- .../src/main/docs/cache-component.adoc | 16 +- .../src/main/docs/crypto-component.adoc | 24 +- .../src/main/docs/docker-component.adoc | 2 +- .../src/main/docs/facebook-component.adoc | 31 +- .../src/main/docs/ganglia-component.adoc | 18 +- .../main/docs/google-calendar-component.adoc | 15 +- .../src/main/docs/google-drive-component.adoc | 12 +- .../src/main/docs/google-mail-component.adoc | 12 +- .../src/main/docs/kestrel-component.adoc | 5 +- .../src/main/docs/linkedin-component.adoc | 13 +- .../src/main/docs/lucene-component.adoc | 10 +- .../src/main/docs/mail-component.adoc | 40 +- .../src/main/docs/mina-component.adoc | 24 +- .../src/main/docs/mina2-component.adoc | 29 +- .../src/main/docs/nagios-component.adoc | 10 +- .../src/main/docs/netty-http-component.adoc | 67 +- .../src/main/docs/netty-component.adoc | 67 +- .../src/main/docs/netty4-http-component.adoc | 70 +- .../src/main/docs/netty4-component.adoc | 70 +- .../src/main/docs/olingo2-component.adoc | 14 +- .../src/main/docs/salesforce-component.adoc | 47 +- .../src/main/docs/smpp-component.adoc | 39 +- .../src/main/docs/solr-component.adoc | 3 +- .../src/main/docs/xmlsecurity-component.adoc | 47 +- .../src/main/docs/zookeeper-component.adoc | 13 +- 217 files changed, 11856 insertions(+), 6890 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java b/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java index 5eeb73e..e226da5 100644 --- a/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java +++ b/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class AhcComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentConfiguration.java b/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentConfiguration.java index 0da3874..078b3bc 100644 --- a/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentConfiguration.java +++ b/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentConfiguration.java @@ -22,6 +22,7 @@ import org.apache.camel.util.jsse.SSLContextParameters; import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.AsyncHttpClientConfig; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * To call external HTTP services using Async Http Client. @@ -34,16 +35,19 @@ public class AhcComponentConfiguration { /** * To use a custom AsyncHttpClient */ + @NestedConfigurationProperty private AsyncHttpClient client; /** * To use a custom AhcBinding which allows to control how to bind between * AHC and Camel. */ + @NestedConfigurationProperty private AhcBinding binding; /** * To configure the AsyncHttpClient to use a custom * com.ning.http.client.AsyncHttpClientConfig instance. */ + @NestedConfigurationProperty private AsyncHttpClientConfig clientConfig; /** * Reference to a org.apache.camel.util.jsse.SSLContextParameters in the @@ -51,6 +55,7 @@ public class AhcComponentConfiguration { * configuration options provided through the clientConfig option at the * endpoint or component level. */ + @NestedConfigurationProperty private SSLContextParameters sslContextParameters; /** * Whether to allow java serialization when a request uses @@ -64,6 +69,7 @@ public class AhcComponentConfiguration { * To use a custom HeaderFilterStrategy to filter header to and from Camel * message. */ + @NestedConfigurationProperty private HeaderFilterStrategy headerFilterStrategy; public AsyncHttpClient getClient() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java b/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java index 71e19bb..97427fd 100644 --- a/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java +++ b/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class WsComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentConfiguration.java b/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentConfiguration.java index 91c0802..a894dd3 100644 --- a/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentConfiguration.java +++ b/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentConfiguration.java @@ -22,6 +22,7 @@ import org.apache.camel.util.jsse.SSLContextParameters; import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.AsyncHttpClientConfig; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * To exchange data with external Websocket servers using Async Http Client. @@ -34,16 +35,19 @@ public class WsComponentConfiguration { /** * To use a custom AsyncHttpClient */ + @NestedConfigurationProperty private AsyncHttpClient client; /** * To use a custom AhcBinding which allows to control how to bind between * AHC and Camel. */ + @NestedConfigurationProperty private AhcBinding binding; /** * To configure the AsyncHttpClient to use a custom * com.ning.http.client.AsyncHttpClientConfig instance. */ + @NestedConfigurationProperty private AsyncHttpClientConfig clientConfig; /** * Reference to a org.apache.camel.util.jsse.SSLContextParameters in the @@ -51,6 +55,7 @@ public class WsComponentConfiguration { * configuration options provided through the clientConfig option at the * endpoint or component level. */ + @NestedConfigurationProperty private SSLContextParameters sslContextParameters; /** * Whether to allow java serialization when a request uses @@ -64,6 +69,7 @@ public class WsComponentConfiguration { * To use a custom HeaderFilterStrategy to filter header to and from Camel * message. */ + @NestedConfigurationProperty private HeaderFilterStrategy headerFilterStrategy; public AsyncHttpClient getClient() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java b/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java index 64a8d44..6da1448 100644 --- a/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java +++ b/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class AMQPComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java b/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java index 487c7ca..4a6b737 100644 --- a/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java +++ b/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java @@ -28,6 +28,7 @@ import org.apache.camel.component.jms.ReplyToType; import org.apache.camel.spi.HeaderFilterStrategy; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; +import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.context.ApplicationContext; import org.springframework.core.task.TaskExecutor; import org.springframework.jms.core.JmsOperations; @@ -47,6 +48,7 @@ public class AMQPComponentConfiguration { /** * To use a shared JMS configuration */ + @NestedConfigurationProperty private JmsConfiguration configuration; /** * Specifies whether the consumer accept messages while it is stopping. You @@ -178,6 +180,7 @@ public class AMQPComponentConfiguration { * errorHandlerLogStackTrace options. This makes it much easier to configure * than having to code a custom errorHandler. */ + @NestedConfigurationProperty private ErrorHandler errorHandler; /** * Allows to configure the default errorHandler logging level for logging @@ -248,6 +251,7 @@ public class AMQPComponentConfiguration { * org.springframework.jms.support.converter.MessageConverter so you can be * in control how to map to/from a javax.jms.Message. */ + @NestedConfigurationProperty private MessageConverter messageConverter; /** * Specifies whether Camel should auto map the received JMS message to a @@ -291,13 +295,13 @@ public class AMQPComponentConfiguration { /** * The timeout for receiving messages (in milliseconds). */ - private long receiveTimeout; + private Long receiveTimeout; /** * Specifies the interval between recovery attempts i.e. when a connection * is being refreshed in milliseconds. The default is 5000 ms that is 5 * seconds. */ - private long recoveryInterval; + private Long recoveryInterval; /** * Deprecated: Enabled by default if you specify a durableSubscriptionName * and a clientId. @@ -307,12 +311,13 @@ public class AMQPComponentConfiguration { /** * Allows you to specify a custom task executor for consuming messages. */ + @NestedConfigurationProperty private TaskExecutor taskExecutor; /** * When sending messages specifies the time-to-live of the message (in * milliseconds). */ - private long timeToLive; + private Long timeToLive; /** * Specifies whether to use transacted mode */ @@ -325,6 +330,7 @@ public class AMQPComponentConfiguration { /** * The Spring transaction manager to use. */ + @NestedConfigurationProperty private PlatformTransactionManager transactionManager; /** * The name of the transaction to use. @@ -375,7 +381,7 @@ public class AMQPComponentConfiguration { * and thus have per message individual timeout values. See also the * requestTimeoutCheckerInterval option. */ - private long requestTimeout; + private Long requestTimeout; /** * Configures how often Camel should check for timed out Exchanges when * doing request/reply over JMS. By default Camel checks once per second. @@ -383,7 +389,7 @@ public class AMQPComponentConfiguration { * this interval to check more frequently. The timeout is determined by the * option requestTimeout. */ - private long requestTimeoutCheckerInterval; + private Long requestTimeoutCheckerInterval; /** * You can transfer the exchange over the wire instead of just the body and * headers. The following fields are transferred: In body Out body Fault @@ -424,6 +430,7 @@ public class AMQPComponentConfiguration { * JmsTemplate as default. Can be used for testing purpose but not used much * as stated in the spring API docs. */ + @NestedConfigurationProperty private JmsOperations jmsOperations; /** * A pluggable @@ -431,6 +438,7 @@ public class AMQPComponentConfiguration { * allows you to use your own resolver (for example to lookup the real * destination in a JNDI registry). */ + @NestedConfigurationProperty private DestinationResolver destinationResolver; /** * Allows for explicitly specifying which kind of strategy to use for @@ -509,25 +517,30 @@ public class AMQPComponentConfiguration { * implementation of the org.apache.camel.component.jms.JmsKeyFormatStrategy * and refer to it using the notation. */ + @NestedConfigurationProperty private JmsKeyFormatStrategy jmsKeyFormatStrategy; /** * Sets the Spring ApplicationContext to use */ + @NestedConfigurationProperty private ApplicationContext applicationContext; /** * To use a custom QueueBrowseStrategy when browsing queues */ + @NestedConfigurationProperty private QueueBrowseStrategy queueBrowseStrategy; /** * To use a custom HeaderFilterStrategy to filter header to and from Camel * message. */ + @NestedConfigurationProperty private HeaderFilterStrategy headerFilterStrategy; /** * To use the given MessageCreatedStrategy which are invoked when Camel * creates new instances of javax.jms.Message objects when Camel is sending * a JMS message. */ + @NestedConfigurationProperty private MessageCreatedStrategy messageCreatedStrategy; /** * Number of times to wait for provisional correlation id to be updated to @@ -539,7 +552,7 @@ public class AMQPComponentConfiguration { * Interval in millis to sleep each time while waiting for provisional * correlation id to be updated. */ - private long waitForProvisionCorrelationToBeUpdatedThreadSleepingTime; + private Long waitForProvisionCorrelationToBeUpdatedThreadSleepingTime; public JmsConfiguration getConfiguration() { return configuration; @@ -858,19 +871,19 @@ public class AMQPComponentConfiguration { this.pubSubNoLocal = pubSubNoLocal; } - public long getReceiveTimeout() { + public Long getReceiveTimeout() { return receiveTimeout; } - public void setReceiveTimeout(long receiveTimeout) { + public void setReceiveTimeout(Long receiveTimeout) { this.receiveTimeout = receiveTimeout; } - public long getRecoveryInterval() { + public Long getRecoveryInterval() { return recoveryInterval; } - public void setRecoveryInterval(long recoveryInterval) { + public void setRecoveryInterval(Long recoveryInterval) { this.recoveryInterval = recoveryInterval; } @@ -893,11 +906,11 @@ public class AMQPComponentConfiguration { this.taskExecutor = taskExecutor; } - public long getTimeToLive() { + public Long getTimeToLive() { return timeToLive; } - public void setTimeToLive(long timeToLive) { + public void setTimeToLive(Long timeToLive) { this.timeToLive = timeToLive; } @@ -975,20 +988,20 @@ public class AMQPComponentConfiguration { this.forceSendOriginalMessage = forceSendOriginalMessage; } - public long getRequestTimeout() { + public Long getRequestTimeout() { return requestTimeout; } - public void setRequestTimeout(long requestTimeout) { + public void setRequestTimeout(Long requestTimeout) { this.requestTimeout = requestTimeout; } - public long getRequestTimeoutCheckerInterval() { + public Long getRequestTimeoutCheckerInterval() { return requestTimeoutCheckerInterval; } public void setRequestTimeoutCheckerInterval( - long requestTimeoutCheckerInterval) { + Long requestTimeoutCheckerInterval) { this.requestTimeoutCheckerInterval = requestTimeoutCheckerInterval; } @@ -1141,12 +1154,12 @@ public class AMQPComponentConfiguration { this.waitForProvisionCorrelationToBeUpdatedCounter = waitForProvisionCorrelationToBeUpdatedCounter; } - public long getWaitForProvisionCorrelationToBeUpdatedThreadSleepingTime() { + public Long getWaitForProvisionCorrelationToBeUpdatedThreadSleepingTime() { return waitForProvisionCorrelationToBeUpdatedThreadSleepingTime; } public void setWaitForProvisionCorrelationToBeUpdatedThreadSleepingTime( - long waitForProvisionCorrelationToBeUpdatedThreadSleepingTime) { + Long waitForProvisionCorrelationToBeUpdatedThreadSleepingTime) { this.waitForProvisionCorrelationToBeUpdatedThreadSleepingTime = waitForProvisionCorrelationToBeUpdatedThreadSleepingTime; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java b/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java index 9252104..7d623dc 100644 --- a/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java +++ b/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class ApnsComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentConfiguration.java b/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentConfiguration.java index 82f9fb9..f20f20f 100644 --- a/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentConfiguration.java +++ b/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentConfiguration.java @@ -18,6 +18,7 @@ package org.apache.camel.component.apns.springboot; import com.notnoop.apns.ApnsService; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * For sending notifications to Apple iOS devices. @@ -30,6 +31,7 @@ public class ApnsComponentConfiguration { /** * To use a custom link ApnsService */ + @NestedConfigurationProperty private ApnsService apnsService; public ApnsService getApnsService() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java b/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java index d1144ad..8ca721c 100644 --- a/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java +++ b/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class WebsocketComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java b/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java index c75fbd8..190bb22 100644 --- a/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java +++ b/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java @@ -21,6 +21,7 @@ import org.apache.camel.http.common.HttpBinding; import org.apache.camel.http.common.HttpConfiguration; import org.apache.camel.spi.HeaderFilterStrategy; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * To exchange data with external Websocket clients using Atmosphere. @@ -37,6 +38,7 @@ public class WebsocketComponentConfiguration { /** * To use a custom org.apache.camel.component.servlet.HttpRegistry. */ + @NestedConfigurationProperty private HttpRegistry httpRegistry; /** * Whether to automatic bind multipart/form-data as attachments on the Camel @@ -48,10 +50,12 @@ public class WebsocketComponentConfiguration { * To use a custom HttpBinding to control the mapping between Camel message * and HttpClient. */ + @NestedConfigurationProperty private HttpBinding httpBinding; /** * To use the shared HttpConfiguration as base configuration. */ + @NestedConfigurationProperty private HttpConfiguration httpConfiguration; /** * Whether to allow java serialization when a request uses @@ -65,6 +69,7 @@ public class WebsocketComponentConfiguration { * To use a custom HeaderFilterStrategy to filter header to and from Camel * message. */ + @NestedConfigurationProperty private HeaderFilterStrategy headerFilterStrategy; public String getServletName() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java b/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java index 7e6cc52..9a10743 100644 --- a/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java +++ b/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class AvroComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentConfiguration.java b/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentConfiguration.java index 6b53cfc..38161cf 100644 --- a/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentConfiguration.java +++ b/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentConfiguration.java @@ -17,8 +17,9 @@ package org.apache.camel.component.avro.springboot; import org.apache.avro.Protocol; -import org.apache.camel.component.avro.AvroConfiguration; +import org.apache.camel.component.avro.AvroTransport; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * Working with Apache Avro for data serialization. @@ -29,139 +30,141 @@ import org.springframework.boot.context.properties.ConfigurationProperties; public class AvroComponentConfiguration { /** - * To use a shared AvroConfiguration to configure options once. Properties - * of the shared configuration can also be set individually. + * To use a shared AvroConfiguration to configure options once */ - private AvroConfiguration configuration; - /** - * Hostname to use - */ - private String host; - /** - * Port number to use - */ - private Integer port; - /** - * Avro protocol to use - */ - private Protocol protocol; - /** - * Transport to use - */ - private String transport; - /** - * Avro protocol location - */ - private String protocolLocation; - /** - * Avro protocol to use defined by the FQN class name - */ - private String protocolClassName; - /** - * The name of the message to send. - */ - private String messageName; - /** - * Authority to use (username and password) - */ - private String uriAuthority; - /** - * If protocol object provided is reflection protocol. Should be used only - * with protocol parameter because for protocolClassName protocol type will - * be auto detected - */ - private Boolean reflectionProtocol; - /** - * If true consumer parameter won't be wrapped into array. Will fail if - * protocol specifies more then 1 parameter for the message - */ - private Boolean singleParameter; + private AvroConfigurationNestedConfiguration configuration; - public AvroConfiguration getConfiguration() { + public AvroConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(AvroConfiguration configuration) { + public void setConfiguration( + AvroConfigurationNestedConfiguration configuration) { this.configuration = configuration; } - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public Protocol getProtocol() { - return protocol; - } - - public void setProtocol(Protocol protocol) { - this.protocol = protocol; - } - - public String getTransport() { - return transport; - } - - public void setTransport(String transport) { - this.transport = transport; - } - - public String getProtocolLocation() { - return protocolLocation; - } - - public void setProtocolLocation(String protocolLocation) { - this.protocolLocation = protocolLocation; - } - - public String getProtocolClassName() { - return protocolClassName; - } - - public void setProtocolClassName(String protocolClassName) { - this.protocolClassName = protocolClassName; - } - - public String getMessageName() { - return messageName; - } - - public void setMessageName(String messageName) { - this.messageName = messageName; - } - - public String getUriAuthority() { - return uriAuthority; - } - - public void setUriAuthority(String uriAuthority) { - this.uriAuthority = uriAuthority; - } - - public Boolean getReflectionProtocol() { - return reflectionProtocol; - } - - public void setReflectionProtocol(Boolean reflectionProtocol) { - this.reflectionProtocol = reflectionProtocol; - } - - public Boolean getSingleParameter() { - return singleParameter; - } - - public void setSingleParameter(Boolean singleParameter) { - this.singleParameter = singleParameter; + public static class AvroConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.avro.AvroConfiguration.class; + /** + * Hostname to use + */ + private String host; + /** + * Port number to use + */ + private Integer port; + /** + * Avro protocol to use + */ + @NestedConfigurationProperty + private Protocol protocol; + private AvroTransport transport; + /** + * Avro protocol location + */ + private String protocolLocation; + /** + * Avro protocol to use defined by the FQN class name + */ + private String protocolClassName; + /** + * The name of the message to send. + */ + private String messageName; + /** + * Authority to use (username and password) + */ + private String uriAuthority; + /** + * If protocol object provided is reflection protocol. Should be used + * only with protocol parameter because for protocolClassName protocol + * type will be auto detected + */ + private Boolean reflectionProtocol; + /** + * If true, consumer parameter won't be wrapped into array. Will fail if + * protocol specifies more then 1 parameter for the message + */ + private Boolean singleParameter; + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public Protocol getProtocol() { + return protocol; + } + + public void setProtocol(Protocol protocol) { + this.protocol = protocol; + } + + public AvroTransport getTransport() { + return transport; + } + + public void setTransport(AvroTransport transport) { + this.transport = transport; + } + + public String getProtocolLocation() { + return protocolLocation; + } + + public void setProtocolLocation(String protocolLocation) { + this.protocolLocation = protocolLocation; + } + + public String getProtocolClassName() { + return protocolClassName; + } + + public void setProtocolClassName(String protocolClassName) { + this.protocolClassName = protocolClassName; + } + + public String getMessageName() { + return messageName; + } + + public void setMessageName(String messageName) { + this.messageName = messageName; + } + + public String getUriAuthority() { + return uriAuthority; + } + + public void setUriAuthority(String uriAuthority) { + this.uriAuthority = uriAuthority; + } + + public Boolean getReflectionProtocol() { + return reflectionProtocol; + } + + public void setReflectionProtocol(Boolean reflectionProtocol) { + this.reflectionProtocol = reflectionProtocol; + } + + public Boolean getSingleParameter() { + return singleParameter; + } + + public void setSingleParameter(Boolean singleParameter) { + this.singleParameter = singleParameter; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java b/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java index d8007c3..b0cdb93 100644 --- a/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java +++ b/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class BeanstalkComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentConfiguration.java b/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentConfiguration.java index d0e4599..2fad057 100644 --- a/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentConfiguration.java +++ b/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentConfiguration.java @@ -18,6 +18,7 @@ package org.apache.camel.component.beanstalk.springboot; import org.apache.camel.component.beanstalk.ConnectionSettingsFactory; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * The beanstalk component is used for job retrieval and post-processing of @@ -33,6 +34,7 @@ public class BeanstalkComponentConfiguration { * to use to make connections to Beanstalkd. Especially useful for unit * testing without beanstalkd daemon (you can mock ConnectionSettings) */ + @NestedConfigurationProperty private ConnectionSettingsFactory connectionSettingsFactory; public ConnectionSettingsFactory getConnectionSettingsFactory() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java b/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java index d738c9e..efd45ed 100644 --- a/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java +++ b/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class BoxComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentConfiguration.java b/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentConfiguration.java index 2f84faa..7baa2fd 100644 --- a/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentConfiguration.java +++ b/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentConfiguration.java @@ -21,10 +21,10 @@ import com.box.boxjavalibv2.BoxConnectionManagerBuilder; import com.box.boxjavalibv2.IBoxConfig; import com.box.boxjavalibv2.authorization.IAuthSecureStorage; import com.box.boxjavalibv2.authorization.OAuthRefreshListener; -import org.apache.camel.component.box.BoxConfiguration; import org.apache.camel.component.box.internal.BoxApiName; import org.apache.camel.util.jsse.SSLContextParameters; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * For uploading downloading and managing files folders groups collaborations @@ -36,222 +36,233 @@ import org.springframework.boot.context.properties.ConfigurationProperties; public class BoxComponentConfiguration { /** - * To use the shared configuration. Properties of the shared configuration - * can also be set individually. + * To use the shared configuration */ - private BoxConfiguration configuration; - /** - * What kind of operation to perform - */ - private BoxApiName apiName; - /** - * What sub operation to use for the selected operation - */ - private String methodName; - /** - * Box application client ID - */ - private String clientId; - /** - * Box application client secret - */ - private String clientSecret; - /** - * OAuth Secure Storage callback can be used to provide and or save OAuth - * tokens. The callback may return null on first call to allow the component - * to login and authorize application and obtain an OAuth token which can - * then be saved in the secure storage. For the component to be able to - * create a token automatically a user password must be provided. - */ - private IAuthSecureStorage authSecureStorage; - /** - * Box user name MUST be provided - */ - private String userName; - /** - * Box user password MUST be provided if authSecureStorage is not set or - * returns null on first call - */ - private String userPassword; - /** - * OAuth listener for token updates if the Camel application needs to use - * the access token outside the route - */ - private OAuthRefreshListener refreshListener; - /** - * Flag to revoke OAuth refresh token on route shutdown default false. Will - * require a fresh refresh token on restart using either a custom - * IAuthSecureStorage or automatic component login by providing a user - * password - */ - private Boolean revokeOnShutdown; - /** - * Box shared link for shared endpoints can be a link for a shared comment - * file or folder - */ - private String sharedLink; - /** - * Password associated with the shared link MUST be provided with sharedLink - */ - private String sharedPassword; - /** - * Custom Box SDK configuration not required normally - */ - private IBoxConfig boxConfig; - /** - * Custom Box connection manager builder used to override default settings - * like max connections for underlying HttpClient. - */ - private BoxConnectionManagerBuilder connectionManagerBuilder; - /** - * Custom HTTP params for settings like proxy host - */ - private Map<String, Object> httpParams; - /** - * To configure security using SSLContextParameters. - */ - private SSLContextParameters sslContextParameters; - /** - * Amount of time the component will wait for a response from Box.com - * default is 30 seconds - */ - private Integer loginTimeout; + private BoxConfigurationNestedConfiguration configuration; - public BoxConfiguration getConfiguration() { + public BoxConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(BoxConfiguration configuration) { + public void setConfiguration( + BoxConfigurationNestedConfiguration configuration) { this.configuration = configuration; } - public BoxApiName getApiName() { - return apiName; - } - - public void setApiName(BoxApiName apiName) { - this.apiName = apiName; - } - - public String getMethodName() { - return methodName; - } - - public void setMethodName(String methodName) { - this.methodName = methodName; - } - - public String getClientId() { - return clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public String getClientSecret() { - return clientSecret; - } - - public void setClientSecret(String clientSecret) { - this.clientSecret = clientSecret; - } - - public IAuthSecureStorage getAuthSecureStorage() { - return authSecureStorage; - } - - public void setAuthSecureStorage(IAuthSecureStorage authSecureStorage) { - this.authSecureStorage = authSecureStorage; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserPassword() { - return userPassword; - } - - public void setUserPassword(String userPassword) { - this.userPassword = userPassword; - } - - public OAuthRefreshListener getRefreshListener() { - return refreshListener; - } - - public void setRefreshListener(OAuthRefreshListener refreshListener) { - this.refreshListener = refreshListener; - } - - public Boolean getRevokeOnShutdown() { - return revokeOnShutdown; - } - - public void setRevokeOnShutdown(Boolean revokeOnShutdown) { - this.revokeOnShutdown = revokeOnShutdown; - } - - public String getSharedLink() { - return sharedLink; - } - - public void setSharedLink(String sharedLink) { - this.sharedLink = sharedLink; - } - - public String getSharedPassword() { - return sharedPassword; - } - - public void setSharedPassword(String sharedPassword) { - this.sharedPassword = sharedPassword; - } - - public IBoxConfig getBoxConfig() { - return boxConfig; - } - - public void setBoxConfig(IBoxConfig boxConfig) { - this.boxConfig = boxConfig; - } - - public BoxConnectionManagerBuilder getConnectionManagerBuilder() { - return connectionManagerBuilder; - } - - public void setConnectionManagerBuilder( - BoxConnectionManagerBuilder connectionManagerBuilder) { - this.connectionManagerBuilder = connectionManagerBuilder; - } - - public Map<String, Object> getHttpParams() { - return httpParams; - } - - public void setHttpParams(Map<String, Object> httpParams) { - this.httpParams = httpParams; - } - - public SSLContextParameters getSslContextParameters() { - return sslContextParameters; - } - - public void setSslContextParameters( - SSLContextParameters sslContextParameters) { - this.sslContextParameters = sslContextParameters; - } - - public Integer getLoginTimeout() { - return loginTimeout; - } + public static class BoxConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.box.BoxConfiguration.class; + /** + * What kind of operation to perform + */ + private BoxApiName apiName; + /** + * What sub operation to use for the selected operation + */ + private String methodName; + /** + * Box application client ID + */ + private String clientId; + /** + * Box application client secret + */ + private String clientSecret; + /** + * OAuth Secure Storage callback, can be used to provide and or save + * OAuth tokens. The callback may return null on first call to allow the + * component to login and authorize application and obtain an OAuth + * token, which can then be saved in the secure storage. For the + * component to be able to create a token automatically a user password + * must be provided. + */ + @NestedConfigurationProperty + private IAuthSecureStorage authSecureStorage; + /** + * Box user name, MUST be provided + */ + private String userName; + /** + * Box user password, MUST be provided if authSecureStorage is not set, + * or returns null on first call + */ + private String userPassword; + /** + * OAuth listener for token updates, if the Camel application needs to + * use the access token outside the route + */ + @NestedConfigurationProperty + private OAuthRefreshListener refreshListener; + /** + * Flag to revoke OAuth refresh token on route shutdown, default false. + * Will require a fresh refresh token on restart using either a custom + * IAuthSecureStorage or automatic component login by providing a user + * password + */ + private Boolean revokeOnShutdown; + /** + * Box shared link for shared endpoints, can be a link for a shared + * comment, file or folder + */ + private String sharedLink; + /** + * Password associated with the shared link, MUST be provided with + * sharedLink + */ + private String sharedPassword; + /** + * Custom Box SDK configuration, not required normally + */ + @NestedConfigurationProperty + private IBoxConfig boxConfig; + /** + * Custom Box connection manager builder, used to override default + * settings like max connections for underlying HttpClient. + */ + @NestedConfigurationProperty + private BoxConnectionManagerBuilder connectionManagerBuilder; + /** + * Custom HTTP params for settings like proxy host + */ + private Map httpParams; + /** + * To configure security using SSLContextParameters. + */ + @NestedConfigurationProperty + private SSLContextParameters sslContextParameters; + /** + * Amount of time the component will wait for a response from Box.com, + * default is 30 seconds + */ + private Integer loginTimeout; + + public BoxApiName getApiName() { + return apiName; + } + + public void setApiName(BoxApiName apiName) { + this.apiName = apiName; + } + + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public IAuthSecureStorage getAuthSecureStorage() { + return authSecureStorage; + } + + public void setAuthSecureStorage(IAuthSecureStorage authSecureStorage) { + this.authSecureStorage = authSecureStorage; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserPassword() { + return userPassword; + } + + public void setUserPassword(String userPassword) { + this.userPassword = userPassword; + } + + public OAuthRefreshListener getRefreshListener() { + return refreshListener; + } + + public void setRefreshListener(OAuthRefreshListener refreshListener) { + this.refreshListener = refreshListener; + } + + public Boolean getRevokeOnShutdown() { + return revokeOnShutdown; + } + + public void setRevokeOnShutdown(Boolean revokeOnShutdown) { + this.revokeOnShutdown = revokeOnShutdown; + } + + public String getSharedLink() { + return sharedLink; + } + + public void setSharedLink(String sharedLink) { + this.sharedLink = sharedLink; + } + + public String getSharedPassword() { + return sharedPassword; + } + + public void setSharedPassword(String sharedPassword) { + this.sharedPassword = sharedPassword; + } + + public IBoxConfig getBoxConfig() { + return boxConfig; + } + + public void setBoxConfig(IBoxConfig boxConfig) { + this.boxConfig = boxConfig; + } + + public BoxConnectionManagerBuilder getConnectionManagerBuilder() { + return connectionManagerBuilder; + } - public void setLoginTimeout(Integer loginTimeout) { - this.loginTimeout = loginTimeout; + public void setConnectionManagerBuilder( + BoxConnectionManagerBuilder connectionManagerBuilder) { + this.connectionManagerBuilder = connectionManagerBuilder; + } + + public Map getHttpParams() { + return httpParams; + } + + public void setHttpParams(Map httpParams) { + this.httpParams = httpParams; + } + + public SSLContextParameters getSslContextParameters() { + return sslContextParameters; + } + + public void setSslContextParameters( + SSLContextParameters sslContextParameters) { + this.sslContextParameters = sslContextParameters; + } + + public Integer getLoginTimeout() { + return loginTimeout; + } + + public void setLoginTimeout(Integer loginTimeout) { + this.loginTimeout = loginTimeout; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java b/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java index 0d10ffa..50aa4ba 100644 --- a/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java +++ b/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class BraintreeComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component; http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java b/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java index 60f2b7f..b9d5832 100644 --- a/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java +++ b/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentConfiguration.java @@ -16,7 +16,8 @@ */ package org.apache.camel.component.braintree.springboot; -import org.apache.camel.component.braintree.BraintreeConfiguration; +import java.util.logging.Level; +import org.apache.camel.component.braintree.internal.BraintreeApiName; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -31,13 +32,150 @@ public class BraintreeComponentConfiguration { /** * To use the shared configuration */ - private BraintreeConfiguration configuration; + private BraintreeConfigurationNestedConfiguration configuration; - public BraintreeConfiguration getConfiguration() { + public BraintreeConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(BraintreeConfiguration configuration) { + public void setConfiguration( + BraintreeConfigurationNestedConfiguration configuration) { this.configuration = configuration; } + + public static class BraintreeConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.braintree.BraintreeConfiguration.class; + /** + * What kind of operation to perform + */ + private BraintreeApiName apiName; + /** + * What sub operation to use for the selected operation + */ + private String methodName; + /** + * The environment Either SANDBOX or PRODUCTION + */ + private String environment; + /** + * The merchant id provided by Braintree. + */ + private String merchantId; + /** + * The public key provided by Braintree. + */ + private String publicKey; + /** + * The private key provided by Braintree. + */ + private String privateKey; + /** + * The proxy host + */ + private String proxyHost; + /** + * The proxy port + */ + private Integer proxyPort; + /** + * Set logging level for http calls, @see java.util.logging.Level + */ + private Level httpLogLevel; + /** + * Set log category to use to log http calls, default "Braintree" + */ + private String httpLogName; + /** + * Set read timeout for http calls. + */ + private Integer httpReadTimeout; + + public BraintreeApiName getApiName() { + return apiName; + } + + public void setApiName(BraintreeApiName apiName) { + this.apiName = apiName; + } + + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public String getEnvironment() { + return environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + public String getMerchantId() { + return merchantId; + } + + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + public String getPrivateKey() { + return privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + public String getProxyHost() { + return proxyHost; + } + + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public Level getHttpLogLevel() { + return httpLogLevel; + } + + public void setHttpLogLevel(Level httpLogLevel) { + this.httpLogLevel = httpLogLevel; + } + + public String getHttpLogName() { + return httpLogName; + } + + public void setHttpLogName(String httpLogName) { + this.httpLogName = httpLogName; + } + + public Integer getHttpReadTimeout() { + return httpReadTimeout; + } + + public void setHttpReadTimeout(Integer httpReadTimeout) { + this.httpReadTimeout = httpReadTimeout; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java b/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java index 822c3f9..3ff3096 100644 --- a/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java +++ b/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class CacheComponentAutoConfiguration { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters); return component;