Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E263A200BFB for ; Tue, 6 Dec 2016 13:31:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DCB36160B0C; Tue, 6 Dec 2016 12:31:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8FEE5160B1B for ; Tue, 6 Dec 2016 13:31:47 +0100 (CET) Received: (qmail 80165 invoked by uid 500); 6 Dec 2016 12:31:46 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 79136 invoked by uid 99); 6 Dec 2016 12:31:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2016 12:31:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2A3B2F2140; Tue, 6 Dec 2016 12:31:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lburgazzoli@apache.org To: commits@camel.apache.org Date: Tue, 06 Dec 2016 12:31:56 -0000 Message-Id: <9e159d9c815940c9997177af9170329d@git.apache.org> In-Reply-To: <295450d748544e57adfa919c37fcc5fb@git.apache.org> References: <295450d748544e57adfa919c37fcc5fb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [13/21] camel git commit: CAMEL-10550: spring-boot: add a global option to disable data-format, languages and component auto configurations archived-at: Tue, 06 Dec 2016 12:31:50 -0000 http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java index a2669e6..a6b1fdc 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.simple.FileLanguage; 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(FileLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(FileLanguageConfiguration.class) public class FileLanguageAutoConfiguration { @@ -55,4 +63,29 @@ public class FileLanguageAutoConfiguration { 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.file"); + if (isEnabled(conditionContext, "camel.language.file.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java index 1f53f0e..58b1b6a 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.simple.SimpleLanguage; 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(SimpleLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(SimpleLanguageConfiguration.class) public class SimpleLanguageAutoConfiguration { @@ -55,4 +63,29 @@ public class SimpleLanguageAutoConfiguration { 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.simple"); + if (isEnabled(conditionContext, "camel.language.simple.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java index 5592e64..111390a 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.tokenizer.TokenizeLanguage; 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(TokenizeLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(TokenizeLanguageConfiguration.class) public class TokenizeLanguageAutoConfiguration { @@ -56,4 +64,29 @@ public class TokenizeLanguageAutoConfiguration { 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.tokenize"); + if (isEnabled(conditionContext, "camel.language.tokenize.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java index 4c9b111..a796e51 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.tokenizer.XMLTokenizeLanguage; 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(XMLTokenizeLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(XMLTokenizeLanguageConfiguration.class) public class XMLTokenizeLanguageAutoConfiguration { @@ -56,4 +64,29 @@ public class XMLTokenizeLanguageAutoConfiguration { 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.xtokenize"); + if (isEnabled(conditionContext, "camel.language.xtokenize.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java index 76cd28e..4bc9441 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.language.xpath.XPathLanguage; 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(XPathLanguageAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(XPathLanguageConfiguration.class) public class XPathLanguageAutoConfiguration { @@ -55,4 +63,29 @@ public class XPathLanguageAutoConfiguration { 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.xpath"); + if (isEnabled(conditionContext, "camel.language.xpath.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-core-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-core-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c194149 --- /dev/null +++ b/components-starter/camel-core-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,238 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.ref.enabled", + "description": "Enable ref component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.controlbus.enabled", + "description": "Enable controlbus component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.direct.enabled", + "description": "Enable direct component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.vm.enabled", + "description": "Enable vm component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.mock.enabled", + "description": "Enable mock component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.browse.enabled", + "description": "Enable browse component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.direct-vm.enabled", + "description": "Enable direct-vm component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.file.enabled", + "description": "Enable file component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.language.enabled", + "description": "Enable language component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.timer.enabled", + "description": "Enable timer component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.test.enabled", + "description": "Enable test component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.class.enabled", + "description": "Enable class component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.seda.enabled", + "description": "Enable seda component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.dataset.enabled", + "description": "Enable dataset component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.stub.enabled", + "description": "Enable stub component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.log.enabled", + "description": "Enable log component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.scheduler.enabled", + "description": "Enable scheduler component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.binding.enabled", + "description": "Enable binding component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.xslt.enabled", + "description": "Enable xslt component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.bean.enabled", + "description": "Enable bean component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.dataformat.enabled", + "description": "Enable dataformat component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.rest-api.enabled", + "description": "Enable rest-api component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.rest.enabled", + "description": "Enable rest component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.validator.enabled", + "description": "Enable validator component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.properties.enabled", + "description": "Enable properties component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.dataformat.string.enabled", + "description": "Enable string dataformat", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.dataformat.zip.enabled", + "description": "Enable zip dataformat", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.dataformat.serialization.enabled", + "description": "Enable serialization dataformat", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.dataformat.gzip.enabled", + "description": "Enable gzip dataformat", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.constant.enabled", + "description": "Enable constant language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.simple.enabled", + "description": "Enable simple language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.bean.enabled", + "description": "Enable bean language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.ref.enabled", + "description": "Enable ref language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.header.enabled", + "description": "Enable header language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.xpath.enabled", + "description": "Enable xpath language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.file.enabled", + "description": "Enable file language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.exchangeproperty.enabled", + "description": "Enable exchangeproperty language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.tokenize.enabled", + "description": "Enable tokenize language", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.language.xtokenize.enabled", + "description": "Enable xtokenize 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-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java b/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java index 9566924..8896786 100644 --- a/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java +++ b/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.couchdb.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.couchdb.CouchDbComponent; 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(CouchDbComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class CouchDbComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class CouchDbComponentAutoConfiguration { 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.couchdb"); + if (isEnabled(conditionContext, "camel.component.couchdb.", + 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-couchdb-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-couchdb-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-couchdb-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..d56de16 --- /dev/null +++ b/components-starter/camel-couchdb-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.couchdb.enabled", + "description": "Enable couchdb 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-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java b/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java index 4b7b89b..37a1454 100644 --- a/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java +++ b/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.crypto.DigitalSignatureComponent; 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(DigitalSignatureComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(DigitalSignatureComponentConfiguration.class) public class DigitalSignatureComponentAutoConfiguration { @@ -74,4 +82,29 @@ public class DigitalSignatureComponentAutoConfiguration { 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.crypto"); + if (isEnabled(conditionContext, "camel.component.crypto.", + 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-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java b/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java index c32d88b..156dcdd 100644 --- a/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java +++ b/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.converter.crypto.CryptoDataFormat; 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(CryptoDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(CryptoDataFormatConfiguration.class) public class CryptoDataFormatAutoConfiguration { @@ -56,4 +64,29 @@ public class CryptoDataFormatAutoConfiguration { 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.crypto"); + if (isEnabled(conditionContext, "camel.dataformat.crypto.", + 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-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java b/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java index 53bb3a5..64feec0 100644 --- a/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java +++ b/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.converter.crypto.PGPDataFormat; 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(PGPDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(PGPDataFormatConfiguration.class) public class PGPDataFormatAutoConfiguration { @@ -55,4 +63,29 @@ public class PGPDataFormatAutoConfiguration { 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.pgp"); + if (isEnabled(conditionContext, "camel.dataformat.pgp.", + 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-crypto-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-crypto-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-crypto-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..8334237 --- /dev/null +++ b/components-starter/camel-crypto-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,22 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.crypto.enabled", + "description": "Enable crypto component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.dataformat.pgp.enabled", + "description": "Enable pgp dataformat", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.dataformat.crypto.enabled", + "description": "Enable crypto 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-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java b/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java index f884790..8497611 100644 --- a/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java +++ b/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java @@ -23,18 +23,26 @@ import org.apache.camel.CamelContextAware; import org.apache.camel.dataformat.csv.CsvDataFormat; 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(CsvDataFormatAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(CsvDataFormatConfiguration.class) public class CsvDataFormatAutoConfiguration { @@ -55,4 +63,29 @@ public class CsvDataFormatAutoConfiguration { 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.csv"); + if (isEnabled(conditionContext, "camel.dataformat.csv.", + 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-csv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-csv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-csv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..2936910 --- /dev/null +++ b/components-starter/camel-csv-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.dataformat.csv.enabled", + "description": "Enable csv 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-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java b/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java index d6a5346..6e88c31 100644 --- a/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java +++ b/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.cxf.jaxrs.CxfRsComponent; 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(CxfRsComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(CxfRsComponentConfiguration.class) public class CxfRsComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class CxfRsComponentAutoConfiguration { 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.cxfrs"); + if (isEnabled(conditionContext, "camel.component.cxfrs.", + 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-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java b/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java index bdbd0ba..bf4df40 100644 --- a/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java +++ b/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.cxf.CxfComponent; 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(CxfComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(CxfComponentConfiguration.class) public class CxfComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class CxfComponentAutoConfiguration { 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.cxf"); + if (isEnabled(conditionContext, "camel.component.cxf.", + 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-cxf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-cxf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-cxf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..73db505 --- /dev/null +++ b/components-starter/camel-cxf-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.cxfrs.enabled", + "description": "Enable cxfrs component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.cxf.enabled", + "description": "Enable cxf 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-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java index 2d8b29c..d2ca0e0 100644 --- a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java +++ b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.disruptor.DisruptorComponent; 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(DisruptorComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(DisruptorComponentConfiguration.class) public class DisruptorComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class DisruptorComponentAutoConfiguration { 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.disruptor"); + if (isEnabled(conditionContext, "camel.component.disruptor.", + 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-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java index f128f32..f5cf1d4 100644 --- a/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java +++ b/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.disruptor.vm.DisruptorVmComponent; 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(DisruptorVmComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(DisruptorVmComponentConfiguration.class) public class DisruptorVmComponentAutoConfiguration { @@ -73,4 +81,29 @@ public class DisruptorVmComponentAutoConfiguration { 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.disruptor-vm"); + if (isEnabled(conditionContext, "camel.component.disruptor-vm.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/21b0fe2c/components-starter/camel-disruptor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-disruptor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-disruptor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..a853099 --- /dev/null +++ b/components-starter/camel-disruptor-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,16 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.disruptor.enabled", + "description": "Enable disruptor component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.disruptor-vm.enabled", + "description": "Enable disruptor-vm 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-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java b/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java index 708aec5..5710a32 100644 --- a/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java +++ b/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.dns.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.dns.DnsComponent; 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(DnsComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class DnsComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class DnsComponentAutoConfiguration { 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.dns"); + if (isEnabled(conditionContext, "camel.component.dns.", + 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-dns-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-dns-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-dns-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..3b98d3b --- /dev/null +++ b/components-starter/camel-dns-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.dns.enabled", + "description": "Enable dns 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-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java b/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java index bdc6839..b3e0384 100644 --- a/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java +++ b/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java @@ -22,18 +22,26 @@ import org.apache.camel.CamelContext; import org.apache.camel.component.docker.DockerComponent; 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(DockerComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") @EnableConfigurationProperties(DockerComponentConfiguration.class) public class DockerComponentAutoConfiguration { @@ -72,4 +80,29 @@ public class DockerComponentAutoConfiguration { 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.docker"); + if (isEnabled(conditionContext, "camel.component.docker.", + 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-docker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-docker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-docker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..c424de2 --- /dev/null +++ b/components-starter/camel-docker-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.docker.enabled", + "description": "Enable docker 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-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java b/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java index 91a3a2d..f7cfd66 100644 --- a/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java +++ b/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.dozer.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.dozer.DozerComponent; 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(DozerComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class DozerComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class DozerComponentAutoConfiguration { 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.dozer"); + if (isEnabled(conditionContext, "camel.component.dozer.", + 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-dozer-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-dozer-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-dozer-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..56d4a2a --- /dev/null +++ b/components-starter/camel-dozer-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.dozer.enabled", + "description": "Enable dozer 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-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java b/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java index 0a55dbc..b6cf189 100644 --- a/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java +++ b/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.drill.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.drill.DrillComponent; 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(DrillComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class DrillComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class DrillComponentAutoConfiguration { 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.drill"); + if (isEnabled(conditionContext, "camel.component.drill.", + 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-drill-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/components-starter/camel-drill-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/components-starter/camel-drill-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..b42b337 --- /dev/null +++ b/components-starter/camel-drill-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,10 @@ +{ + "properties": [ + { + "defaultValue": true, + "name": "camel.component.drill.enabled", + "description": "Enable drill 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-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java b/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java index 7e85d4f..1d891be 100644 --- a/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java +++ b/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java @@ -19,17 +19,25 @@ package org.apache.camel.component.dropbox.springboot; import org.apache.camel.CamelContext; import org.apache.camel.component.dropbox.DropboxComponent; 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(DropboxComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") public class DropboxComponentAutoConfiguration { @@ -42,4 +50,29 @@ public class DropboxComponentAutoConfiguration { 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.dropbox"); + if (isEnabled(conditionContext, "camel.component.dropbox.", + 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