http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java index ea776c9..a24f0af 100644 --- a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.avro.AvroComponent; 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 AvroComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(AvroComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private AvroComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<AvroComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private AvroComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class AvroComponentAutoConfiguration { AvroComponent component = new AvroComponent(); 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 AvroComponentAutoConfiguration { } 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<AvroComponent> 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.avro.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.avro.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-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java index ac045be..2928704 100644 --- a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java @@ -27,10 +27,12 @@ import org.apache.camel.dataformat.avro.AvroDataFormat; 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 AvroDataFormatAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(AvroDataFormatAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private AvroDataFormatConfiguration configuration; @Autowired(required = false) private List<DataFormatCustomizer<AvroDataFormat>> customizers; - @Autowired - private DataFormatConfigurationProperties globalConfiguration; - @Autowired - private AvroDataFormatConfiguration dataformatConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -90,7 +93,7 @@ public class AvroDataFormatAutoConfiguration { } 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 AvroDataFormatAutoConfiguration { } 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<AvroDataFormat> 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.avro.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.avro.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-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java index 25c6ee7..49db829 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.cw.CwComponent; 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 CwComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(CwComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private CwComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<CwComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private CwComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class CwComponentAutoConfiguration { CwComponent component = new CwComponent(); 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 CwComponentAutoConfiguration { } 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<CwComponent> 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.aws-cw.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-cw.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-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java index 67f3dbf..0549df8 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.ddb.DdbComponent; 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 DdbComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(DdbComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private DdbComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<DdbComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private DdbComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class DdbComponentAutoConfiguration { DdbComponent component = new DdbComponent(); 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 DdbComponentAutoConfiguration { } 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<DdbComponent> 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.aws-ddb.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-ddb.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-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java index 5dbe1a1..b4af603 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.ddbstream.DdbStreamComponent; 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 DdbStreamComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(DdbStreamComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private DdbStreamComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<DdbStreamComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private DdbStreamComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class DdbStreamComponentAutoConfiguration { DdbStreamComponent component = new DdbStreamComponent(); 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 DdbStreamComponentAutoConfiguration { } 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<DdbStreamComponent> 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.aws-ddbstream.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-ddbstream.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-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java index 2a46ea7..4c7a690 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.ec2.EC2Component; 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 EC2ComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(EC2ComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private EC2ComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<EC2Component>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private EC2ComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class EC2ComponentAutoConfiguration { EC2Component component = new EC2Component(); 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 EC2ComponentAutoConfiguration { } 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<EC2Component> 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.aws-ec2.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-ec2.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-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java index b8aca0d..7b51949 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.firehose.KinesisFirehoseComponent; 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 KinesisFirehoseComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(KinesisFirehoseComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private KinesisFirehoseComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<KinesisFirehoseComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private KinesisFirehoseComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -78,8 +81,8 @@ public class KinesisFirehoseComponentAutoConfiguration { KinesisFirehoseComponent component = new KinesisFirehoseComponent(); 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,24 @@ public class KinesisFirehoseComponentAutoConfiguration { } 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<KinesisFirehoseComponent> 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.aws-kinesis-firehose.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-kinesis-firehose.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-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java index 8932839..49bc7dc 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.kinesis.KinesisComponent; 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 KinesisComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(KinesisComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private KinesisComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<KinesisComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private KinesisComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class KinesisComponentAutoConfiguration { KinesisComponent component = new KinesisComponent(); 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 KinesisComponentAutoConfiguration { } 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<KinesisComponent> 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.aws-kinesis.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-kinesis.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-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java index 706af0b..e5fc659 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.s3.S3Component; 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 S3ComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(S3ComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private S3ComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<S3Component>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private S3ComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class S3ComponentAutoConfiguration { S3Component component = new S3Component(); 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 S3ComponentAutoConfiguration { } 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<S3Component> 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.aws-s3.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-s3.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-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java index 1cacacb..267335a 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.sdb.SdbComponent; 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 SdbComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SdbComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SdbComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SdbComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SdbComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SdbComponentAutoConfiguration { SdbComponent component = new SdbComponent(); 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 SdbComponentAutoConfiguration { } 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<SdbComponent> 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.aws-sdb.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-sdb.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-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java index da9954e..3a9beb9 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.ses.SesComponent; 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 SesComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SesComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SesComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SesComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SesComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SesComponentAutoConfiguration { SesComponent component = new SesComponent(); 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 SesComponentAutoConfiguration { } 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<SesComponent> 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.aws-ses.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-ses.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-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java index 27e32a1..f94d644 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.sns.SnsComponent; 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 SnsComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SnsComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SnsComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SnsComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SnsComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SnsComponentAutoConfiguration { SnsComponent component = new SnsComponent(); 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 SnsComponentAutoConfiguration { } 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<SnsComponent> 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.aws-sns.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-sns.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-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java index d3e6f61..a7818e9 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.sqs.SqsComponent; 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 SqsComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SqsComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SqsComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SqsComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SqsComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SqsComponentAutoConfiguration { SqsComponent component = new SqsComponent(); 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 SqsComponentAutoConfiguration { } 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<SqsComponent> 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.aws-sqs.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-sqs.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-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java index d75f839..1d05722 100644 --- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.aws.swf.SWFComponent; 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 SWFComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SWFComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SWFComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SWFComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SWFComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SWFComponentAutoConfiguration { SWFComponent component = new SWFComponent(); 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 SWFComponentAutoConfiguration { } 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<SWFComponent> 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.aws-swf.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-swf.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-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java index 0e557d8..665951b 100644 --- a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.azure.blob.BlobServiceComponent; 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 BlobServiceComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(BlobServiceComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private BlobServiceComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<BlobServiceComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private BlobServiceComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -78,8 +81,8 @@ public class BlobServiceComponentAutoConfiguration { BlobServiceComponent component = new BlobServiceComponent(); 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 BlobServiceComponentAutoConfiguration { } 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<BlobServiceComponent> 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.azure-blob.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.azure-blob.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-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java index b2e64b4..c2e885b 100644 --- a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.azure.queue.QueueServiceComponent; 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 QueueServiceComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(QueueServiceComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private QueueServiceComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<QueueServiceComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private QueueServiceComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -78,8 +81,8 @@ public class QueueServiceComponentAutoConfiguration { QueueServiceComponent component = new QueueServiceComponent(); 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 QueueServiceComponentAutoConfiguration { } 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<QueueServiceComponent> 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.azure-queue.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.azure-queue.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } } } return component;