http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java index 03c9496..b6adb12 100644 --- a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java +++ b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class DisruptorComponentAutoConfiguration { 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-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java index 44a630e..3cb6920 100644 --- a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java +++ b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class DisruptorVmComponentAutoConfiguration { 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-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java b/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java index e38632b..df2dc17 100644 --- a/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java +++ b/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class DockerComponentAutoConfiguration { 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-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentConfiguration.java b/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentConfiguration.java index b430775..208fe0a 100644 --- a/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentConfiguration.java +++ b/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentConfiguration.java @@ -16,7 +16,8 @@ */ package org.apache.camel.component.docker.springboot; -import org.apache.camel.component.docker.DockerConfiguration; +import java.util.Map; +import org.apache.camel.component.docker.DockerOperation; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -28,16 +29,224 @@ import org.springframework.boot.context.properties.ConfigurationProperties; public class DockerComponentConfiguration { /** - * To use the shared docker configuration. Properties of the shared - * configuration can also be set individually. + * To use the shared docker configuration */ - private DockerConfiguration configuration; + private DockerConfigurationNestedConfiguration configuration; - public DockerConfiguration getConfiguration() { + public DockerConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(DockerConfiguration configuration) { + public void setConfiguration( + DockerConfigurationNestedConfiguration configuration) { this.configuration = configuration; } + + public static class DockerConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.docker.DockerConfiguration.class; + /** + * Docker host + */ + private String host = "localhost"; + /** + * Docker port + */ + private Integer port; + /** + * User name to authenticate with + */ + private String username; + /** + * Password to authenticate with + */ + private String password; + /** + * Email address associated with the user + */ + private String email; + /** + * Server address for docker registry. + */ + private String serverAddress = "https://index.docker.io/v1/"; + /** + * Request timeout for response (in seconds) + */ + private Integer requestTimeout; + /** + * Use HTTPS communication + */ + private Boolean secure; + /** + * Location containing the SSL certificate chain + */ + private String certPath; + /** + * Maximum total connections + */ + private Integer maxTotalConnections; + /** + * Maximum route connections + */ + private Integer maxPerRouteConnections; + /** + * Whether to use logging filter + */ + private Boolean loggingFilter; + /** + * Whether to follow redirect filter + */ + private Boolean followRedirectFilter; + /** + * Additional configuration parameters as key/value pairs + */ + private Map parameters; + /** + * Which operation to use + */ + private DockerOperation operation; + /** + * Check TLS + */ + private Boolean tlsVerify; + /** + * Socket connection mode + */ + private Boolean socket; + + 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 String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getServerAddress() { + return serverAddress; + } + + public void setServerAddress(String serverAddress) { + this.serverAddress = serverAddress; + } + + public Integer getRequestTimeout() { + return requestTimeout; + } + + public void setRequestTimeout(Integer requestTimeout) { + this.requestTimeout = requestTimeout; + } + + public Boolean getSecure() { + return secure; + } + + public void setSecure(Boolean secure) { + this.secure = secure; + } + + public String getCertPath() { + return certPath; + } + + public void setCertPath(String certPath) { + this.certPath = certPath; + } + + public Integer getMaxTotalConnections() { + return maxTotalConnections; + } + + public void setMaxTotalConnections(Integer maxTotalConnections) { + this.maxTotalConnections = maxTotalConnections; + } + + public Integer getMaxPerRouteConnections() { + return maxPerRouteConnections; + } + + public void setMaxPerRouteConnections(Integer maxPerRouteConnections) { + this.maxPerRouteConnections = maxPerRouteConnections; + } + + public Boolean getLoggingFilter() { + return loggingFilter; + } + + public void setLoggingFilter(Boolean loggingFilter) { + this.loggingFilter = loggingFilter; + } + + public Boolean getFollowRedirectFilter() { + return followRedirectFilter; + } + + public void setFollowRedirectFilter(Boolean followRedirectFilter) { + this.followRedirectFilter = followRedirectFilter; + } + + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + public DockerOperation getOperation() { + return operation; + } + + public void setOperation(DockerOperation operation) { + this.operation = operation; + } + + public Boolean getTlsVerify() { + return tlsVerify; + } + + public void setTlsVerify(Boolean tlsVerify) { + this.tlsVerify = tlsVerify; + } + + public Boolean getSocket() { + return socket; + } + + public void setSocket(Boolean socket) { + this.socket = socket; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java b/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java index 24ddc95..64936bb 100644 --- a/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java +++ b/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class EjbComponentAutoConfiguration { 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-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java b/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java index 3688285..7c0cc5c 100644 --- a/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java +++ b/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class ElasticsearchComponentAutoConfiguration { 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-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentConfiguration.java b/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentConfiguration.java index c375745..40e9374 100644 --- a/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentConfiguration.java +++ b/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentConfiguration.java @@ -18,6 +18,7 @@ package org.apache.camel.component.elasticsearch.springboot; import org.elasticsearch.client.Client; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * The elasticsearch component is used for interfacing with ElasticSearch @@ -32,6 +33,7 @@ public class ElasticsearchComponentConfiguration { * To use an existing configured Elasticsearch client instead of creating a * client per endpoint. */ + @NestedConfigurationProperty private Client client; public Client getClient() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java b/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java index bccf07f..41826d3 100644 --- a/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java +++ b/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class ElsqlComponentAutoConfiguration { 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-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentConfiguration.java b/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentConfiguration.java index c36b95e..f849121 100644 --- a/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentConfiguration.java +++ b/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentConfiguration.java @@ -20,6 +20,7 @@ import javax.sql.DataSource; import com.opengamma.elsql.ElSqlConfig; import org.apache.camel.component.elsql.ElSqlDatabaseVendor; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * The elsql component is an extension to the existing SQL Component that uses @@ -42,6 +43,7 @@ public class ElsqlComponentConfiguration { * To use a specific configured ElSqlConfig. It may be better to use the * databaseVendor option instead. */ + @NestedConfigurationProperty private ElSqlConfig elSqlConfig; /** * The resource file which contains the elsql SQL statements to use. You can http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java b/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java index 989a2bc..369ee37 100644 --- a/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java +++ b/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class FacebookComponentAutoConfiguration { 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-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentConfiguration.java b/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentConfiguration.java index 850b557..96976cd 100644 --- a/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentConfiguration.java +++ b/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentConfiguration.java @@ -16,7 +16,6 @@ */ package org.apache.camel.component.facebook.springboot; -import org.apache.camel.component.facebook.config.FacebookConfiguration; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -31,13 +30,344 @@ public class FacebookComponentConfiguration { /** * To use the shared configuration */ - private FacebookConfiguration configuration; + private FacebookConfigurationNestedConfiguration configuration; - public FacebookConfiguration getConfiguration() { + public FacebookConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(FacebookConfiguration configuration) { + public void setConfiguration( + FacebookConfigurationNestedConfiguration configuration) { this.configuration = configuration; } + + public static class FacebookConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.facebook.config.FacebookConfiguration.class; + /** + * The user access token + */ + private String oAuthAccessToken; + /** + * OAuth access token URL + */ + private String oAuthAccessTokenURL = "https://graph.facebook.com/oauth/access_token"; + /** + * The application Id + */ + private String oAuthAppId; + /** + * The application Secret + */ + private String oAuthAppSecret; + /** + * OAuth authorization URL + */ + private String oAuthAuthorizationURL = "https://www.facebook.com/dialog/oauth"; + /** + * Facebook4J API client URL + */ + private String clientURL; + /** + * Facebook4J client API version + */ + private String clientVersion; + /** + * Enables deubg output. Effective only with the embedded logger + */ + private Boolean debugEnabled; + /** + * Use Facebook GZIP encoding + */ + private Boolean gzipEnabled; + /** + * Http connection timeout in milliseconds + */ + private Integer httpConnectionTimeout; + /** + * HTTP maximum connections per route + */ + private Integer httpDefaultMaxPerRoute; + /** + * HTTP maximum total connections + */ + private Integer httpMaxTotalConnections; + /** + * HTTP proxy server host name + */ + private String httpProxyHost; + /** + * HTTP proxy server password + */ + private String httpProxyPassword; + /** + * HTTP proxy server port + */ + private Integer httpProxyPort; + /** + * HTTP proxy server user name + */ + private String httpProxyUser; + /** + * Http read timeout in milliseconds + */ + private Integer httpReadTimeout; + /** + * Number of HTTP retries + */ + private Integer httpRetryCount; + /** + * HTTP retry interval in seconds + */ + private Integer httpRetryIntervalSeconds; + /** + * HTTP streaming read timeout in milliseconds + */ + private Integer httpStreamingReadTimeout; + /** + * If set to true, raw JSON forms will be stored in DataObjectFactory + */ + private Boolean jsonStoreEnabled; + /** + * If set to true, Facebook4J mbean will be registerd + */ + private Boolean mbeanEnabled; + /** + * Default OAuth permissions. Comma separated permission names. See + * https://developers.facebook.com/docs/reference/login/#permissions for + * the detail + */ + private String oAuthPermissions; + /** + * Prettify JSON debug output if set to true + */ + private Boolean prettyDebugEnabled; + /** + * API base URL + */ + private String restBaseURL = "https://graph.facebook.com/"; + /** + * Use SSL + */ + private Boolean useSSL; + /** + * Video API base URL + */ + private String videoBaseURL = "https://graph-video.facebook.com/"; + + public String getOAuthAccessToken() { + return oAuthAccessToken; + } + + public void setOAuthAccessToken(String oAuthAccessToken) { + this.oAuthAccessToken = oAuthAccessToken; + } + + public String getOAuthAccessTokenURL() { + return oAuthAccessTokenURL; + } + + public void setOAuthAccessTokenURL(String oAuthAccessTokenURL) { + this.oAuthAccessTokenURL = oAuthAccessTokenURL; + } + + public String getOAuthAppId() { + return oAuthAppId; + } + + public void setOAuthAppId(String oAuthAppId) { + this.oAuthAppId = oAuthAppId; + } + + public String getOAuthAppSecret() { + return oAuthAppSecret; + } + + public void setOAuthAppSecret(String oAuthAppSecret) { + this.oAuthAppSecret = oAuthAppSecret; + } + + public String getOAuthAuthorizationURL() { + return oAuthAuthorizationURL; + } + + public void setOAuthAuthorizationURL(String oAuthAuthorizationURL) { + this.oAuthAuthorizationURL = oAuthAuthorizationURL; + } + + public String getClientURL() { + return clientURL; + } + + public void setClientURL(String clientURL) { + this.clientURL = clientURL; + } + + public String getClientVersion() { + return clientVersion; + } + + public void setClientVersion(String clientVersion) { + this.clientVersion = clientVersion; + } + + public Boolean getDebugEnabled() { + return debugEnabled; + } + + public void setDebugEnabled(Boolean debugEnabled) { + this.debugEnabled = debugEnabled; + } + + public Boolean getGzipEnabled() { + return gzipEnabled; + } + + public void setGzipEnabled(Boolean gzipEnabled) { + this.gzipEnabled = gzipEnabled; + } + + public Integer getHttpConnectionTimeout() { + return httpConnectionTimeout; + } + + public void setHttpConnectionTimeout(Integer httpConnectionTimeout) { + this.httpConnectionTimeout = httpConnectionTimeout; + } + + public Integer getHttpDefaultMaxPerRoute() { + return httpDefaultMaxPerRoute; + } + + public void setHttpDefaultMaxPerRoute(Integer httpDefaultMaxPerRoute) { + this.httpDefaultMaxPerRoute = httpDefaultMaxPerRoute; + } + + public Integer getHttpMaxTotalConnections() { + return httpMaxTotalConnections; + } + + public void setHttpMaxTotalConnections(Integer httpMaxTotalConnections) { + this.httpMaxTotalConnections = httpMaxTotalConnections; + } + + public String getHttpProxyHost() { + return httpProxyHost; + } + + public void setHttpProxyHost(String httpProxyHost) { + this.httpProxyHost = httpProxyHost; + } + + public String getHttpProxyPassword() { + return httpProxyPassword; + } + + public void setHttpProxyPassword(String httpProxyPassword) { + this.httpProxyPassword = httpProxyPassword; + } + + public Integer getHttpProxyPort() { + return httpProxyPort; + } + + public void setHttpProxyPort(Integer httpProxyPort) { + this.httpProxyPort = httpProxyPort; + } + + public String getHttpProxyUser() { + return httpProxyUser; + } + + public void setHttpProxyUser(String httpProxyUser) { + this.httpProxyUser = httpProxyUser; + } + + public Integer getHttpReadTimeout() { + return httpReadTimeout; + } + + public void setHttpReadTimeout(Integer httpReadTimeout) { + this.httpReadTimeout = httpReadTimeout; + } + + public Integer getHttpRetryCount() { + return httpRetryCount; + } + + public void setHttpRetryCount(Integer httpRetryCount) { + this.httpRetryCount = httpRetryCount; + } + + public Integer getHttpRetryIntervalSeconds() { + return httpRetryIntervalSeconds; + } + + public void setHttpRetryIntervalSeconds(Integer httpRetryIntervalSeconds) { + this.httpRetryIntervalSeconds = httpRetryIntervalSeconds; + } + + public Integer getHttpStreamingReadTimeout() { + return httpStreamingReadTimeout; + } + + public void setHttpStreamingReadTimeout(Integer httpStreamingReadTimeout) { + this.httpStreamingReadTimeout = httpStreamingReadTimeout; + } + + public Boolean getJsonStoreEnabled() { + return jsonStoreEnabled; + } + + public void setJsonStoreEnabled(Boolean jsonStoreEnabled) { + this.jsonStoreEnabled = jsonStoreEnabled; + } + + public Boolean getMbeanEnabled() { + return mbeanEnabled; + } + + public void setMbeanEnabled(Boolean mbeanEnabled) { + this.mbeanEnabled = mbeanEnabled; + } + + public String getOAuthPermissions() { + return oAuthPermissions; + } + + public void setOAuthPermissions(String oAuthPermissions) { + this.oAuthPermissions = oAuthPermissions; + } + + public Boolean getPrettyDebugEnabled() { + return prettyDebugEnabled; + } + + public void setPrettyDebugEnabled(Boolean prettyDebugEnabled) { + this.prettyDebugEnabled = prettyDebugEnabled; + } + + public String getRestBaseURL() { + return restBaseURL; + } + + public void setRestBaseURL(String restBaseURL) { + this.restBaseURL = restBaseURL; + } + + public Boolean getUseSSL() { + return useSSL; + } + + public void setUseSSL(Boolean useSSL) { + this.useSSL = useSSL; + } + + public String getVideoBaseURL() { + return videoBaseURL; + } + + public void setVideoBaseURL(String videoBaseURL) { + this.videoBaseURL = videoBaseURL; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java b/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java index d1470be..03ee5b1 100644 --- a/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java +++ b/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java @@ -44,6 +44,26 @@ public class FlinkComponentAutoConfiguration { 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-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentConfiguration.java b/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentConfiguration.java index 6e25062..c3fb039 100644 --- a/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentConfiguration.java +++ b/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentConfiguration.java @@ -21,6 +21,7 @@ import org.apache.camel.component.flink.DataStreamCallback; import org.apache.flink.api.java.DataSet; import org.apache.flink.streaming.api.datastream.DataStream; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * The flink component can be used to send DataSet jobs to Apache Flink cluster. @@ -33,18 +34,22 @@ public class FlinkComponentConfiguration { /** * DataSet to compute against. */ + @NestedConfigurationProperty private DataSet dataSet; /** * DataStream to compute against. */ + @NestedConfigurationProperty private DataStream dataStream; /** * Function performing action against a DataSet. */ + @NestedConfigurationProperty private DataSetCallback dataSetCallback; /** * Function performing action against a DataStream. */ + @NestedConfigurationProperty private DataStreamCallback dataStreamCallback; public DataSet getDataSet() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java index d7f98b3..dbecf5a 100644 --- a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java +++ b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class FreemarkerComponentAutoConfiguration { 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-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java index a03cf42..5b08f2d 100644 --- a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java +++ b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentConfiguration.java @@ -18,6 +18,7 @@ package org.apache.camel.component.freemarker.springboot; import freemarker.template.Configuration; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * Transforms the message using a FreeMarker template. @@ -31,6 +32,7 @@ public class FreemarkerComponentConfiguration { * To use an existing freemarker.template.Configuration instance as the * configuration. */ + @NestedConfigurationProperty private Configuration configuration; public Configuration getConfiguration() { http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java b/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java index 0bf0507..7d25ac7 100644 --- a/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java +++ b/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class GangliaComponentAutoConfiguration { 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-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentConfiguration.java b/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentConfiguration.java index 91442e5..98fa94a 100644 --- a/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentConfiguration.java +++ b/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentConfiguration.java @@ -19,7 +19,7 @@ package org.apache.camel.component.ganglia.springboot; import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode; import info.ganglia.gmetric4j.gmetric.GMetricSlope; import info.ganglia.gmetric4j.gmetric.GMetricType; -import org.apache.camel.component.ganglia.GangliaConfiguration; +import org.apache.camel.component.ganglia.GangliaComponent; import org.springframework.boot.context.properties.ConfigurationProperties; /** @@ -32,190 +32,194 @@ import org.springframework.boot.context.properties.ConfigurationProperties; public class GangliaComponentConfiguration { /** - * To use the shared configuration. Properties of the shared configuration - * can also be set individually. + * To use the shared configuration */ - private GangliaConfiguration configuration; - /** - * Host name for Ganglia server - */ - private String host; - /** - * Port for Ganglia server - */ - private Integer port; - /** - * Send the UDP metric packets using MULTICAST or UNICAST - */ - private UDPAddressingMode mode; - /** - * If using multicast set the TTL of the packets - */ - private Integer ttl; - /** - * Use the wire format of Ganglia 3.1.0 and later versions. Set this to - * false to use Ganglia 3.0.x or earlier. - */ - private Boolean wireFormat31x; - /** - * Spoofing information IP:hostname - */ - private String spoofHostname; - /** - * The group that the metric belongs to. - */ - private String groupName; - /** - * Prefix the metric name with this string and an underscore. - */ - private String prefix; - /** - * The name to use for the metric. - */ - private String metricName; - /** - * The type of value - */ - private GMetricType type; - /** - * The slope - */ - private GMetricSlope slope; - /** - * Any unit of measurement that qualifies the metric e.g. widgets litres - * bytes. Do not include a prefix such as k (kilo) or m (milli) other tools - * may scale the units later. The value should be unscaled. - */ - private String units; - /** - * Maximum time in seconds that the value can be considered current. After - * this Ganglia considers the value to have expired. - */ - private Integer tmax; - /** - * Minumum time in seconds before Ganglia will purge the metric value if it - * expires. Set to 0 and the value will remain in Ganglia indefinitely until - * a gmond agent restart. - */ - private Integer dmax; + private GangliaConfigurationNestedConfiguration configuration; - public GangliaConfiguration getConfiguration() { + public GangliaConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(GangliaConfiguration configuration) { + public void setConfiguration( + GangliaConfigurationNestedConfiguration 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 static class GangliaConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.ganglia.GangliaConfiguration.class; + /** + * Host name for Ganglia server + */ + private String host = "DEFAULT_DESTINATION"; + /** + * Port for Ganglia server + */ + private Integer port; + /** + * Send the UDP metric packets using MULTICAST or UNICAST + */ + private UDPAddressingMode mode = UDPAddressingMode.MULTICAST; + /** + * If using multicast, set the TTL of the packets + */ + private Integer ttl; + /** + * Use the wire format of Ganglia 3.1.0 and later versions. Set this to + * false to use Ganglia 3.0.x or earlier. + */ + private Boolean wireFormat31x; + /** + * Spoofing information IP:hostname + */ + private String spoofHostname; + /** + * The group that the metric belongs to. + */ + private String groupName = "java"; + /** + * Prefix the metric name with this string and an underscore. + */ + private String prefix; + /** + * The name to use for the metric. + */ + private String metricName = "metric"; + /** + * The type of value + */ + private GMetricType type = GMetricType.STRING; + /** + * The slope + */ + private GMetricSlope slope = GMetricSlope.BOTH; + /** + * Any unit of measurement that qualifies the metric, e.g. widgets, + * litres, bytes. Do not include a prefix such as k (kilo) or m (milli), + * other tools may scale the units later. The value should be unscaled. + */ + private String units; + /** + * Maximum time in seconds that the value can be considered current. + * After this, Ganglia considers the value to have expired. + */ + private Integer tmax; + /** + * Minumum time in seconds before Ganglia will purge the metric value if + * it expires. Set to 0 and the value will remain in Ganglia + * indefinitely until a gmond agent restart. + */ + private Integer dmax; + + 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 UDPAddressingMode getMode() { + return mode; + } + + public void setMode(UDPAddressingMode mode) { + this.mode = mode; + } + + public Integer getTtl() { + return ttl; + } + + public void setTtl(Integer ttl) { + this.ttl = ttl; + } + + public Boolean getWireFormat31x() { + return wireFormat31x; + } + + public void setWireFormat31x(Boolean wireFormat31x) { + this.wireFormat31x = wireFormat31x; + } + + public String getSpoofHostname() { + return spoofHostname; + } + + public void setSpoofHostname(String spoofHostname) { + this.spoofHostname = spoofHostname; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public String getMetricName() { + return metricName; + } + + public void setMetricName(String metricName) { + this.metricName = metricName; + } + + public GMetricType getType() { + return type; + } + + public void setType(GMetricType type) { + this.type = type; + } + + public GMetricSlope getSlope() { + return slope; + } + + public void setSlope(GMetricSlope slope) { + this.slope = slope; + } + + public String getUnits() { + return units; + } + + public void setUnits(String units) { + this.units = units; + } + + public Integer getTmax() { + return tmax; + } - public UDPAddressingMode getMode() { - return mode; - } - - public void setMode(UDPAddressingMode mode) { - this.mode = mode; - } - - public Integer getTtl() { - return ttl; - } + public void setTmax(Integer tmax) { + this.tmax = tmax; + } - public void setTtl(Integer ttl) { - this.ttl = ttl; - } - - public Boolean getWireFormat31x() { - return wireFormat31x; - } - - public void setWireFormat31x(Boolean wireFormat31x) { - this.wireFormat31x = wireFormat31x; - } - - public String getSpoofHostname() { - return spoofHostname; - } - - public void setSpoofHostname(String spoofHostname) { - this.spoofHostname = spoofHostname; - } - - public String getGroupName() { - return groupName; - } - - public void setGroupName(String groupName) { - this.groupName = groupName; - } - - public String getPrefix() { - return prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public String getMetricName() { - return metricName; - } - - public void setMetricName(String metricName) { - this.metricName = metricName; - } - - public GMetricType getType() { - return type; - } - - public void setType(GMetricType type) { - this.type = type; - } - - public GMetricSlope getSlope() { - return slope; - } - - public void setSlope(GMetricSlope slope) { - this.slope = slope; - } - - public String getUnits() { - return units; - } - - public void setUnits(String units) { - this.units = units; - } - - public Integer getTmax() { - return tmax; - } - - public void setTmax(Integer tmax) { - this.tmax = tmax; - } - - public Integer getDmax() { - return dmax; - } + public Integer getDmax() { + return dmax; + } - public void setDmax(Integer dmax) { - this.dmax = dmax; + public void setDmax(Integer dmax) { + this.dmax = dmax; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java b/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java index 093c87f..6cd5190 100644 --- a/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java +++ b/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java @@ -46,6 +46,26 @@ public class GoogleCalendarComponentAutoConfiguration { 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-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentConfiguration.java b/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentConfiguration.java index ebc6f52..d7dce80 100644 --- a/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentConfiguration.java +++ b/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentConfiguration.java @@ -16,9 +16,11 @@ */ package org.apache.camel.component.google.calendar.springboot; +import java.util.List; import org.apache.camel.component.google.calendar.GoogleCalendarClientFactory; -import org.apache.camel.component.google.calendar.GoogleCalendarConfiguration; +import org.apache.camel.component.google.calendar.internal.GoogleCalendarApiName; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * The google-calendar component provides access to Google Calendar. @@ -31,18 +33,20 @@ public class GoogleCalendarComponentConfiguration { /** * To use the shared configuration */ - private GoogleCalendarConfiguration configuration; + private GoogleCalendarConfigurationNestedConfiguration configuration; /** * To use the GoogleCalendarClientFactory as factory for creating the * client. Will by default use BatchGoogleCalendarClientFactory */ + @NestedConfigurationProperty private GoogleCalendarClientFactory clientFactory; - public GoogleCalendarConfiguration getConfiguration() { + public GoogleCalendarConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(GoogleCalendarConfiguration configuration) { + public void setConfiguration( + GoogleCalendarConfigurationNestedConfiguration configuration) { this.configuration = configuration; } @@ -53,4 +57,149 @@ public class GoogleCalendarComponentConfiguration { public void setClientFactory(GoogleCalendarClientFactory clientFactory) { this.clientFactory = clientFactory; } + + public static class GoogleCalendarConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.google.calendar.GoogleCalendarConfiguration.class; + /** + * What kind of operation to perform + */ + private GoogleCalendarApiName apiName; + /** + * What sub operation to use for the selected operation + */ + private String methodName; + /** + * Client ID of the calendar application + */ + private String clientId; + /** + * The emailAddress of the Google Service Account. + */ + private String emailAddress; + /** + * Client secret of the calendar application + */ + private String clientSecret; + /** + * OAuth 2 access token. This typically expires after an hour so + * refreshToken is recommended for long term usage. + */ + private String accessToken; + /** + * OAuth 2 refresh token. Using this, the Google Calendar component can + * obtain a new accessToken whenever the current one expires - a + * necessity if the application is long-lived. + */ + private String refreshToken; + /** + * Google calendar application name. Example would be + * "camel-google-calendar/1.0" + */ + private String applicationName; + /** + * Specifies the level of permissions you want a calendar application to + * have to a user account. See + * https://developers.google.com/google-apps/calendar/auth for more + * info. + */ + private List scopes; + /** + * The name of the p12 file which has the private key to use with the + * Google Service Account. + */ + private String p12FileName; + /** + * The email address of the user the application is trying to + * impersonate in the service account flow + */ + private String user; + + public GoogleCalendarApiName getApiName() { + return apiName; + } + + public void setApiName(GoogleCalendarApiName 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 getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + public String getApplicationName() { + return applicationName; + } + + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + + public String getP12FileName() { + return p12FileName; + } + + public void setP12FileName(String p12FileName) { + this.p12FileName = p12FileName; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java b/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java index d42c3c4..47b8e6e 100644 --- a/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java +++ b/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class GoogleDriveComponentAutoConfiguration { 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-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentConfiguration.java b/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentConfiguration.java index bad8424..e67692f 100644 --- a/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentConfiguration.java +++ b/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentConfiguration.java @@ -16,9 +16,11 @@ */ package org.apache.camel.component.google.drive.springboot; +import java.util.List; import org.apache.camel.component.google.drive.GoogleDriveClientFactory; -import org.apache.camel.component.google.drive.GoogleDriveConfiguration; +import org.apache.camel.component.google.drive.internal.GoogleDriveApiName; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * The google-drive component provides access to Google Drive file storage @@ -32,18 +34,20 @@ public class GoogleDriveComponentConfiguration { /** * To use the shared configuration */ - private GoogleDriveConfiguration configuration; + private GoogleDriveConfigurationNestedConfiguration configuration; /** * To use the GoogleCalendarClientFactory as factory for creating the * client. Will by default use BatchGoogleDriveClientFactory */ + @NestedConfigurationProperty private GoogleDriveClientFactory clientFactory; - public GoogleDriveConfiguration getConfiguration() { + public GoogleDriveConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(GoogleDriveConfiguration configuration) { + public void setConfiguration( + GoogleDriveConfigurationNestedConfiguration configuration) { this.configuration = configuration; } @@ -54,4 +58,110 @@ public class GoogleDriveComponentConfiguration { public void setClientFactory(GoogleDriveClientFactory clientFactory) { this.clientFactory = clientFactory; } + + public static class GoogleDriveConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.google.drive.GoogleDriveConfiguration.class; + /** + * What kind of operation to perform + */ + private GoogleDriveApiName apiName; + /** + * What sub operation to use for the selected operation + */ + private String methodName; + /** + * Client ID of the drive application + */ + private String clientId; + /** + * Client secret of the drive application + */ + private String clientSecret; + /** + * OAuth 2 access token. This typically expires after an hour so + * refreshToken is recommended for long term usage. + */ + private String accessToken; + /** + * OAuth 2 refresh token. Using this, the Google Calendar component can + * obtain a new accessToken whenever the current one expires - a + * necessity if the application is long-lived. + */ + private String refreshToken; + /** + * Google drive application name. Example would be + * "camel-google-drive/1.0" + */ + private String applicationName; + /** + * Specifies the level of permissions you want a drive application to + * have to a user account. See + * https://developers.google.com/drive/web/scopes for more info. + */ + private List scopes; + + public GoogleDriveApiName getApiName() { + return apiName; + } + + public void setApiName(GoogleDriveApiName 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 String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + public String getApplicationName() { + return applicationName; + } + + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java b/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java index ef72fd8..7cfac41 100644 --- a/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java +++ b/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class GoogleMailComponentAutoConfiguration { 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-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentConfiguration.java b/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentConfiguration.java index 06918ec..9e33cc1 100644 --- a/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentConfiguration.java +++ b/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentConfiguration.java @@ -16,9 +16,11 @@ */ package org.apache.camel.component.google.mail.springboot; +import java.util.List; import org.apache.camel.component.google.mail.GoogleMailClientFactory; -import org.apache.camel.component.google.mail.GoogleMailConfiguration; +import org.apache.camel.component.google.mail.internal.GoogleMailApiName; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; /** * The google-mail component provides access to Google Mail. @@ -31,18 +33,20 @@ public class GoogleMailComponentConfiguration { /** * To use the shared configuration */ - private GoogleMailConfiguration configuration; + private GoogleMailConfigurationNestedConfiguration configuration; /** * To use the GoogleCalendarClientFactory as factory for creating the * client. Will by default use BatchGoogleMailClientFactory */ + @NestedConfigurationProperty private GoogleMailClientFactory clientFactory; - public GoogleMailConfiguration getConfiguration() { + public GoogleMailConfigurationNestedConfiguration getConfiguration() { return configuration; } - public void setConfiguration(GoogleMailConfiguration configuration) { + public void setConfiguration( + GoogleMailConfigurationNestedConfiguration configuration) { this.configuration = configuration; } @@ -53,4 +57,110 @@ public class GoogleMailComponentConfiguration { public void setClientFactory(GoogleMailClientFactory clientFactory) { this.clientFactory = clientFactory; } + + public static class GoogleMailConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.google.mail.GoogleMailConfiguration.class; + /** + * What kind of operation to perform + */ + private GoogleMailApiName apiName; + /** + * What sub operation to use for the selected operation + */ + private String methodName; + /** + * Client ID of the mail application + */ + private String clientId; + /** + * Client secret of the mail application + */ + private String clientSecret; + /** + * OAuth 2 access token. This typically expires after an hour so + * refreshToken is recommended for long term usage. + */ + private String accessToken; + /** + * OAuth 2 refresh token. Using this, the Google Calendar component can + * obtain a new accessToken whenever the current one expires - a + * necessity if the application is long-lived. + */ + private String refreshToken; + /** + * Google mail application name. Example would be + * "camel-google-mail/1.0" + */ + private String applicationName; + /** + * Specifies the level of permissions you want a mail application to + * have to a user account. See + * https://developers.google.com/gmail/api/auth/scopes for more info. + */ + private List scopes; + + public GoogleMailApiName getApiName() { + return apiName; + } + + public void setApiName(GoogleMailApiName 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 String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + public String getApplicationName() { + return applicationName; + } + + public void setApplicationName(String applicationName) { + this.applicationName = applicationName; + } + + public List getScopes() { + return scopes; + } + + public void setScopes(List scopes) { + this.scopes = scopes; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d485f2f0/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java b/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java index 140c1e7..636a8c6 100644 --- a/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java +++ b/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java @@ -45,6 +45,26 @@ public class GuavaEventBusComponentAutoConfiguration { 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;