http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java b/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java index cedfc0d..b9bd9e4 100644 --- a/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java +++ b/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.spring.integration.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.spring.integration.SpringIntegrationComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SpringIntegrationComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class SpringIntegrationComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class SpringIntegrationComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.spring-integration"); + if (isEnabled(conditionContext, + "camel.component.spring-integration.", groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-integration-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-integration-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-spring-integration-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c615f54 --- /dev/null +++ b/components-starter/camel-spring-integration-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.spring-integration.enabled", + "description": "Enable spring-integration component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java b/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java index c505615..aa5947c 100644 --- a/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java +++ b/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.springldap.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.springldap.SpringLdapComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SpringLdapComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class SpringLdapComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class SpringLdapComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.spring-ldap"); + if (isEnabled(conditionContext, "camel.component.spring-ldap.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-ldap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-ldap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-spring-ldap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..e166123 --- /dev/null +++ b/components-starter/camel-spring-ldap-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.spring-ldap.enabled", + "description": "Enable spring-ldap component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java b/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java index bf8d0cd..7ed6d31 100644 --- a/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java +++ b/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.redis.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.redis.RedisComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(RedisComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class RedisComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class RedisComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.spring-redis"); + if (isEnabled(conditionContext, "camel.component.spring-redis.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-redis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-redis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-spring-redis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c13268f --- /dev/null +++ b/components-starter/camel-spring-redis-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.spring-redis.enabled", + "description": "Enable spring-redis component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java b/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java index 2327dfd..3ba4859a 100644 --- a/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java +++ b/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.event.EventComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(EventComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(EventComponentConfiguration.class) public class EventComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class EventComponentAutoConfiguration { 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.spring-event"); + if (isEnabled(conditionContext, "camel.component.spring-event.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java b/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java index 08c0ecc..dd046f0 100644 --- a/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java +++ b/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.spel.SpelLanguage; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SpelLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SpelLanguageConfiguration.class) public class SpelLanguageAutoConfiguration { @@ -55,4 +63,29 @@ public class SpelLanguageAutoConfiguration { 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.spel"); + if (isEnabled(conditionContext, "camel.language.spel.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..0a8267e --- /dev/null +++ b/components-starter/camel-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.spring-event.enabled", + "description": "Enable spring-event component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.spel.enabled", + "description": "Enable spel language", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java b/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java index d3f88fc..20a00c5 100644 --- a/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java +++ b/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.spring.ws.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.spring.ws.SpringWebserviceComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SpringWebserviceComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class SpringWebserviceComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class SpringWebserviceComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.spring-ws"); + if (isEnabled(conditionContext, "camel.component.spring-ws.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-spring-ws-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-spring-ws-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-spring-ws-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c8467ea --- /dev/null +++ b/components-starter/camel-spring-ws-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.spring-ws.enabled", + "description": "Enable spring-ws component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java b/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java index 1234f31..ecfbf6d 100644 --- a/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java +++ b/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.sql.SqlComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SqlComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SqlComponentConfiguration.class) public class SqlComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class SqlComponentAutoConfiguration { 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.sql"); + if (isEnabled(conditionContext, "camel.component.sql.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java b/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java index 28aa79d..dfc919a 100644 --- a/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java +++ b/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.sql.stored.SqlStoredComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SqlStoredComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SqlStoredComponentConfiguration.class) public class SqlStoredComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class SqlStoredComponentAutoConfiguration { 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.sql-stored"); + if (isEnabled(conditionContext, "camel.component.sql-stored.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-sql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-sql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-sql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..02bf094 --- /dev/null +++ b/components-starter/camel-sql-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.sql.enabled", + "description": "Enable sql component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.sql-stored.enabled", + "description": "Enable sql-stored component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java b/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java index 9a1cc4a..2f92b42 100644 --- a/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java +++ b/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.ssh.SshComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SshComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SshComponentConfiguration.class) public class SshComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class SshComponentAutoConfiguration { 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.ssh"); + if (isEnabled(conditionContext, "camel.component.ssh.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-ssh-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-ssh-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-ssh-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c95d896 --- /dev/null +++ b/components-starter/camel-ssh-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.ssh.enabled", + "description": "Enable ssh component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java b/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java index fbe8a2b..11bed18 100644 --- a/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java +++ b/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.stax.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.stax.StAXComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(StAXComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class StAXComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class StAXComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.stax"); + if (isEnabled(conditionContext, "camel.component.stax.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stax-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-stax-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-stax-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..9144b0a --- /dev/null +++ b/components-starter/camel-stax-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.stax.enabled", + "description": "Enable stax component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java b/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java index e922902..f5c630a 100644 --- a/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java +++ b/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.stomp.StompComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(StompComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(StompComponentConfiguration.class) public class StompComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class StompComponentAutoConfiguration { 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.stomp"); + if (isEnabled(conditionContext, "camel.component.stomp.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stomp-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-stomp-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-stomp-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..7c38a1d --- /dev/null +++ b/components-starter/camel-stomp-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.stomp.enabled", + "description": "Enable stomp component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java b/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java index 3df9cd3..e8a2a42 100644 --- a/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java +++ b/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.stream.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.stream.StreamComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(StreamComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class StreamComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class StreamComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.stream"); + if (isEnabled(conditionContext, "camel.component.stream.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stream-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-stream-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-stream-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..4c314be --- /dev/null +++ b/components-starter/camel-stream-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.stream.enabled", + "description": "Enable stream component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java b/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java index f8d88f8..e4ecfbe 100644 --- a/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java +++ b/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.stringtemplate.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.stringtemplate.StringTemplateComponent; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(StringTemplateComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class StringTemplateComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class StringTemplateComponentAutoConfiguration { component.setCamelContext(camelContext); return component; } + + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.string-template"); + if (isEnabled(conditionContext, "camel.component.string-template.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-stringtemplate-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-stringtemplate-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-stringtemplate-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..4df872c --- /dev/null +++ b/components-starter/camel-stringtemplate-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.string-template.enabled", + "description": "Enable string-template component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java b/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java index d840401..5f5b8e4 100644 --- a/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java +++ b/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.component.syslog.SyslogDataFormat; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(SyslogDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SyslogDataFormatConfiguration.class) public class SyslogDataFormatAutoConfiguration { @@ -56,4 +64,29 @@ public class SyslogDataFormatAutoConfiguration { 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.syslog"); + if (isEnabled(conditionContext, "camel.dataformat.syslog.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-syslog-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-syslog-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-syslog-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..dbb9680 --- /dev/null +++ b/components-starter/camel-syslog-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.syslog.enabled", + "description": "Enable syslog dataformat", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java b/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java index fb3b5ca..d808951 100644 --- a/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java +++ b/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.dataformat.tagsoup.TidyMarkupDataFormat; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(TidyMarkupDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(TidyMarkupDataFormatConfiguration.class) public class TidyMarkupDataFormatAutoConfiguration { @@ -56,4 +64,29 @@ public class TidyMarkupDataFormatAutoConfiguration { 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.tidymarkup"); + if (isEnabled(conditionContext, "camel.dataformat.tidymarkup.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-tagsoup-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-tagsoup-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-tagsoup-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..e610360 --- /dev/null +++ b/components-starter/camel-tagsoup-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.tidymarkup.enabled", + "description": "Enable tidymarkup dataformat", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java b/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java index 832e21e..30b0f13 100644 --- a/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java +++ b/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.dataformat.tarfile.TarFileDataFormat; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(TarFileDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(TarFileDataFormatConfiguration.class) public class TarFileDataFormatAutoConfiguration { @@ -56,4 +64,29 @@ public class TarFileDataFormatAutoConfiguration { 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.tarfile"); + if (isEnabled(conditionContext, "camel.dataformat.tarfile.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-tarfile-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-tarfile-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-tarfile-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..a3dc1b8 --- /dev/null +++ b/components-starter/camel-tarfile-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.tarfile.enabled", + "description": "Enable tarfile dataformat", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java b/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java index d19cf1b..cc1f352 100644 --- a/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java +++ b/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.telegram.TelegramComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(TelegramComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(TelegramComponentConfiguration.class) public class TelegramComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class TelegramComponentAutoConfiguration { 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.telegram"); + if (isEnabled(conditionContext, "camel.component.telegram.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-telegram-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-telegram-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-telegram-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..50e5600 --- /dev/null +++ b/components-starter/camel-telegram-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.telegram.enabled", + "description": "Enable telegram component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java b/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java index 48a186c..c90ca96 100644 --- a/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java +++ b/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.twitter.TwitterComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(TwitterComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(TwitterComponentConfiguration.class) public class TwitterComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class TwitterComponentAutoConfiguration { 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.twitter"); + if (isEnabled(conditionContext, "camel.component.twitter.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-twitter-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-twitter-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-twitter-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..e73ba87 --- /dev/null +++ b/components-starter/camel-twitter-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.twitter.enabled", + "description": "Enable twitter component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java b/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java index c3d940d..aa201bb 100644 --- a/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java +++ b/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.undertow.UndertowComponent; import org.apache.camel.util.IntrospectionSupport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.type.AnnotatedTypeMetadata; /** * Generated by camel-package-maven-plugin - do not edit this file! */ @Configuration @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(UndertowComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(UndertowComponentConfiguration.class) public class UndertowComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class UndertowComponentAutoConfiguration { 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.undertow"); + if (isEnabled(conditionContext, "camel.component.undertow.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-undertow-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-undertow-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-undertow-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..1cf4333 --- /dev/null +++ b/components-starter/camel-undertow-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.undertow.enabled", + "description": "Enable undertow component", + "type": "java.lang.Boolean" + } + ] +} \ No newline at end of file
