http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-lucene-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-lucene-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-lucene-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..b1a0931 --- /dev/null +++ b/components-starter/camel-lucene-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.lucene.enabled", + "description": "Enable lucene component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java b/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java index 4018aab..dc49691 100644 --- a/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java +++ b/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.lumberjack.LumberjackComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(LumberjackComponentConfiguration.class) +@Conditional(LumberjackComponentAutoConfiguration.Condition.class) public class LumberjackComponentAutoConfiguration { @Bean(name = "lumberjack-component") @@ -69,4 +77,29 @@ public class LumberjackComponentAutoConfiguration { 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.lumberjack"); + if (isEnabled(conditionContext, "camel.component.lumberjack.", + 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/2f9a99cc/components-starter/camel-lumberjack-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-lumberjack-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-lumberjack-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..eaf6eec --- /dev/null +++ b/components-starter/camel-lumberjack-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.lumberjack.enabled", + "description": "Enable lumberjack component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java b/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java index 46ba06a..b433c2b 100644 --- a/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java +++ b/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.dataformat.lzf.LZFDataFormat; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(LZFDataFormatConfiguration.class) +@Conditional(LZFDataFormatAutoConfiguration.Condition.class) public class LZFDataFormatAutoConfiguration { @Bean(name = "lzf-dataformat") @@ -51,4 +59,29 @@ public class LZFDataFormatAutoConfiguration { 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.lzf"); + if (isEnabled(conditionContext, "camel.dataformat.lzf.", + 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/2f9a99cc/components-starter/camel-lzf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-lzf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-lzf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c7931ff --- /dev/null +++ b/components-starter/camel-lzf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.lzf.enabled", + "description": "Enable lzf dataformat", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java b/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java index 488e31b..edcdf71 100644 --- a/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java +++ b/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.mail.MailComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MailComponentConfiguration.class) +@Conditional(MailComponentAutoConfiguration.Condition.class) public class MailComponentAutoConfiguration { @Bean(name = {"imap-component", "imaps-component", "pop3-component", @@ -69,4 +77,29 @@ public class MailComponentAutoConfiguration { 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.mail"); + if (isEnabled(conditionContext, "camel.component.mail.", + 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/2f9a99cc/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java b/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java index 5934038..e70c6f2 100644 --- a/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java +++ b/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.dataformat.mime.multipart.MimeMultipartDataFormat; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MimeMultipartDataFormatConfiguration.class) +@Conditional(MimeMultipartDataFormatAutoConfiguration.Condition.class) public class MimeMultipartDataFormatAutoConfiguration { @Bean(name = "mime-multipart-dataformat") @@ -53,4 +61,29 @@ public class MimeMultipartDataFormatAutoConfiguration { 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.mime-multipart"); + if (isEnabled(conditionContext, "camel.dataformat.mime-multipart.", + 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/2f9a99cc/components-starter/camel-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..4061c78 --- /dev/null +++ b/components-starter/camel-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.mail.enabled", + "description": "Enable mail component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.dataformat.mime-multipart.enabled", + "description": "Enable mime-multipart dataformat", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java b/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java index 475d9fe..4fd4c48 100644 --- a/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java +++ b/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.metrics.MetricsComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MetricsComponentConfiguration.class) +@Conditional(MetricsComponentAutoConfiguration.Condition.class) public class MetricsComponentAutoConfiguration { @Bean(name = "metrics-component") @@ -69,4 +77,29 @@ public class MetricsComponentAutoConfiguration { 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.metrics"); + if (isEnabled(conditionContext, "camel.component.metrics.", + 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/2f9a99cc/components-starter/camel-metrics-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-metrics-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-metrics-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..ed3fb2c --- /dev/null +++ b/components-starter/camel-metrics-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.metrics.enabled", + "description": "Enable metrics component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java b/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java index 7738c08..8d017ee 100644 --- a/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java +++ b/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.mina2.Mina2Component; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(Mina2ComponentConfiguration.class) +@Conditional(Mina2ComponentAutoConfiguration.Condition.class) public class Mina2ComponentAutoConfiguration { @Bean(name = "mina2-component") @@ -68,4 +76,29 @@ public class Mina2ComponentAutoConfiguration { 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.mina2"); + if (isEnabled(conditionContext, "camel.component.mina2.", + 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/2f9a99cc/components-starter/camel-mina2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-mina2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-mina2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..7456aef --- /dev/null +++ b/components-starter/camel-mina2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.mina2.enabled", + "description": "Enable mina2 component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java b/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java index b879db6..c22a6de 100644 --- a/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java +++ b/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.mqtt.MQTTComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MQTTComponentConfiguration.class) +@Conditional(MQTTComponentAutoConfiguration.Condition.class) public class MQTTComponentAutoConfiguration { @Bean(name = "mqtt-component") @@ -68,4 +76,29 @@ public class MQTTComponentAutoConfiguration { 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.mqtt"); + if (isEnabled(conditionContext, "camel.component.mqtt.", + 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/2f9a99cc/components-starter/camel-mqtt-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-mqtt-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-mqtt-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..f346f35 --- /dev/null +++ b/components-starter/camel-mqtt-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.mqtt.enabled", + "description": "Enable mqtt component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java b/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java index 760879e..5484fd4 100644 --- a/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java +++ b/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.validator.msv.MsvComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MsvComponentConfiguration.class) +@Conditional(MsvComponentAutoConfiguration.Condition.class) public class MsvComponentAutoConfiguration { @Bean(name = "msv-component") @@ -68,4 +76,29 @@ public class MsvComponentAutoConfiguration { 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.msv"); + if (isEnabled(conditionContext, "camel.component.msv.", + 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/2f9a99cc/components-starter/camel-msv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-msv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-msv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..b860747 --- /dev/null +++ b/components-starter/camel-msv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.msv.enabled", + "description": "Enable msv component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java b/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java index a33cb1c..35e3bdf 100644 --- a/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java +++ b/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.mustache.MustacheComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MustacheComponentConfiguration.class) +@Conditional(MustacheComponentAutoConfiguration.Condition.class) public class MustacheComponentAutoConfiguration { @Bean(name = "mustache-component") @@ -69,4 +77,29 @@ public class MustacheComponentAutoConfiguration { 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.mustache"); + if (isEnabled(conditionContext, "camel.component.mustache.", + 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/2f9a99cc/components-starter/camel-mustache-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-mustache-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-mustache-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..1dee159 --- /dev/null +++ b/components-starter/camel-mustache-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.mustache.enabled", + "description": "Enable mustache component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java b/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java index caffb48..5993f02 100644 --- a/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java +++ b/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.language.mvel.MvelLanguage; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MvelLanguageConfiguration.class) +@Conditional(MvelLanguageAutoConfiguration.Condition.class) public class MvelLanguageAutoConfiguration { @Bean(name = "mvel-language") @@ -51,4 +59,29 @@ public class MvelLanguageAutoConfiguration { 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.mvel"); + if (isEnabled(conditionContext, "camel.language.mvel.", + 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/2f9a99cc/components-starter/camel-mvel-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-mvel-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-mvel-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..6f58c51 --- /dev/null +++ b/components-starter/camel-mvel-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.language.mvel.enabled", + "description": "Enable mvel language", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java b/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java index 9be5da8..499fe3f 100644 --- a/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java +++ b/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.mybatis.MyBatisComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(MyBatisComponentConfiguration.class) +@Conditional(MyBatisComponentAutoConfiguration.Condition.class) public class MyBatisComponentAutoConfiguration { @Bean(name = "mybatis-component") @@ -69,4 +77,29 @@ public class MyBatisComponentAutoConfiguration { 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.mybatis"); + if (isEnabled(conditionContext, "camel.component.mybatis.", + 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/2f9a99cc/components-starter/camel-mybatis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-mybatis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-mybatis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..e53de0c --- /dev/null +++ b/components-starter/camel-mybatis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.mybatis.enabled", + "description": "Enable mybatis component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java b/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java index 6021d12..a0bd8ac 100644 --- a/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java +++ b/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.nagios.NagiosComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(NagiosComponentConfiguration.class) +@Conditional(NagiosComponentAutoConfiguration.Condition.class) public class NagiosComponentAutoConfiguration { @Bean(name = "nagios-component") @@ -68,4 +76,29 @@ public class NagiosComponentAutoConfiguration { 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.nagios"); + if (isEnabled(conditionContext, "camel.component.nagios.", + 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/2f9a99cc/components-starter/camel-nagios-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-nagios-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-nagios-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..d317043 --- /dev/null +++ b/components-starter/camel-nagios-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.nagios.enabled", + "description": "Enable nagios component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java b/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java index cf7f6f6..e095e2e 100644 --- a/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java +++ b/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.netty.http.NettyHttpComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(NettyHttpComponentConfiguration.class) +@Conditional(NettyHttpComponentAutoConfiguration.Condition.class) public class NettyHttpComponentAutoConfiguration { @Bean(name = "netty-http-component") @@ -69,4 +77,29 @@ public class NettyHttpComponentAutoConfiguration { 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.netty-http"); + if (isEnabled(conditionContext, "camel.component.netty-http.", + 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/2f9a99cc/components-starter/camel-netty-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-netty-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..4b064ba --- /dev/null +++ b/components-starter/camel-netty-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.netty-http.enabled", + "description": "Enable netty-http component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java b/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java index 6aa5c7e..e66636a 100644 --- a/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java +++ b/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.netty.NettyComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(NettyComponentConfiguration.class) +@Conditional(NettyComponentAutoConfiguration.Condition.class) public class NettyComponentAutoConfiguration { @Bean(name = "netty-component") @@ -68,4 +76,29 @@ public class NettyComponentAutoConfiguration { 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.netty"); + if (isEnabled(conditionContext, "camel.component.netty.", + 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/2f9a99cc/components-starter/camel-netty-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-netty-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..4450826 --- /dev/null +++ b/components-starter/camel-netty-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.netty.enabled", + "description": "Enable netty component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java b/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java index e79ff45..793cfb2 100644 --- a/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java +++ b/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.netty4.http.NettyHttpComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(NettyHttpComponentConfiguration.class) +@Conditional(NettyHttpComponentAutoConfiguration.Condition.class) public class NettyHttpComponentAutoConfiguration { @Bean(name = "netty4-http-component") @@ -69,4 +77,29 @@ public class NettyHttpComponentAutoConfiguration { 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.netty4-http"); + if (isEnabled(conditionContext, "camel.component.netty4-http.", + 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/2f9a99cc/components-starter/camel-netty4-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty4-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-netty4-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..5dd8031 --- /dev/null +++ b/components-starter/camel-netty4-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.netty4-http.enabled", + "description": "Enable netty4-http component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java b/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java index 532b578..e406d79 100644 --- a/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java +++ b/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.netty4.NettyComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(NettyComponentConfiguration.class) +@Conditional(NettyComponentAutoConfiguration.Condition.class) public class NettyComponentAutoConfiguration { @Bean(name = "netty4-component") @@ -68,4 +76,29 @@ public class NettyComponentAutoConfiguration { 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.netty4"); + if (isEnabled(conditionContext, "camel.component.netty4.", + 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/2f9a99cc/components-starter/camel-netty4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-netty4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..52c632e --- /dev/null +++ b/components-starter/camel-netty4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.netty4.enabled", + "description": "Enable netty4 component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java b/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java index d57b797..d516940 100644 --- a/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java +++ b/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.language.ognl.OgnlLanguage; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(OgnlLanguageConfiguration.class) +@Conditional(OgnlLanguageAutoConfiguration.Condition.class) public class OgnlLanguageAutoConfiguration { @Bean(name = "ognl-language") @@ -51,4 +59,29 @@ public class OgnlLanguageAutoConfiguration { 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.ognl"); + if (isEnabled(conditionContext, "camel.language.ognl.", + 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/2f9a99cc/components-starter/camel-ognl-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-ognl-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-ognl-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..5dcceee --- /dev/null +++ b/components-starter/camel-ognl-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.language.ognl.enabled", + "description": "Enable ognl language", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java b/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java index 3771b8a..adf4ca6 100644 --- a/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java +++ b/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.olingo2.Olingo2Component; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(Olingo2ComponentConfiguration.class) +@Conditional(Olingo2ComponentAutoConfiguration.Condition.class) public class Olingo2ComponentAutoConfiguration { @Bean(name = "olingo2-component") @@ -69,4 +77,29 @@ public class Olingo2ComponentAutoConfiguration { 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.olingo2"); + if (isEnabled(conditionContext, "camel.component.olingo2.", + 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/2f9a99cc/components-starter/camel-olingo2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-olingo2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-olingo2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..2c80c5d --- /dev/null +++ b/components-starter/camel-olingo2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.olingo2.enabled", + "description": "Enable olingo2 component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java b/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java index 2c0ae0d..a81ec4f 100644 --- a/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java +++ b/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.openshift.OpenShiftComponent; import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; 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 @EnableConfigurationProperties(OpenShiftComponentConfiguration.class) +@Conditional(OpenShiftComponentAutoConfiguration.Condition.class) public class OpenShiftComponentAutoConfiguration { @Bean(name = "openshift-component") @@ -69,4 +77,29 @@ public class OpenShiftComponentAutoConfiguration { 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.openshift"); + if (isEnabled(conditionContext, "camel.component.openshift.", + 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/2f9a99cc/components-starter/camel-openshift-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-openshift-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-openshift-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..a1cfc01 --- /dev/null +++ b/components-starter/camel-openshift-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.openshift.enabled", + "description": "Enable openshift component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file
