http://git-wip-us.apache.org/repos/asf/camel/blob/2f9a99cc/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java index dbecf5a..f876625 100644 --- a/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java +++ b/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.freemarker.FreemarkerComponent; 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(FreemarkerComponentConfiguration.class) +@Conditional(FreemarkerComponentAutoConfiguration.Condition.class) public class FreemarkerComponentAutoConfiguration { @Bean(name = "freemarker-component") @@ -69,4 +77,29 @@ public class FreemarkerComponentAutoConfiguration { 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.freemarker"); + if (isEnabled(conditionContext, "camel.component.freemarker.", + 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-freemarker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-freemarker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-freemarker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..f71d4d1 --- /dev/null +++ b/components-starter/camel-freemarker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.freemarker.enabled", + "description": "Enable freemarker 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-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java b/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java index 7d25ac7..b39d7d3 100644 --- a/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java +++ b/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.ganglia.GangliaComponent; 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(GangliaComponentConfiguration.class) +@Conditional(GangliaComponentAutoConfiguration.Condition.class) public class GangliaComponentAutoConfiguration { @Bean(name = "ganglia-component") @@ -69,4 +77,29 @@ public class GangliaComponentAutoConfiguration { 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.ganglia"); + if (isEnabled(conditionContext, "camel.component.ganglia.", + 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-ganglia-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-ganglia-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-ganglia-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..24b85ca --- /dev/null +++ b/components-starter/camel-ganglia-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.ganglia.enabled", + "description": "Enable ganglia 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-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java b/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java index 6cd5190..088bf4a 100644 --- a/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java +++ b/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.google.calendar.GoogleCalendarComponent; 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(GoogleCalendarComponentConfiguration.class) +@Conditional(GoogleCalendarComponentAutoConfiguration.Condition.class) public class GoogleCalendarComponentAutoConfiguration { @Bean(name = "google-calendar-component") @@ -70,4 +78,29 @@ public class GoogleCalendarComponentAutoConfiguration { 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.google-calendar"); + if (isEnabled(conditionContext, "camel.component.google-calendar.", + 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-google-calendar-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-calendar-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-google-calendar-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..084b664 --- /dev/null +++ b/components-starter/camel-google-calendar-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.google-calendar.enabled", + "description": "Enable google-calendar 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-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java b/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java index 47b8e6e..30978eb 100644 --- a/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java +++ b/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.google.drive.GoogleDriveComponent; 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(GoogleDriveComponentConfiguration.class) +@Conditional(GoogleDriveComponentAutoConfiguration.Condition.class) public class GoogleDriveComponentAutoConfiguration { @Bean(name = "google-drive-component") @@ -69,4 +77,29 @@ public class GoogleDriveComponentAutoConfiguration { 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.google-drive"); + if (isEnabled(conditionContext, "camel.component.google-drive.", + 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-google-drive-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-drive-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-google-drive-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..be996e5 --- /dev/null +++ b/components-starter/camel-google-drive-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.google-drive.enabled", + "description": "Enable google-drive 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-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java b/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java index 7cfac41..21e90be 100644 --- a/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java +++ b/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.google.mail.GoogleMailComponent; 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(GoogleMailComponentConfiguration.class) +@Conditional(GoogleMailComponentAutoConfiguration.Condition.class) public class GoogleMailComponentAutoConfiguration { @Bean(name = "google-mail-component") @@ -69,4 +77,29 @@ public class GoogleMailComponentAutoConfiguration { 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.google-mail"); + if (isEnabled(conditionContext, "camel.component.google-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-google-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-google-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-google-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..2c2da73 --- /dev/null +++ b/components-starter/camel-google-mail-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.google-mail.enabled", + "description": "Enable google-mail 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-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java b/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java index b5efa61..40a635c 100644 --- a/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java +++ b/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.language.groovy.GroovyLanguage; 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(GroovyLanguageConfiguration.class) +@Conditional(GroovyLanguageAutoConfiguration.Condition.class) public class GroovyLanguageAutoConfiguration { @Bean(name = "groovy-language") @@ -51,4 +59,29 @@ public class GroovyLanguageAutoConfiguration { 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.groovy"); + if (isEnabled(conditionContext, "camel.language.groovy.", + 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-groovy-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-groovy-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-groovy-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..a996003 --- /dev/null +++ b/components-starter/camel-groovy-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.language.groovy.enabled", + "description": "Enable groovy 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-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java b/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java index c3c66df..184074b 100644 --- a/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java +++ b/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.component.gson.GsonDataFormat; 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(GsonDataFormatConfiguration.class) +@Conditional(GsonDataFormatAutoConfiguration.Condition.class) public class GsonDataFormatAutoConfiguration { @Bean(name = "json-gson-dataformat") @@ -51,4 +59,29 @@ public class GsonDataFormatAutoConfiguration { 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.json-gson"); + if (isEnabled(conditionContext, "camel.dataformat.json-gson.", + 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-gson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-gson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-gson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..59473b3 --- /dev/null +++ b/components-starter/camel-gson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.json-gson.enabled", + "description": "Enable json-gson 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-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java b/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java index 636a8c6..bf247a8 100644 --- a/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java +++ b/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.guava.eventbus.GuavaEventBusComponent; 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(GuavaEventBusComponentConfiguration.class) +@Conditional(GuavaEventBusComponentAutoConfiguration.Condition.class) public class GuavaEventBusComponentAutoConfiguration { @Bean(name = "guava-eventbus-component") @@ -69,4 +77,29 @@ public class GuavaEventBusComponentAutoConfiguration { 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.guava-eventbus"); + if (isEnabled(conditionContext, "camel.component.guava-eventbus.", + 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-guava-eventbus-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-guava-eventbus-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-guava-eventbus-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..78c1f65 --- /dev/null +++ b/components-starter/camel-guava-eventbus-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.guava-eventbus.enabled", + "description": "Enable guava-eventbus 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-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java b/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java index 2d54892..114197d 100644 --- a/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java +++ b/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/springboot/HazelcastComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.hazelcast.HazelcastComponent; 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(HazelcastComponentConfiguration.class) +@Conditional(HazelcastComponentAutoConfiguration.Condition.class) public class HazelcastComponentAutoConfiguration { @Bean(name = "hazelcast-component") @@ -69,4 +77,29 @@ public class HazelcastComponentAutoConfiguration { 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.hazelcast"); + if (isEnabled(conditionContext, "camel.component.hazelcast.", + 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-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..89d80d7 --- /dev/null +++ b/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.hazelcast.enabled", + "description": "Enable hazelcast 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-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java b/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java index b0ef4fb..0509861 100644 --- a/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java +++ b/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.hbase.HBaseComponent; 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(HBaseComponentConfiguration.class) +@Conditional(HBaseComponentAutoConfiguration.Condition.class) public class HBaseComponentAutoConfiguration { @Bean(name = "hbase-component") @@ -68,4 +76,29 @@ public class HBaseComponentAutoConfiguration { 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.hbase"); + if (isEnabled(conditionContext, "camel.component.hbase.", + 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-hbase-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-hbase-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-hbase-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..2246cb5 --- /dev/null +++ b/components-starter/camel-hbase-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.hbase.enabled", + "description": "Enable hbase 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-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java b/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java index 987b615..44541f8 100644 --- a/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java +++ b/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.hdfs.HdfsComponent; 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(HdfsComponentConfiguration.class) +@Conditional(HdfsComponentAutoConfiguration.Condition.class) public class HdfsComponentAutoConfiguration { @Bean(name = "hdfs-component") @@ -68,4 +76,29 @@ public class HdfsComponentAutoConfiguration { 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.hdfs"); + if (isEnabled(conditionContext, "camel.component.hdfs.", + 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-hdfs-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-hdfs-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-hdfs-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..6d2fd0d --- /dev/null +++ b/components-starter/camel-hdfs-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.hdfs.enabled", + "description": "Enable hdfs 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-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java b/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java index c7a1e1d..c169001 100644 --- a/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java +++ b/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.hdfs2.HdfsComponent; 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(HdfsComponentConfiguration.class) +@Conditional(HdfsComponentAutoConfiguration.Condition.class) public class HdfsComponentAutoConfiguration { @Bean(name = "hdfs2-component") @@ -68,4 +76,29 @@ public class HdfsComponentAutoConfiguration { 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.hdfs2"); + if (isEnabled(conditionContext, "camel.component.hdfs2.", + 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-hdfs2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-hdfs2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-hdfs2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..796fed7 --- /dev/null +++ b/components-starter/camel-hdfs2-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.hdfs2.enabled", + "description": "Enable hdfs2 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-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java b/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java index 6243ba8..258d406 100644 --- a/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java +++ b/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.dataformat.hessian.HessianDataFormat; 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(HessianDataFormatConfiguration.class) +@Conditional(HessianDataFormatAutoConfiguration.Condition.class) public class HessianDataFormatAutoConfiguration { @Bean(name = "hessian-dataformat") @@ -52,4 +60,29 @@ public class HessianDataFormatAutoConfiguration { 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.hessian"); + if (isEnabled(conditionContext, "camel.dataformat.hessian.", + 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-hessian-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-hessian-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-hessian-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..35cd4d6 --- /dev/null +++ b/components-starter/camel-hessian-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.hessian.enabled", + "description": "Enable hessian 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-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java b/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java index b34409d..634b59a 100644 --- a/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java +++ b/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.component.hl7.HL7DataFormat; 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(HL7DataFormatConfiguration.class) +@Conditional(HL7DataFormatAutoConfiguration.Condition.class) public class HL7DataFormatAutoConfiguration { @Bean(name = "hl7-dataformat") @@ -51,4 +59,29 @@ public class HL7DataFormatAutoConfiguration { 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.hl7"); + if (isEnabled(conditionContext, "camel.dataformat.hl7.", + 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-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java b/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java index 8a7994f..a3e80bd 100644 --- a/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java +++ b/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.component.hl7.TerserLanguage; 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(TerserLanguageConfiguration.class) +@Conditional(TerserLanguageAutoConfiguration.Condition.class) public class TerserLanguageAutoConfiguration { @Bean(name = "terser-language") @@ -51,4 +59,29 @@ public class TerserLanguageAutoConfiguration { 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.terser"); + if (isEnabled(conditionContext, "camel.language.terser.", + 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-hl7-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-hl7-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-hl7-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..5df4da3 --- /dev/null +++ b/components-starter/camel-hl7-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.hl7.enabled", + "description": "Enable hl7 dataformat", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.terser.enabled", + "description": "Enable terser 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-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java b/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java index 1397ebb..062960c 100644 --- a/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java +++ b/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.http.HttpComponent; 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(HttpComponentConfiguration.class) +@Conditional(HttpComponentAutoConfiguration.Condition.class) public class HttpComponentAutoConfiguration { @Bean(name = {"http-component", "https-component"}) @@ -68,4 +76,29 @@ public class HttpComponentAutoConfiguration { 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.http"); + if (isEnabled(conditionContext, "camel.component.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-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..fc3d3bf --- /dev/null +++ b/components-starter/camel-http-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.http.enabled", + "description": "Enable 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-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java b/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java index 126e7c1..38e92d9 100644 --- a/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java +++ b/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java @@ -21,17 +21,25 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.http4.HttpComponent; 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(HttpComponentConfiguration.class) +@Conditional(HttpComponentAutoConfiguration.Condition.class) public class HttpComponentAutoConfiguration { @Bean(name = "http4-component") @@ -68,4 +76,29 @@ public class HttpComponentAutoConfiguration { 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.http4"); + if (isEnabled(conditionContext, "camel.component.http4.", + 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-http4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-http4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-http4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..13c8856 --- /dev/null +++ b/components-starter/camel-http4-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.http4.enabled", + "description": "Enable http4 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-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java b/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java index 60bab0d..a0795a1 100644 --- a/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java +++ b/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.component.ical.ICalDataFormat; 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(ICalDataFormatConfiguration.class) +@Conditional(ICalDataFormatAutoConfiguration.Condition.class) public class ICalDataFormatAutoConfiguration { @Bean(name = "ical-dataformat") @@ -51,4 +59,29 @@ public class ICalDataFormatAutoConfiguration { 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.ical"); + if (isEnabled(conditionContext, "camel.dataformat.ical.", + 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-ical-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-ical-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-ical-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..36fbef0 --- /dev/null +++ b/components-starter/camel-ical-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.ical.enabled", + "description": "Enable ical 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-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java b/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java index 279fc73..90b0cad 100644 --- a/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java +++ b/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java @@ -22,17 +22,25 @@ import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.component.jackson.JacksonDataFormat; 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(JacksonDataFormatConfiguration.class) +@Conditional(JacksonDataFormatAutoConfiguration.Condition.class) public class JacksonDataFormatAutoConfiguration { @Bean(name = "json-jackson-dataformat") @@ -52,4 +60,29 @@ public class JacksonDataFormatAutoConfiguration { 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.json-jackson"); + if (isEnabled(conditionContext, "camel.dataformat.json-jackson.", + 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-jackson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-jackson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-jackson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..d970d25 --- /dev/null +++ b/components-starter/camel-jackson-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.json-jackson.enabled", + "description": "Enable json-jackson dataformat", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file
