http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java index 1f3923d..cb5f003 100644 --- a/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jcache.JCacheComponent; 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 JCacheComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JCacheComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JCacheComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JCacheComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JCacheComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JCacheComponentAutoConfiguration { JCacheComponent component = new JCacheComponent(); 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 JCacheComponentAutoConfiguration { } 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<JCacheComponent> 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.jcache.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jcache.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-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java index fdbdde9..3d22115 100644 --- a/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jcr.JcrComponent; 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 JcrComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JcrComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JcrComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JcrComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JcrComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JcrComponentAutoConfiguration { JcrComponent component = new JcrComponent(); 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 JcrComponentAutoConfiguration { } 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<JcrComponent> 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.jcr.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jcr.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-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java index 99f4158..ba80a20 100644 --- a/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jdbc.JdbcComponent; 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 JdbcComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JdbcComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JdbcComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JdbcComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JdbcComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JdbcComponentAutoConfiguration { JdbcComponent component = new JdbcComponent(); 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 JdbcComponentAutoConfiguration { } 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<JdbcComponent> 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.jdbc.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jdbc.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-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java index e335bd9..daf7cf4 100644 --- a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java +++ b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jetty9.JettyHttpComponent9; 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 JettyHttpComponentAutoConfiguration9 { private static final Logger LOGGER = LoggerFactory .getLogger(JettyHttpComponentAutoConfiguration9.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JettyHttpComponentConfiguration9 configuration; @Autowired(required = false) private List<ComponentCustomizer<JettyHttpComponent9>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JettyHttpComponentConfiguration9 componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JettyHttpComponentAutoConfiguration9 { JettyHttpComponent9 component = new JettyHttpComponent9(); 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 JettyHttpComponentAutoConfiguration9 { } 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<JettyHttpComponent9> 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.jetty.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jetty.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-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java index d630246..93556af 100644 --- a/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jgroups.JGroupsComponent; 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 JGroupsComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JGroupsComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JGroupsComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JGroupsComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JGroupsComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JGroupsComponentAutoConfiguration { JGroupsComponent component = new JGroupsComponent(); 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 JGroupsComponentAutoConfiguration { } 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<JGroupsComponent> 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.jgroups.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jgroups.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-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java index 00a4656..a20cf05 100644 --- a/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java @@ -27,10 +27,12 @@ import org.apache.camel.dataformat.jibx.JibxDataFormat; import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormatCustomizer; import org.apache.camel.spi.DataFormatFactory; +import org.apache.camel.spi.HasId; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.spring.boot.DataFormatConfigurationProperties; 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; @@ -40,6 +42,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; @@ -59,13 +62,13 @@ public class JibxDataFormatAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JibxDataFormatAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JibxDataFormatConfiguration configuration; @Autowired(required = false) private List<DataFormatCustomizer<JibxDataFormat>> customizers; - @Autowired - private DataFormatConfigurationProperties globalConfiguration; - @Autowired - private JibxDataFormatConfiguration dataformatConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -90,7 +93,7 @@ public class JibxDataFormatAutoConfiguration { } try { Map<String, Object> parameters = new HashMap<>(); - IntrospectionSupport.getProperties(dataformatConfiguration, + IntrospectionSupport.getProperties(configuration, parameters, null, false); IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, @@ -98,15 +101,24 @@ public class JibxDataFormatAutoConfiguration { } catch (Exception e) { throw new RuntimeCamelException(e); } - boolean useCustomizers = globalConfiguration.getCustomizer() - .isEnabled() - && dataformatConfiguration.getCustomizer().isEnabled(); - if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) { + if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<JibxDataFormat> customizer : customizers) { - LOGGER.debug( - "Configure dataformat {}, with customizer {}", - dataformat, customizer); - customizer.customize(dataformat); + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.jibx.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.jibx.customizer"); + if (useCustomizer) { + LOGGER.debug( + "Configure dataformat {}, with customizer {}", + dataformat, customizer); + customizer.customize(dataformat); + } } } return dataformat; http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java index 91e5ae5..5b2ae92 100644 --- a/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.validator.jing.JingComponent; 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 JingComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JingComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JingComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JingComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JingComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JingComponentAutoConfiguration { JingComponent component = new JingComponent(); 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 JingComponentAutoConfiguration { } 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<JingComponent> 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.jing.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jing.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-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java index e9ac93d..2a6b88f 100644 --- a/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jira.JIRAComponent; 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 JIRAComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JIRAComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JIRAComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JIRAComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JIRAComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JIRAComponentAutoConfiguration { JIRAComponent component = new JIRAComponent(); 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 JIRAComponentAutoConfiguration { } 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<JIRAComponent> 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.jira.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jira.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-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java index 3552ec0..6b3022b 100644 --- a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jms.JmsComponent; 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 JmsComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JmsComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JmsComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JmsComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JmsComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JmsComponentAutoConfiguration { JmsComponent component = new JmsComponent(); 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 JmsComponentAutoConfiguration { } 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<JmsComponent> 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.jms.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jms.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-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java index a33f8ff..e7bebf8 100644 --- a/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jmx.JMXComponent; 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 JMXComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JMXComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JMXComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JMXComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JMXComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JMXComponentAutoConfiguration { JMXComponent component = new JMXComponent(); 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 JMXComponentAutoConfiguration { } 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<JMXComponent> 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.jmx.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jmx.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-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java index f1586f9..87d2451 100644 --- a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java @@ -27,10 +27,12 @@ import org.apache.camel.component.johnzon.JohnzonDataFormat; import org.apache.camel.spi.DataFormat; import org.apache.camel.spi.DataFormatCustomizer; import org.apache.camel.spi.DataFormatFactory; +import org.apache.camel.spi.HasId; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.spring.boot.DataFormatConfigurationProperties; 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; @@ -40,6 +42,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; @@ -59,13 +62,13 @@ public class JohnzonDataFormatAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JohnzonDataFormatAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JohnzonDataFormatConfiguration configuration; @Autowired(required = false) private List<DataFormatCustomizer<JohnzonDataFormat>> customizers; - @Autowired - private DataFormatConfigurationProperties globalConfiguration; - @Autowired - private JohnzonDataFormatConfiguration dataformatConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -91,7 +94,7 @@ public class JohnzonDataFormatAutoConfiguration { } try { Map<String, Object> parameters = new HashMap<>(); - IntrospectionSupport.getProperties(dataformatConfiguration, + IntrospectionSupport.getProperties(configuration, parameters, null, false); IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, @@ -99,15 +102,27 @@ public class JohnzonDataFormatAutoConfiguration { } catch (Exception e) { throw new RuntimeCamelException(e); } - boolean useCustomizers = globalConfiguration.getCustomizer() - .isEnabled() - && dataformatConfiguration.getCustomizer().isEnabled(); - if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) { + if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<JohnzonDataFormat> customizer : customizers) { - LOGGER.debug( - "Configure dataformat {}, with customizer {}", - dataformat, customizer); - customizer.customize(dataformat); + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator + .evaluate( + applicationContext + .getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.json-johnzon.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext + .getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.json-johnzon.customizer"); + if (useCustomizer) { + LOGGER.debug( + "Configure dataformat {}, with customizer {}", + dataformat, customizer); + customizer.customize(dataformat); + } } } return dataformat; http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java index e0d80f6..979e7df 100644 --- a/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jolt.JoltComponent; 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 JoltComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JoltComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JoltComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JoltComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JoltComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JoltComponentAutoConfiguration { JoltComponent component = new JoltComponent(); 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 JoltComponentAutoConfiguration { } 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<JoltComponent> 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.jolt.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jolt.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-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java index be7a2e5..ca108c5 100644 --- a/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java @@ -23,11 +23,13 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.language.sql.SqlLanguage; +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 SqlLanguageAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SqlLanguageAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SqlLanguageConfiguration configuration; @Autowired(required = false) private List<LanguageCustomizer<SqlLanguage>> customizers; - @Autowired - private LanguageConfigurationProperties globalConfiguration; - @Autowired - private SqlLanguageConfiguration languageConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -85,18 +88,27 @@ public class SqlLanguageAutoConfiguration { } } 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<SqlLanguage> 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.sql.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.language.customizer", + "camel.language.sql.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-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java index 90b90b0..8669349 100644 --- a/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.jpa.JpaComponent; 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 JpaComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JpaComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JpaComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<JpaComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private JpaComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class JpaComponentAutoConfiguration { JpaComponent component = new JpaComponent(); 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 JpaComponentAutoConfiguration { } 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<JpaComponent> 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.jpa.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.jpa.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-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java index 379ff5f..c410415 100644 --- a/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.scp.ScpComponent; 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 ScpComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(ScpComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private ScpComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<ScpComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private ScpComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class ScpComponentAutoConfiguration { ScpComponent component = new ScpComponent(); 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 ScpComponentAutoConfiguration { } 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<ScpComponent> 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.scp.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.scp.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-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java index 267e4ef..4b51f97 100644 --- a/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java @@ -23,11 +23,13 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.jsonpath.JsonPathLanguage; +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 JsonPathLanguageAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(JsonPathLanguageAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private JsonPathLanguageConfiguration configuration; @Autowired(required = false) private List<LanguageCustomizer<JsonPathLanguage>> customizers; - @Autowired - private LanguageConfigurationProperties globalConfiguration; - @Autowired - private JsonPathLanguageConfiguration languageConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -85,18 +88,27 @@ public class JsonPathLanguageAutoConfiguration { } } 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<JsonPathLanguage> 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.jsonpath.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.language.customizer", + "camel.language.jsonpath.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure language {}, with customizer {}", + language, customizer); + customizer.customize(language); + } } } return language;
