You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/05/22 12:03:45 UTC
[07/21] camel git commit: camel-spring-boot: improve customizer
configuration
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
index 1d1cba4..e3ec8e7 100644
--- a/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.netty4.http.NettyHttpComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class NettyHttpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(NettyHttpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private NettyHttpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<NettyHttpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private NettyHttpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class NettyHttpComponentAutoConfiguration {
NettyHttpComponent component = new NettyHttpComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class NettyHttpComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<NettyHttpComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.netty4-http.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.netty4-http.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
index 2e27d79..a415f70 100644
--- a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.netty4.NettyComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class NettyComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(NettyComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private NettyComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<NettyComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private NettyComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class NettyComponentAutoConfiguration {
NettyComponent component = new NettyComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class NettyComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<NettyComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.netty4.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.netty4.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
index 8d3954e..c09824d 100644
--- a/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.ognl.OgnlLanguage;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spi.LanguageCustomizer;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.LanguageConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -38,6 +40,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -58,13 +61,13 @@ public class OgnlLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(OgnlLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private OgnlLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<OgnlLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private OgnlLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class OgnlLanguageAutoConfiguration {
}
}
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(languageConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), language, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && languageConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (LanguageCustomizer<OgnlLanguage> customizer : customizers) {
- LOGGER.debug("Configure language {}, with customizer {}",
- language, customizer);
- customizer.customize(language);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.ognl.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.ognl.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure language {}, with customizer {}",
+ language, customizer);
+ customizer.customize(language);
+ }
}
}
return language;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
index 4c59541..33032cf 100644
--- a/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.olingo2.Olingo2Component;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class Olingo2ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Olingo2ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Olingo2ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<Olingo2Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private Olingo2ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class Olingo2ComponentAutoConfiguration {
Olingo2Component component = new Olingo2Component();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class Olingo2ComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<Olingo2Component> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.olingo2.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.olingo2.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
index 354bf87..b261cf1 100644
--- a/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.olingo4.Olingo4Component;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class Olingo4ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Olingo4ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Olingo4ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<Olingo4Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private Olingo4ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class Olingo4ComponentAutoConfiguration {
Olingo4Component component = new Olingo4Component();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class Olingo4ComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<Olingo4Component> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.olingo4.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.olingo4.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
index bd20eeb..2526982 100644
--- a/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openshift.OpenShiftComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class OpenShiftComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(OpenShiftComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private OpenShiftComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<OpenShiftComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private OpenShiftComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class OpenShiftComponentAutoConfiguration {
OpenShiftComponent component = new OpenShiftComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class OpenShiftComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<OpenShiftComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openshift.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openshift.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
index 318dea9..2a05b60 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.cinder.CinderComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class CinderComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CinderComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CinderComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CinderComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CinderComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CinderComponentAutoConfiguration {
CinderComponent component = new CinderComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class CinderComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<CinderComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-cinder.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-cinder.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
index b8a5e93..a158f59 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.glance.GlanceComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class GlanceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GlanceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GlanceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GlanceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GlanceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GlanceComponentAutoConfiguration {
GlanceComponent component = new GlanceComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class GlanceComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<GlanceComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-glance.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-glance.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
index b489575..8cfa07f 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.keystone.KeystoneComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class KeystoneComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KeystoneComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KeystoneComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KeystoneComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KeystoneComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class KeystoneComponentAutoConfiguration {
KeystoneComponent component = new KeystoneComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,24 @@ public class KeystoneComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<KeystoneComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-keystone.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-keystone.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
index 48e2ef0..ef2fb78 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.neutron.NeutronComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class NeutronComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(NeutronComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private NeutronComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<NeutronComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private NeutronComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class NeutronComponentAutoConfiguration {
NeutronComponent component = new NeutronComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class NeutronComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<NeutronComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-neutron.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-neutron.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
index 75a28bf..df6433f 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.nova.NovaComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class NovaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(NovaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private NovaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<NovaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private NovaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class NovaComponentAutoConfiguration {
NovaComponent component = new NovaComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class NovaComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<NovaComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-nova.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-nova.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
index dbb6212..95d1a84 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.swift.SwiftComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SwiftComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SwiftComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SwiftComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SwiftComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SwiftComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SwiftComponentAutoConfiguration {
SwiftComponent component = new SwiftComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SwiftComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SwiftComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-swift.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-swift.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
index aa3cb01..77aa270 100644
--- a/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.optaplanner.OptaPlannerComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class OptaPlannerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(OptaPlannerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private OptaPlannerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<OptaPlannerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private OptaPlannerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class OptaPlannerComponentAutoConfiguration {
OptaPlannerComponent component = new OptaPlannerComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class OptaPlannerComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<OptaPlannerComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.optaplanner.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.optaplanner.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
index 7c8c9c0..7624280 100644
--- a/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.paho.PahoComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class PahoComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PahoComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PahoComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PahoComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PahoComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PahoComponentAutoConfiguration {
PahoComponent component = new PahoComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class PahoComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<PahoComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.paho.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.paho.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
index 5744d96..0e0eda4 100644
--- a/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.pdf.PdfComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class PdfComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PdfComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PdfComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PdfComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PdfComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PdfComponentAutoConfiguration {
PdfComponent component = new PdfComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class PdfComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<PdfComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.pdf.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.pdf.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
index 9f81379..b0dd5c5 100644
--- a/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.pgevent.PgEventComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class PgEventComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PgEventComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PgEventComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PgEventComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PgEventComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PgEventComponentAutoConfiguration {
PgEventComponent component = new PgEventComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class PgEventComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<PgEventComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.pgevent.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.pgevent.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;