You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/03/04 12:21:05 UTC
[04/17] camel git commit: CAMEL-10937: Camel components - Configured
using setters should support property placeholders
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java
index aa68ff1..f69e46e 100644
--- a/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.mongodb.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.mongodb.MongoDbComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,43 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(MongoDbComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(MongoDbComponentConfiguration.class)
public class MongoDbComponentAutoConfiguration {
@Lazy
@Bean(name = "mongodb-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(MongoDbComponent.class)
- public MongoDbComponent configureMongoDbComponent(CamelContext camelContext)
- throws Exception {
+ public MongoDbComponent configureMongoDbComponent(
+ CamelContext camelContext,
+ MongoDbComponentConfiguration configuration) throws Exception {
MongoDbComponent component = new MongoDbComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentConfiguration.java
new file mode 100644
index 0000000..43ceeb5
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentConfiguration.java
@@ -0,0 +1,44 @@
+/**
+ * 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.mongodb.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Component for working with documents stored in MongoDB database.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.mongodb")
+public class MongoDbComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java
index 38f7dc7..058f884 100644
--- a/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.mongodb3.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.mongodb3.MongoDbComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,43 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(MongoDbComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(MongoDbComponentConfiguration.class)
public class MongoDbComponentAutoConfiguration {
@Lazy
@Bean(name = "mongodb3-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(MongoDbComponent.class)
- public MongoDbComponent configureMongoDbComponent(CamelContext camelContext)
- throws Exception {
+ public MongoDbComponent configureMongoDbComponent(
+ CamelContext camelContext,
+ MongoDbComponentConfiguration configuration) throws Exception {
MongoDbComponent component = new MongoDbComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentConfiguration.java
new file mode 100644
index 0000000..c2569b6
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentConfiguration.java
@@ -0,0 +1,44 @@
+/**
+ * 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.mongodb3.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Component for working with documents stored in MongoDB database.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.mongodb3")
+public class MongoDbComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentConfiguration.java
index 82e5504..f3c45c5 100644
--- a/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentConfiguration.java
@@ -40,6 +40,12 @@ public class MQTTComponentConfiguration {
* Password to be used for authentication against the MQTT broker
*/
private String password;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public String getHost() {
return host;
@@ -64,4 +70,13 @@ public class MQTTComponentConfiguration {
public void setPassword(String password) {
this.password = password;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentConfiguration.java
index f8712c2..66ddfb9 100644
--- a/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentConfiguration.java
@@ -39,6 +39,12 @@ public class MsvComponentConfiguration {
*/
@NestedConfigurationProperty
private ValidatorResourceResolverFactory resourceResolverFactory;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public SchemaFactory getSchemaFactory() {
return schemaFactory;
@@ -56,4 +62,13 @@ public class MsvComponentConfiguration {
ValidatorResourceResolverFactory resourceResolverFactory) {
this.resourceResolverFactory = resourceResolverFactory;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentConfiguration.java
index cc28b40..0393a2d 100644
--- a/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentConfiguration.java
@@ -33,6 +33,12 @@ public class MustacheComponentConfiguration {
*/
@NestedConfigurationProperty
private MustacheFactory mustacheFactory;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public MustacheFactory getMustacheFactory() {
return mustacheFactory;
@@ -41,4 +47,13 @@ public class MustacheComponentConfiguration {
public void setMustacheFactory(MustacheFactory mustacheFactory) {
this.mustacheFactory = mustacheFactory;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java
index 9761226..611ce35 100644
--- a/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.mvel.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.mvel.MvelComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(MvelComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(MvelComponentConfiguration.class)
public class MvelComponentAutoConfiguration {
@Lazy
@Bean(name = "mvel-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(MvelComponent.class)
- public MvelComponent configureMvelComponent(CamelContext camelContext)
- throws Exception {
+ public MvelComponent configureMvelComponent(CamelContext camelContext,
+ MvelComponentConfiguration configuration) throws Exception {
MvelComponent component = new MvelComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentConfiguration.java
new file mode 100644
index 0000000..93f1409
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentConfiguration.java
@@ -0,0 +1,44 @@
+/**
+ * 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.mvel.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Transforms the message using a MVEL template.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.mvel")
+public class MvelComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentConfiguration.java
index 19422d8..3d67f47 100644
--- a/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentConfiguration.java
@@ -39,6 +39,12 @@ public class MyBatisComponentConfiguration {
* SqlMapConfig.xml loaded from the classpath
*/
private String configurationUri = "SqlMapConfig.xml";
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public SqlSessionFactory getSqlSessionFactory() {
return sqlSessionFactory;
@@ -55,4 +61,13 @@ public class MyBatisComponentConfiguration {
public void setConfigurationUri(String configurationUri) {
this.configurationUri = configurationUri;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
index e984a80..52b8e6c 100644
--- a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
@@ -33,6 +33,12 @@ public class NagiosComponentConfiguration {
* To use a shared NagiosConfiguration
*/
private NagiosConfigurationNestedConfiguration configuration;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public NagiosConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -43,6 +49,15 @@ public class NagiosComponentConfiguration {
this.configuration = configuration;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class NagiosConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.nagios.NagiosConfiguration.class;
@NestedConfigurationProperty
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java
index d77dd5d..52780ce 100644
--- a/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.nats.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.nats.NatsComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(NatsComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(NatsComponentConfiguration.class)
public class NatsComponentAutoConfiguration {
@Lazy
@Bean(name = "nats-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(NatsComponent.class)
- public NatsComponent configureNatsComponent(CamelContext camelContext)
- throws Exception {
+ public NatsComponent configureNatsComponent(CamelContext camelContext,
+ NatsComponentConfiguration configuration) throws Exception {
NatsComponent component = new NatsComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentConfiguration.java
new file mode 100644
index 0000000..65cd7b5
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentConfiguration.java
@@ -0,0 +1,44 @@
+/**
+ * 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.nats.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The nats component allows you produce and consume messages from NATS.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.nats")
+public class NatsComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java
index 74ea7e2..18d7ccd 100644
--- a/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentConfiguration.java
@@ -59,6 +59,12 @@ public class NettyHttpComponentConfiguration {
* value is 16.
*/
private Integer maximumPoolSize = 16;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public NettyHttpBinding getNettyHttpBinding() {
return nettyHttpBinding;
@@ -103,6 +109,15 @@ public class NettyHttpComponentConfiguration {
this.maximumPoolSize = maximumPoolSize;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class NettyHttpConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.netty.http.NettyHttpConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
index 6d316e3..3ff6dd5 100644
--- a/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
@@ -52,6 +52,12 @@ public class NettyComponentConfiguration {
* value is 16.
*/
private Integer maximumPoolSize = 16;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public NettyConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -70,6 +76,15 @@ public class NettyComponentConfiguration {
this.maximumPoolSize = maximumPoolSize;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class NettyConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.netty.NettyConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java
index 781a81b..ac3a271 100644
--- a/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentConfiguration.java
@@ -65,6 +65,12 @@ public class NettyHttpComponentConfiguration {
*/
@NestedConfigurationProperty
private EventExecutorGroup executorService;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public NettyHttpBinding getNettyHttpBinding() {
return nettyHttpBinding;
@@ -117,6 +123,15 @@ public class NettyHttpComponentConfiguration {
this.executorService = executorService;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class NettyHttpConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.netty4.http.NettyHttpConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java
index c4dd3f9..0086e44 100644
--- a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java
@@ -57,6 +57,12 @@ public class NettyComponentConfiguration {
*/
@NestedConfigurationProperty
private EventExecutorGroup executorService;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public Integer getMaximumPoolSize() {
return maximumPoolSize;
@@ -83,6 +89,15 @@ public class NettyComponentConfiguration {
this.executorService = executorService;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class NettyConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.netty4.NettyConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentConfiguration.java
index c41ceb4..b9f9fd1 100644
--- a/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentConfiguration.java
@@ -37,6 +37,12 @@ public class Olingo2ComponentConfiguration {
* To use the shared configuration
*/
private Olingo2ConfigurationNestedConfiguration configuration;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public Olingo2ConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -47,6 +53,15 @@ public class Olingo2ComponentConfiguration {
this.configuration = configuration;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class Olingo2ConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.olingo2.Olingo2Configuration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentConfiguration.java
index e2dc6ed..b4ccb37 100644
--- a/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentConfiguration.java
@@ -44,6 +44,12 @@ public class OpenShiftComponentConfiguration {
* And if that fails as well then openshift.redhat.com is used.
*/
private String server;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public String getUsername() {
return username;
@@ -76,4 +82,13 @@ public class OpenShiftComponentConfiguration {
public void setServer(String server) {
this.server = server;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
index 4defed1..fba9a86 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.openstack.cinder.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.cinder.CinderComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(CinderComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(CinderComponentConfiguration.class)
public class CinderComponentAutoConfiguration {
@Lazy
@Bean(name = "openstack-cinder-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(CinderComponent.class)
- public CinderComponent configureCinderComponent(CamelContext camelContext)
- throws Exception {
+ public CinderComponent configureCinderComponent(CamelContext camelContext,
+ CinderComponentConfiguration configuration) throws Exception {
CinderComponent component = new CinderComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentConfiguration.java
new file mode 100644
index 0000000..1835d9c
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.openstack.cinder.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The openstack-cinder component allows messages to be sent to an OpenStack
+ * block storage services.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.openstack-cinder")
+public class CinderComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
index a404e64..1212d48 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.openstack.glance.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.glance.GlanceComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(GlanceComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(GlanceComponentConfiguration.class)
public class GlanceComponentAutoConfiguration {
@Lazy
@Bean(name = "openstack-glance-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GlanceComponent.class)
- public GlanceComponent configureGlanceComponent(CamelContext camelContext)
- throws Exception {
+ public GlanceComponent configureGlanceComponent(CamelContext camelContext,
+ GlanceComponentConfiguration configuration) throws Exception {
GlanceComponent component = new GlanceComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentConfiguration.java
new file mode 100644
index 0000000..e43f613
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.openstack.glance.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The openstack-glance component allows messages to be sent to an OpenStack
+ * image services.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.openstack-glance")
+public class GlanceComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
index ac5053e..11f007d 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.openstack.keystone.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.keystone.KeystoneComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,6 +44,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(KeystoneComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(KeystoneComponentConfiguration.class)
public class KeystoneComponentAutoConfiguration {
@Lazy
@@ -47,9 +52,35 @@ public class KeystoneComponentAutoConfiguration {
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(KeystoneComponent.class)
public KeystoneComponent configureKeystoneComponent(
- CamelContext camelContext) throws Exception {
+ CamelContext camelContext,
+ KeystoneComponentConfiguration configuration) throws Exception {
KeystoneComponent component = new KeystoneComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentConfiguration.java
new file mode 100644
index 0000000..7b60f1c
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.openstack.keystone.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The openstack-keystone component allows messages to be sent to an OpenStack
+ * identity services.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.openstack-keystone")
+public class KeystoneComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
index 8d9d54c..f84785e 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.openstack.neutron.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.neutron.NeutronComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,43 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(NeutronComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(NeutronComponentConfiguration.class)
public class NeutronComponentAutoConfiguration {
@Lazy
@Bean(name = "openstack-neutron-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(NeutronComponent.class)
- public NeutronComponent configureNeutronComponent(CamelContext camelContext)
- throws Exception {
+ public NeutronComponent configureNeutronComponent(
+ CamelContext camelContext,
+ NeutronComponentConfiguration configuration) throws Exception {
NeutronComponent component = new NeutronComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentConfiguration.java
new file mode 100644
index 0000000..ee94b34
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.openstack.neutron.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The openstack-neutron component allows messages to be sent to an OpenStack
+ * network services.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.openstack-neutron")
+public class NeutronComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
index 59f6f9a..8192546 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.openstack.nova.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.nova.NovaComponent;
+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;
@@ -26,6 +29,7 @@ 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;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(NovaComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(NovaComponentConfiguration.class)
public class NovaComponentAutoConfiguration {
@Lazy
@Bean(name = "openstack-nova-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(NovaComponent.class)
- public NovaComponent configureNovaComponent(CamelContext camelContext)
- throws Exception {
+ public NovaComponent configureNovaComponent(CamelContext camelContext,
+ NovaComponentConfiguration configuration) throws Exception {
NovaComponent component = new NovaComponent();
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;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentConfiguration.java
new file mode 100644
index 0000000..70b4f19
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.openstack.nova.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The openstack-nova component allows messages to be sent to an OpenStack
+ * compute services.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.openstack-nova")
+public class NovaComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file