You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/01/16 17:30:36 UTC
[38/52] [partial] camel git commit: CAMEL-10622: Move spring-boot
components starter to platforms/spring-boot/
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java
deleted file mode 100644
index d9a7aaa..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.controlbus.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.controlbus.ControlBusComponent;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionMessage;
-import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Configuration
-@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@Conditional(ControlBusComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class ControlBusComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "controlbus-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(ControlBusComponent.class)
- public ControlBusComponent configureControlBusComponent(
- CamelContext camelContext) throws Exception {
- ControlBusComponent component = new ControlBusComponent();
- component.setCamelContext(camelContext);
- return component;
- }
-
- public static class Condition extends SpringBootCondition {
- @Override
- public ConditionOutcome getMatchOutcome(
- ConditionContext conditionContext,
- AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext,
- "camel.component.", true);
- ConditionMessage.Builder message = ConditionMessage
- .forCondition("camel.component.controlbus");
- if (isEnabled(conditionContext, "camel.component.controlbus.",
- groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
-
- private boolean isEnabled(
- org.springframework.context.annotation.ConditionContext context,
- java.lang.String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
- context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java
deleted file mode 100644
index c574bdc..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.dataformat.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.dataformat.DataFormatComponent;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionMessage;
-import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Configuration
-@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@Conditional(DataFormatComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class DataFormatComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "dataformat-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(DataFormatComponent.class)
- public DataFormatComponent configureDataFormatComponent(
- CamelContext camelContext) throws Exception {
- DataFormatComponent component = new DataFormatComponent();
- component.setCamelContext(camelContext);
- return component;
- }
-
- public static class Condition extends SpringBootCondition {
- @Override
- public ConditionOutcome getMatchOutcome(
- ConditionContext conditionContext,
- AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext,
- "camel.component.", true);
- ConditionMessage.Builder message = ConditionMessage
- .forCondition("camel.component.dataformat");
- if (isEnabled(conditionContext, "camel.component.dataformat.",
- groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
-
- private boolean isEnabled(
- org.springframework.context.annotation.ConditionContext context,
- java.lang.String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
- context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java
deleted file mode 100644
index e3d205c..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.dataset.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.dataset.DataSetComponent;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionMessage;
-import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Configuration
-@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@Conditional(DataSetComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class DataSetComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "dataset-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(DataSetComponent.class)
- public DataSetComponent configureDataSetComponent(CamelContext camelContext)
- throws Exception {
- DataSetComponent component = new DataSetComponent();
- component.setCamelContext(camelContext);
- return component;
- }
-
- public static class Condition extends SpringBootCondition {
- @Override
- public ConditionOutcome getMatchOutcome(
- ConditionContext conditionContext,
- AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext,
- "camel.component.", true);
- ConditionMessage.Builder message = ConditionMessage
- .forCondition("camel.component.dataset");
- if (isEnabled(conditionContext, "camel.component.dataset.",
- groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
-
- private boolean isEnabled(
- org.springframework.context.annotation.ConditionContext context,
- java.lang.String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
- context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java
deleted file mode 100644
index 07aa4d9..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.direct.springboot;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.direct.DirectComponent;
-import org.apache.camel.util.IntrospectionSupport;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionMessage;
-import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Configuration
-@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@Conditional(DirectComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@EnableConfigurationProperties(DirectComponentConfiguration.class)
-public class DirectComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "direct-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(DirectComponent.class)
- public DirectComponent configureDirectComponent(CamelContext camelContext,
- DirectComponentConfiguration configuration) throws Exception {
- DirectComponent component = new DirectComponent();
- component.setCamelContext(camelContext);
- Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(configuration, parameters, null,
- false);
- for (Map.Entry<String, Object> entry : parameters.entrySet()) {
- Object value = entry.getValue();
- Class<?> paramClass = value.getClass();
- if (paramClass.getName().endsWith("NestedConfiguration")) {
- Class nestedClass = null;
- try {
- nestedClass = (Class) paramClass.getDeclaredField(
- "CAMEL_NESTED_CLASS").get(null);
- HashMap<String, Object> nestedParameters = new HashMap<>();
- IntrospectionSupport.getProperties(value, nestedParameters,
- null, false);
- Object nestedProperty = nestedClass.newInstance();
- IntrospectionSupport.setProperties(camelContext,
- camelContext.getTypeConverter(), nestedProperty,
- nestedParameters);
- entry.setValue(nestedProperty);
- } catch (NoSuchFieldException e) {
- }
- }
- }
- IntrospectionSupport.setProperties(camelContext,
- camelContext.getTypeConverter(), component, parameters);
- return component;
- }
-
- public static class Condition extends SpringBootCondition {
- @Override
- public ConditionOutcome getMatchOutcome(
- ConditionContext conditionContext,
- AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext,
- "camel.component.", true);
- ConditionMessage.Builder message = ConditionMessage
- .forCondition("camel.component.direct");
- if (isEnabled(conditionContext, "camel.component.direct.",
- groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
-
- private boolean isEnabled(
- org.springframework.context.annotation.ConditionContext context,
- java.lang.String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
- context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java
deleted file mode 100644
index 3187c0d..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.direct.springboot;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * The direct component provides direct synchronous call to another endpoint
- * from the same CamelContext.
- *
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@ConfigurationProperties(prefix = "camel.component.direct")
-public class DirectComponentConfiguration {
-
- /**
- * If sending a message to a direct endpoint which has no active consumer
- * then we can tell the producer to block and wait for the consumer to
- * become active.
- */
- private Boolean block = false;
- /**
- * The timeout value to use if block is enabled.
- */
- private Long timeout = 30000L;
-
- public Boolean getBlock() {
- return block;
- }
-
- public void setBlock(Boolean block) {
- this.block = block;
- }
-
- public Long getTimeout() {
- return timeout;
- }
-
- public void setTimeout(Long timeout) {
- this.timeout = timeout;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java
deleted file mode 100644
index 33a1e2a..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.directvm.springboot;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.directvm.DirectVmComponent;
-import org.apache.camel.util.IntrospectionSupport;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionMessage;
-import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Configuration
-@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@Conditional(DirectVmComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@EnableConfigurationProperties(DirectVmComponentConfiguration.class)
-public class DirectVmComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "direct-vm-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(DirectVmComponent.class)
- public DirectVmComponent configureDirectVmComponent(
- CamelContext camelContext,
- DirectVmComponentConfiguration configuration) throws Exception {
- DirectVmComponent component = new DirectVmComponent();
- component.setCamelContext(camelContext);
- Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(configuration, parameters, null,
- false);
- for (Map.Entry<String, Object> entry : parameters.entrySet()) {
- Object value = entry.getValue();
- Class<?> paramClass = value.getClass();
- if (paramClass.getName().endsWith("NestedConfiguration")) {
- Class nestedClass = null;
- try {
- nestedClass = (Class) paramClass.getDeclaredField(
- "CAMEL_NESTED_CLASS").get(null);
- HashMap<String, Object> nestedParameters = new HashMap<>();
- IntrospectionSupport.getProperties(value, nestedParameters,
- null, false);
- Object nestedProperty = nestedClass.newInstance();
- IntrospectionSupport.setProperties(camelContext,
- camelContext.getTypeConverter(), nestedProperty,
- nestedParameters);
- entry.setValue(nestedProperty);
- } catch (NoSuchFieldException e) {
- }
- }
- }
- IntrospectionSupport.setProperties(camelContext,
- camelContext.getTypeConverter(), component, parameters);
- return component;
- }
-
- public static class Condition extends SpringBootCondition {
- @Override
- public ConditionOutcome getMatchOutcome(
- ConditionContext conditionContext,
- AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext,
- "camel.component.", true);
- ConditionMessage.Builder message = ConditionMessage
- .forCondition("camel.component.direct-vm");
- if (isEnabled(conditionContext, "camel.component.direct-vm.",
- groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
-
- private boolean isEnabled(
- org.springframework.context.annotation.ConditionContext context,
- java.lang.String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
- context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java
deleted file mode 100644
index 9b9de46..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.directvm.springboot;
-
-import org.apache.camel.spi.HeaderFilterStrategy;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.NestedConfigurationProperty;
-
-/**
- * The direct-vm component provides direct synchronous call to another endpoint
- * from any CamelContext in the same JVM.
- *
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@ConfigurationProperties(prefix = "camel.component.direct-vm")
-public class DirectVmComponentConfiguration {
-
- /**
- * If sending a message to a direct endpoint which has no active consumer
- * then we can tell the producer to block and wait for the consumer to
- * become active.
- */
- private Boolean block = false;
- /**
- * The timeout value to use if block is enabled.
- */
- private Long timeout = 30000L;
- /**
- * Sets a HeaderFilterStrategy that will only be applied on producer
- * endpoints (on both directions: request and response). Default value:
- * none.
- */
- @NestedConfigurationProperty
- private HeaderFilterStrategy headerFilterStrategy;
- /**
- * Whether to propagate or not properties from the producer side to the
- * consumer side and vice versa. Default value: true.
- */
- private Boolean propagateProperties = true;
-
- public Boolean getBlock() {
- return block;
- }
-
- public void setBlock(Boolean block) {
- this.block = block;
- }
-
- public Long getTimeout() {
- return timeout;
- }
-
- public void setTimeout(Long timeout) {
- this.timeout = timeout;
- }
-
- public HeaderFilterStrategy getHeaderFilterStrategy() {
- return headerFilterStrategy;
- }
-
- public void setHeaderFilterStrategy(
- HeaderFilterStrategy headerFilterStrategy) {
- this.headerFilterStrategy = headerFilterStrategy;
- }
-
- public Boolean getPropagateProperties() {
- return propagateProperties;
- }
-
- public void setPropagateProperties(Boolean propagateProperties) {
- this.propagateProperties = propagateProperties;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java
deleted file mode 100644
index 8b82256..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.file.FileComponent;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionMessage;
-import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Configuration
-@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@Conditional(FileComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class FileComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "file-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(FileComponent.class)
- public FileComponent configureFileComponent(CamelContext camelContext)
- throws Exception {
- FileComponent component = new FileComponent();
- component.setCamelContext(camelContext);
- return component;
- }
-
- public static class Condition extends SpringBootCondition {
- @Override
- public ConditionOutcome getMatchOutcome(
- ConditionContext conditionContext,
- AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext,
- "camel.component.", true);
- ConditionMessage.Builder message = ConditionMessage
- .forCondition("camel.component.file");
- if (isEnabled(conditionContext, "camel.component.file.",
- groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
-
- private boolean isEnabled(
- org.springframework.context.annotation.ConditionContext context,
- java.lang.String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
- context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java
deleted file mode 100644
index a67110a..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.language.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.language.LanguageComponent;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionMessage;
-import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ConditionContext;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.type.AnnotatedTypeMetadata;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Configuration
-@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@Conditional(LanguageComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class LanguageComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "language-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(LanguageComponent.class)
- public LanguageComponent configureLanguageComponent(
- CamelContext camelContext) throws Exception {
- LanguageComponent component = new LanguageComponent();
- component.setCamelContext(camelContext);
- return component;
- }
-
- public static class Condition extends SpringBootCondition {
- @Override
- public ConditionOutcome getMatchOutcome(
- ConditionContext conditionContext,
- AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext,
- "camel.component.", true);
- ConditionMessage.Builder message = ConditionMessage
- .forCondition("camel.component.language");
- if (isEnabled(conditionContext, "camel.component.language.",
- groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
-
- private boolean isEnabled(
- org.springframework.context.annotation.ConditionContext context,
- java.lang.String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
- context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java
deleted file mode 100644
index 5a95fce..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.log.springboot;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.log.LogComponent;
-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.context.annotation.Lazy;
-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(LogComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@EnableConfigurationProperties(LogComponentConfiguration.class)
-public class LogComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "log-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(LogComponent.class)
- public LogComponent configureLogComponent(CamelContext camelContext,
- LogComponentConfiguration configuration) throws Exception {
- LogComponent component = new LogComponent();
- component.setCamelContext(camelContext);
- Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(configuration, parameters, null,
- false);
- for (Map.Entry<String, Object> entry : parameters.entrySet()) {
- Object value = entry.getValue();
- Class<?> paramClass = value.getClass();
- if (paramClass.getName().endsWith("NestedConfiguration")) {
- Class nestedClass = null;
- try {
- nestedClass = (Class) paramClass.getDeclaredField(
- "CAMEL_NESTED_CLASS").get(null);
- HashMap<String, Object> nestedParameters = new HashMap<>();
- IntrospectionSupport.getProperties(value, nestedParameters,
- null, false);
- Object nestedProperty = nestedClass.newInstance();
- IntrospectionSupport.setProperties(camelContext,
- camelContext.getTypeConverter(), nestedProperty,
- nestedParameters);
- entry.setValue(nestedProperty);
- } catch (NoSuchFieldException e) {
- }
- }
- }
- IntrospectionSupport.setProperties(camelContext,
- 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.log");
- if (isEnabled(conditionContext, "camel.component.log.",
- 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/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java
deleted file mode 100644
index c7a8ecc..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.log.springboot;
-
-import org.apache.camel.spi.ExchangeFormatter;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.NestedConfigurationProperty;
-
-/**
- * The log component logs message exchanges to the underlying logging mechanism.
- *
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@ConfigurationProperties(prefix = "camel.component.log")
-public class LogComponentConfiguration {
-
- /**
- * Sets a custom ExchangeFormatter to convert the Exchange to a String
- * suitable for logging. If not specified we default to
- * DefaultExchangeFormatter.
- */
- @NestedConfigurationProperty
- private ExchangeFormatter exchangeFormatter;
-
- public ExchangeFormatter getExchangeFormatter() {
- return exchangeFormatter;
- }
-
- public void setExchangeFormatter(ExchangeFormatter exchangeFormatter) {
- this.exchangeFormatter = exchangeFormatter;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java
deleted file mode 100644
index 73167f4..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.mock.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.mock.MockComponent;
-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.context.annotation.Lazy;
-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(MockComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class MockComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "mock-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(MockComponent.class)
- public MockComponent configureMockComponent(CamelContext camelContext)
- throws Exception {
- MockComponent component = new MockComponent();
- 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.mock");
- if (isEnabled(conditionContext, "camel.component.mock.",
- 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/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java
deleted file mode 100644
index a6ee450..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.properties.springboot;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.properties.PropertiesComponent;
-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.context.annotation.Lazy;
-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(PropertiesComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@EnableConfigurationProperties(PropertiesComponentConfiguration.class)
-public class PropertiesComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "properties-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(PropertiesComponent.class)
- public PropertiesComponent configurePropertiesComponent(
- CamelContext camelContext,
- PropertiesComponentConfiguration configuration) throws Exception {
- PropertiesComponent component = new PropertiesComponent();
- component.setCamelContext(camelContext);
- Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(configuration, parameters, null,
- false);
- for (Map.Entry<String, Object> entry : parameters.entrySet()) {
- Object value = entry.getValue();
- Class<?> paramClass = value.getClass();
- if (paramClass.getName().endsWith("NestedConfiguration")) {
- Class nestedClass = null;
- try {
- nestedClass = (Class) paramClass.getDeclaredField(
- "CAMEL_NESTED_CLASS").get(null);
- HashMap<String, Object> nestedParameters = new HashMap<>();
- IntrospectionSupport.getProperties(value, nestedParameters,
- null, false);
- Object nestedProperty = nestedClass.newInstance();
- IntrospectionSupport.setProperties(camelContext,
- camelContext.getTypeConverter(), nestedProperty,
- nestedParameters);
- entry.setValue(nestedProperty);
- } catch (NoSuchFieldException e) {
- }
- }
- }
- IntrospectionSupport.setProperties(camelContext,
- 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.properties");
- if (isEnabled(conditionContext, "camel.component.properties.",
- 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/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
deleted file mode 100644
index 0f16ccd..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.properties.springboot;
-
-import java.util.List;
-import java.util.Properties;
-import org.apache.camel.component.properties.PropertiesLocation;
-import org.apache.camel.component.properties.PropertiesParser;
-import org.apache.camel.component.properties.PropertiesResolver;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.NestedConfigurationProperty;
-
-/**
- * The properties component is used for using property placeholders in endpoint
- * uris.
- *
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@ConfigurationProperties(prefix = "camel.component.properties")
-public class PropertiesComponentConfiguration {
-
- /**
- * A list of locations to load properties. This option will override any
- * default locations and only use the locations from this option.
- */
- private List<PropertiesLocation> locations;
- /**
- * A list of locations to load properties. You can use comma to separate
- * multiple locations. This option will override any default locations and
- * only use the locations from this option.
- */
- private String location;
- /**
- * Encoding to use when loading properties file from the file system or
- * classpath. If no encoding has been set then the properties files is
- * loaded using ISO-8859-1 encoding (latin-1) as documented by link
- * java.util.Propertiesload(java.io.InputStream)
- */
- private String encoding;
- /**
- * To use a custom PropertiesResolver
- */
- @NestedConfigurationProperty
- private PropertiesResolver propertiesResolver;
- /**
- * To use a custom PropertiesParser
- */
- @NestedConfigurationProperty
- private PropertiesParser propertiesParser;
- /**
- * Whether or not to cache loaded properties. The default value is true.
- */
- private Boolean cache = true;
- /**
- * Optional prefix prepended to property names before resolution.
- */
- private String propertyPrefix;
- /**
- * Optional suffix appended to property names before resolution.
- */
- private String propertySuffix;
- /**
- * If true first attempt resolution of property name augmented with
- * propertyPrefix and propertySuffix before falling back the plain property
- * name specified. If false only the augmented property name is searched.
- */
- private Boolean fallbackToUnaugmentedProperty = true;
- /**
- * If false the component does not attempt to find a default for the key by
- * looking after the colon separator.
- */
- private Boolean defaultFallbackEnabled = true;
- /**
- * Whether to silently ignore if a location cannot be located such as a
- * properties file not found.
- */
- private Boolean ignoreMissingLocation = false;
- /**
- * Sets the value of the prefix token used to identify properties to
- * replace. Setting a value of null restores the default token (link link
- * DEFAULT_PREFIX_TOKEN).
- */
- private String prefixToken = "{{";
- /**
- * Sets the value of the suffix token used to identify properties to
- * replace. Setting a value of null restores the default token (link link
- * DEFAULT_SUFFIX_TOKEN).
- */
- private String suffixToken = "}}";
- /**
- * Sets initial properties which will be used before any locations are
- * resolved.
- */
- private Properties initialProperties;
- /**
- * Sets a special list of override properties that take precedence and will
- * use first if a property exist.
- */
- private Properties overrideProperties;
- /**
- * Sets the system property mode.
- */
- private Integer systemPropertiesMode = 2;
-
- public List<PropertiesLocation> getLocations() {
- return locations;
- }
-
- public void setLocations(List<PropertiesLocation> locations) {
- this.locations = locations;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getEncoding() {
- return encoding;
- }
-
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- public PropertiesResolver getPropertiesResolver() {
- return propertiesResolver;
- }
-
- public void setPropertiesResolver(PropertiesResolver propertiesResolver) {
- this.propertiesResolver = propertiesResolver;
- }
-
- public PropertiesParser getPropertiesParser() {
- return propertiesParser;
- }
-
- public void setPropertiesParser(PropertiesParser propertiesParser) {
- this.propertiesParser = propertiesParser;
- }
-
- public Boolean getCache() {
- return cache;
- }
-
- public void setCache(Boolean cache) {
- this.cache = cache;
- }
-
- public String getPropertyPrefix() {
- return propertyPrefix;
- }
-
- public void setPropertyPrefix(String propertyPrefix) {
- this.propertyPrefix = propertyPrefix;
- }
-
- public String getPropertySuffix() {
- return propertySuffix;
- }
-
- public void setPropertySuffix(String propertySuffix) {
- this.propertySuffix = propertySuffix;
- }
-
- public Boolean getFallbackToUnaugmentedProperty() {
- return fallbackToUnaugmentedProperty;
- }
-
- public void setFallbackToUnaugmentedProperty(
- Boolean fallbackToUnaugmentedProperty) {
- this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
- }
-
- public Boolean getDefaultFallbackEnabled() {
- return defaultFallbackEnabled;
- }
-
- public void setDefaultFallbackEnabled(Boolean defaultFallbackEnabled) {
- this.defaultFallbackEnabled = defaultFallbackEnabled;
- }
-
- public Boolean getIgnoreMissingLocation() {
- return ignoreMissingLocation;
- }
-
- public void setIgnoreMissingLocation(Boolean ignoreMissingLocation) {
- this.ignoreMissingLocation = ignoreMissingLocation;
- }
-
- public String getPrefixToken() {
- return prefixToken;
- }
-
- public void setPrefixToken(String prefixToken) {
- this.prefixToken = prefixToken;
- }
-
- public String getSuffixToken() {
- return suffixToken;
- }
-
- public void setSuffixToken(String suffixToken) {
- this.suffixToken = suffixToken;
- }
-
- public Properties getInitialProperties() {
- return initialProperties;
- }
-
- public void setInitialProperties(Properties initialProperties) {
- this.initialProperties = initialProperties;
- }
-
- public Properties getOverrideProperties() {
- return overrideProperties;
- }
-
- public void setOverrideProperties(Properties overrideProperties) {
- this.overrideProperties = overrideProperties;
- }
-
- public Integer getSystemPropertiesMode() {
- return systemPropertiesMode;
- }
-
- public void setSystemPropertiesMode(Integer systemPropertiesMode) {
- this.systemPropertiesMode = systemPropertiesMode;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java
deleted file mode 100644
index c30907a..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.ref.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.ref.RefComponent;
-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.context.annotation.Lazy;
-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(RefComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class RefComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "ref-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(RefComponent.class)
- public RefComponent configureRefComponent(CamelContext camelContext)
- throws Exception {
- RefComponent component = new RefComponent();
- 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.ref");
- if (isEnabled(conditionContext, "camel.component.ref.",
- 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/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java
deleted file mode 100644
index 2567fb7..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.rest.springboot;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.rest.RestApiComponent;
-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.context.annotation.Lazy;
-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(RestApiComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-public class RestApiComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "rest-api-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(RestApiComponent.class)
- public RestApiComponent configureRestApiComponent(CamelContext camelContext)
- throws Exception {
- RestApiComponent component = new RestApiComponent();
- 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.rest-api");
- if (isEnabled(conditionContext, "camel.component.rest-api.",
- 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/3b20e362/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java
deleted file mode 100644
index 7fb213b..0000000
--- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.rest.springboot;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.rest.RestComponent;
-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.context.annotation.Lazy;
-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(RestComponentAutoConfiguration.Condition.class)
-@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
-@EnableConfigurationProperties(RestComponentConfiguration.class)
-public class RestComponentAutoConfiguration {
-
- @Lazy
- @Bean(name = "rest-component")
- @ConditionalOnClass(CamelContext.class)
- @ConditionalOnMissingBean(RestComponent.class)
- public RestComponent configureRestComponent(CamelContext camelContext,
- RestComponentConfiguration configuration) throws Exception {
- RestComponent component = new RestComponent();
- component.setCamelContext(camelContext);
- Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(configuration, parameters, null,
- false);
- for (Map.Entry<String, Object> entry : parameters.entrySet()) {
- Object value = entry.getValue();
- Class<?> paramClass = value.getClass();
- if (paramClass.getName().endsWith("NestedConfiguration")) {
- Class nestedClass = null;
- try {
- nestedClass = (Class) paramClass.getDeclaredField(
- "CAMEL_NESTED_CLASS").get(null);
- HashMap<String, Object> nestedParameters = new HashMap<>();
- IntrospectionSupport.getProperties(value, nestedParameters,
- null, false);
- Object nestedProperty = nestedClass.newInstance();
- IntrospectionSupport.setProperties(camelContext,
- camelContext.getTypeConverter(), nestedProperty,
- nestedParameters);
- entry.setValue(nestedProperty);
- } catch (NoSuchFieldException e) {
- }
- }
- }
- IntrospectionSupport.setProperties(camelContext,
- 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.rest");
- if (isEnabled(conditionContext, "camel.component.rest.",
- 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