http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java b/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java index 3113a34..4df6028 100644 --- a/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java +++ b/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.cassandra.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.cassandra.CassandraComponent; 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(CassandraComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class CassandraComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class CassandraComponentAutoConfiguration { 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.cql"); + if (isEnabled(conditionContext, "camel.component.cql.", + 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-cassandraql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-cassandraql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-cassandraql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..b906f2f --- /dev/null +++ b/components-starter/camel-cassandraql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.cql.enabled", + "description": "Enable cql component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java b/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java index 0a643a6..d16f50b 100644 --- a/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java +++ b/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.dataformat.castor.CastorDataFormat; 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(CastorDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(CastorDataFormatConfiguration.class) public class CastorDataFormatAutoConfiguration { @@ -56,4 +64,29 @@ public class CastorDataFormatAutoConfiguration { 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.castor"); + if (isEnabled(conditionContext, "camel.dataformat.castor.", + 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-castor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-castor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-castor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..1415979 --- /dev/null +++ b/components-starter/camel-castor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.castor.enabled", + "description": "Enable castor dataformat", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java b/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java index 79a2187..276bd00 100644 --- a/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java +++ b/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.chronicle.engine.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.chronicle.engine.ChronicleEngineComponent; 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(ChronicleEngineComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class ChronicleEngineComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class ChronicleEngineComponentAutoConfiguration { 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.chronicle-engine"); + if (isEnabled(conditionContext, + "camel.component.chronicle-engine.", 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-chronicle-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-chronicle-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-chronicle-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..aa7d32f --- /dev/null +++ b/components-starter/camel-chronicle-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.chronicle-engine.enabled", + "description": "Enable chronicle-engine component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java b/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java index 4b60511..6736bb3 100644 --- a/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java +++ b/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.chunk.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.chunk.ChunkComponent; 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(ChunkComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class ChunkComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class ChunkComponentAutoConfiguration { 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.chunk"); + if (isEnabled(conditionContext, "camel.component.chunk.", + 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-chunk-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-chunk-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-chunk-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..bc0b030 --- /dev/null +++ b/components-starter/camel-chunk-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.chunk.enabled", + "description": "Enable chunk component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java b/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java index 2adfacb..e8b50cc 100644 --- a/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java +++ b/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.cm.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.cm.CMComponent; 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(CMComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class CMComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class CMComponentAutoConfiguration { 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.cm-sms"); + if (isEnabled(conditionContext, "camel.component.cm-sms.", + 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-cm-sms-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-cm-sms-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-cm-sms-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..2eeff41 --- /dev/null +++ b/components-starter/camel-cm-sms-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.cm-sms.enabled", + "description": "Enable cm-sms component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java b/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java index affc471..f4017ca 100644 --- a/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java +++ b/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.cmis.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.cmis.CMISComponent; 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(CMISComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class CMISComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class CMISComponentAutoConfiguration { 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.cmis"); + if (isEnabled(conditionContext, "camel.component.cmis.", + 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-cmis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-cmis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-cmis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..1885d4e --- /dev/null +++ b/components-starter/camel-cmis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.cmis.enabled", + "description": "Enable cmis component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java b/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java index 7d0345b..b5a6776 100644 --- a/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java +++ b/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.coap.springboot; import org.apache.camel.CamelContext; import org.apache.camel.coap.CoAPComponent; 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(CoAPComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class CoAPComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class CoAPComponentAutoConfiguration { 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.coap"); + if (isEnabled(conditionContext, "camel.component.coap.", + 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-coap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-coap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-coap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c2716fe --- /dev/null +++ b/components-starter/camel-coap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.coap.enabled", + "description": "Enable coap component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java b/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java index ef54bbc..5ef7fb6 100644 --- a/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java +++ b/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.cometd.CometdComponent; 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(CometdComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(CometdComponentConfiguration.class) public class CometdComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class CometdComponentAutoConfiguration { 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.cometd"); + if (isEnabled(conditionContext, "camel.component.cometd.", + 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-cometd-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-cometd-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-cometd-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..03cf524 --- /dev/null +++ b/components-starter/camel-cometd-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.cometd.enabled", + "description": "Enable cometd component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java index 18fce5e..657b08e 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.consul.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.consul.ConsulComponent; 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(ConsulComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class ConsulComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class ConsulComponentAutoConfiguration { 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.consul"); + if (isEnabled(conditionContext, "camel.component.consul.", + 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-consul-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-consul-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-consul-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..a31d95f --- /dev/null +++ b/components-starter/camel-consul-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.consul.enabled", + "description": "Enable consul component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java b/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java index b487999..7390a3b 100644 --- a/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java +++ b/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.context.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.context.QualifiedContextComponent; 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(QualifiedContextComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class QualifiedContextComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class QualifiedContextComponentAutoConfiguration { 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.context"); + if (isEnabled(conditionContext, "camel.component.context.", + 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-context-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-context-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-context-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..0b3be00 --- /dev/null +++ b/components-starter/camel-context-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.context.enabled", + "description": "Enable context component", + "type": "java.lang.Boolean" + } + ] +} \ 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/bean/springboot/BeanComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java index 0ba0933..2983745 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.bean.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.bean.BeanComponent; 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(BeanComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class BeanComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class BeanComponentAutoConfiguration { 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.bean"); + if (isEnabled(conditionContext, "camel.component.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/component/beanclass/springboot/ClassComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java index e9c9654..889383f 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.beanclass.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.beanclass.ClassComponent; 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(ClassComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class ClassComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class ClassComponentAutoConfiguration { 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.class"); + if (isEnabled(conditionContext, "camel.component.class.", + 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/binding/springboot/BindingNameComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java index f7019d0..83d186e 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.binding.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.binding.BindingNameComponent; 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(BindingNameComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class BindingNameComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class BindingNameComponentAutoConfiguration { 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.binding"); + if (isEnabled(conditionContext, "camel.component.binding.", + 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/browse/springboot/BrowseComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java index c919382..2cf2a08 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.browse.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.browse.BrowseComponent; 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(BrowseComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class BrowseComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class BrowseComponentAutoConfiguration { 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.browse"); + if (isEnabled(conditionContext, "camel.component.browse.", + 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/controlbus/springboot/ControlBusComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java index cb53ea5..0a59034 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.controlbus.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.controlbus.ControlBusComponent; 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(ControlBusComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class ControlBusComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class ControlBusComponentAutoConfiguration { 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.controlbus"); + if (isEnabled(conditionContext, "camel.component.controlbus.", + 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/dataformat/springboot/DataFormatComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java index f89c232..c29f1c8 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.dataformat.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.dataformat.DataFormatComponent; 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(DataFormatComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class DataFormatComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class DataFormatComponentAutoConfiguration { 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.dataformat"); + if (isEnabled(conditionContext, "camel.component.dataformat.", + 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/dataset/springboot/DataSetComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java index c8e604d..cc62bc0 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.dataset.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.dataset.DataSetComponent; 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(DataSetComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class DataSetComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class DataSetComponentAutoConfiguration { 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.dataset"); + if (isEnabled(conditionContext, "camel.component.dataset.", + 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/direct/springboot/DirectComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java index dff4597..74b170c 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.direct.DirectComponent; 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(DirectComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(DirectComponentConfiguration.class) public class DirectComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class DirectComponentAutoConfiguration { 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.direct"); + if (isEnabled(conditionContext, "camel.component.direct.", + 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/directvm/springboot/DirectVmComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java index cba1856..fc251e5 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.directvm.DirectVmComponent; 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(DirectVmComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(DirectVmComponentConfiguration.class) public class DirectVmComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class DirectVmComponentAutoConfiguration { 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.direct-vm"); + if (isEnabled(conditionContext, "camel.component.direct-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/file/springboot/FileComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java index 0455d54..84efcd7 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.file.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.file.FileComponent; 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(FileComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class FileComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class FileComponentAutoConfiguration { 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.file"); + if (isEnabled(conditionContext, "camel.component.file.", + 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/language/springboot/LanguageComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java index cbdc81b..ec9f25a 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.language.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.language.LanguageComponent; 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(LanguageComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class LanguageComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class LanguageComponentAutoConfiguration { 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.language"); + if (isEnabled(conditionContext, "camel.component.language.", + 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
