http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java index fe6717f..6e939df 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.log.LogComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(LogComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(LogComponentConfiguration.class) public class LogComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class LogComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.log"); + if (isEnabled(conditionContext, "camel.component.log.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java index 6241a78..b83a4fa 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.mock.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.mock.MockComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(MockComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class MockComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class MockComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.mock"); + if (isEnabled(conditionContext, "camel.component.mock.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java index 4e0e729..f8d3ba2 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(PropertiesComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(PropertiesComponentConfiguration.class) public class PropertiesComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class PropertiesComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.properties"); + if (isEnabled(conditionContext, "camel.component.properties.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java index 5d0cc0c..b4268a9 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.ref.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.ref.RefComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(RefComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class RefComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class RefComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.ref"); + if (isEnabled(conditionContext, "camel.component.ref.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java index ac6b891..646d460 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.rest.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.rest.RestApiComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(RestApiComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class RestApiComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class RestApiComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.rest-api"); + if (isEnabled(conditionContext, "camel.component.rest-api.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java index f16a79e..f517a70 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.rest.RestComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(RestComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(RestComponentConfiguration.class) public class RestComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class RestComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.rest"); + if (isEnabled(conditionContext, "camel.component.rest.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java index 97a14ed..7441c1e 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.scheduler.SchedulerComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SchedulerComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SchedulerComponentConfiguration.class) public class SchedulerComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class SchedulerComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.scheduler"); + if (isEnabled(conditionContext, "camel.component.scheduler.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java index 0a2ad0f..e332b2d 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.seda.SedaComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SedaComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SedaComponentConfiguration.class) public class SedaComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class SedaComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.seda"); + if (isEnabled(conditionContext, "camel.component.seda.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java index 5a1b57f..28f155e 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.stub.StubComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(StubComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(StubComponentConfiguration.class) public class StubComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class StubComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.stub"); + if (isEnabled(conditionContext, "camel.component.stub.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java index 534862b..d3bf547 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.test.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.test.TestComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(TestComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class TestComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class TestComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.test"); + if (isEnabled(conditionContext, "camel.component.test.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java index 9ab7d88..4ecac1d 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.timer.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.timer.TimerComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(TimerComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class TimerComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class TimerComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.timer"); + if (isEnabled(conditionContext, "camel.component.timer.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java index 0e381c8..598662e 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.validator.ValidatorComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(ValidatorComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(ValidatorComponentConfiguration.class) public class ValidatorComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class ValidatorComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.validator"); + if (isEnabled(conditionContext, "camel.component.validator.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java index 7830380..ec2b7f9 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.vm.VmComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(VmComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(VmComponentConfiguration.class) public class VmComponentAutoConfiguration { @@ -72,4 +80,28 @@ public class VmComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.vm"); + if (isEnabled(conditionContext, "camel.component.vm.", groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java index e62a451..efb55fc 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.xslt.XsltComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(XsltComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(XsltComponentConfiguration.class) public class XsltComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class XsltComponentAutoConfiguration { camelContext.getTypeConverter(), component, parameters); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.xslt"); + if (isEnabled(conditionContext, "camel.component.xslt.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java index 9dd23a7..63bb74a 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.impl.GzipDataFormat; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(GzipDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(GzipDataFormatConfiguration.class) public class GzipDataFormatAutoConfiguration { @@ -55,4 +63,29 @@ public class GzipDataFormatAutoConfiguration { camelContext.getTypeConverter(), dataformat, parameters); return dataformat; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.dataformat.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.dataformat.gzip"); + if (isEnabled(conditionContext, "camel.dataformat.gzip.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java index 86d0eba..769da9b 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.impl.SerializationDataFormat; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SerializationDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SerializationDataFormatConfiguration.class) public class SerializationDataFormatAutoConfiguration { @@ -57,4 +65,29 @@ public class SerializationDataFormatAutoConfiguration { camelContext.getTypeConverter(), dataformat, parameters); return dataformat; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.dataformat.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.dataformat.serialization"); + if (isEnabled(conditionContext, "camel.dataformat.serialization.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java index 8076a83..a48efca 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.impl.StringDataFormat; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(StringDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(StringDataFormatConfiguration.class) public class StringDataFormatAutoConfiguration { @@ -56,4 +64,29 @@ public class StringDataFormatAutoConfiguration { camelContext.getTypeConverter(), dataformat, parameters); return dataformat; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.dataformat.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.dataformat.string"); + if (isEnabled(conditionContext, "camel.dataformat.string.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java index 2537b48..486626e 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.impl.ZipDataFormat; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(ZipDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(ZipDataFormatConfiguration.class) public class ZipDataFormatAutoConfiguration { @@ -55,4 +63,29 @@ public class ZipDataFormatAutoConfiguration { camelContext.getTypeConverter(), dataformat, parameters); return dataformat; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.dataformat.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.dataformat.zip"); + if (isEnabled(conditionContext, "camel.dataformat.zip.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java index c895f55..5fd3165 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.bean.BeanLanguage; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(BeanLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(BeanLanguageConfiguration.class) public class BeanLanguageAutoConfiguration { @@ -55,4 +63,29 @@ public class BeanLanguageAutoConfiguration { camelContext.getTypeConverter(), language, parameters); return language; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.language.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.language.bean"); + if (isEnabled(conditionContext, "camel.language.bean.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java index 6f258ad..d68126a 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.constant.ConstantLanguage; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(ConstantLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(ConstantLanguageConfiguration.class) public class ConstantLanguageAutoConfiguration { @@ -56,4 +64,29 @@ public class ConstantLanguageAutoConfiguration { camelContext.getTypeConverter(), language, parameters); return language; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.language.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.language.constant"); + if (isEnabled(conditionContext, "camel.language.constant.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java index afc4e50..35c1f70 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.header.HeaderLanguage; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(HeaderLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(HeaderLanguageConfiguration.class) public class HeaderLanguageAutoConfiguration { @@ -55,4 +63,29 @@ public class HeaderLanguageAutoConfiguration { camelContext.getTypeConverter(), language, parameters); return language; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.language.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.language.header"); + if (isEnabled(conditionContext, "camel.language.header.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java index 23346da..cb52f0d 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.property.ExchangePropertyLanguage; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(ExchangePropertyLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(ExchangePropertyLanguageConfiguration.class) public class ExchangePropertyLanguageAutoConfiguration { @@ -57,4 +65,29 @@ public class ExchangePropertyLanguageAutoConfiguration { camelContext.getTypeConverter(), language, parameters); return language; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.language.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.language.exchangeproperty"); + if (isEnabled(conditionContext, "camel.language.exchangeproperty.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java index ac32b5f..f94f51b 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.ref.RefLanguage; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(RefLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(RefLanguageConfiguration.class) public class RefLanguageAutoConfiguration { @@ -55,4 +63,28 @@ public class RefLanguageAutoConfiguration { camelContext.getTypeConverter(), language, parameters); return language; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.language.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.language.ref"); + if (isEnabled(conditionContext, "camel.language.ref.", groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file
