http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentConfiguration.java new file mode 100644 index 0000000..9ddedd3 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentConfiguration.java @@ -0,0 +1,77 @@ +/** + * 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.hazelcast.replicatedmap.springboot; + +import javax.annotation.Generated; +import com.hazelcast.core.HazelcastInstance; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * The hazelcast-replicatedmap component is used to access Hazelcast replicated + * map. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.hazelcast-replicatedmap") +public class HazelcastReplicatedmapComponentConfiguration { + + /** + * The hazelcast instance reference which can be used for hazelcast + * endpoint. If you don't specify the instance reference camel use the + * default hazelcast instance from the camel-hazelcast instance. + */ + @NestedConfigurationProperty + private HazelcastInstance hazelcastInstance; + /** + * The hazelcast mode reference which kind of instance should be used. If + * you don't specify the mode then the node mode will be the default. + */ + private String hazelcastMode = "node"; + /** + * 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 HazelcastInstance getHazelcastInstance() { + return hazelcastInstance; + } + + public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { + this.hazelcastInstance = hazelcastInstance; + } + + public String getHazelcastMode() { + return hazelcastMode; + } + + public void setHazelcastMode(String hazelcastMode) { + this.hazelcastMode = hazelcastMode; + } + + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java new file mode 100644 index 0000000..46de8e2 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java @@ -0,0 +1,115 @@ +/** + * 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.hazelcast.ringbuffer.springboot; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.ringbuffer.HazelcastRingbufferComponent; +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! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(HazelcastRingbufferComponentAutoConfiguration.Condition.class) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(HazelcastRingbufferComponentConfiguration.class) +public class HazelcastRingbufferComponentAutoConfiguration { + + @Lazy + @Bean(name = "hazelcast-ringbuffer-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(HazelcastRingbufferComponent.class) + public HazelcastRingbufferComponent configureHazelcastRingbufferComponent( + CamelContext camelContext, + HazelcastRingbufferComponentConfiguration configuration) + throws Exception { + HazelcastRingbufferComponent component = new HazelcastRingbufferComponent(); + 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; + } + + @Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.hazelcast-ringbuffer"); + if (isEnabled(conditionContext, + "camel.component.hazelcast-ringbuffer.", 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentConfiguration.java new file mode 100644 index 0000000..41bf0ce --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentConfiguration.java @@ -0,0 +1,77 @@ +/** + * 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.hazelcast.ringbuffer.springboot; + +import javax.annotation.Generated; +import com.hazelcast.core.HazelcastInstance; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * The hazelcast-ringbuffer component is used to access Hazelcast distributed + * ringbuffer. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.hazelcast-ringbuffer") +public class HazelcastRingbufferComponentConfiguration { + + /** + * The hazelcast instance reference which can be used for hazelcast + * endpoint. If you don't specify the instance reference camel use the + * default hazelcast instance from the camel-hazelcast instance. + */ + @NestedConfigurationProperty + private HazelcastInstance hazelcastInstance; + /** + * The hazelcast mode reference which kind of instance should be used. If + * you don't specify the mode then the node mode will be the default. + */ + private String hazelcastMode = "node"; + /** + * 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 HazelcastInstance getHazelcastInstance() { + return hazelcastInstance; + } + + public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { + this.hazelcastInstance = hazelcastInstance; + } + + public String getHazelcastMode() { + return hazelcastMode; + } + + public void setHazelcastMode(String hazelcastMode) { + this.hazelcastMode = hazelcastMode; + } + + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java new file mode 100644 index 0000000..57df3a1 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java @@ -0,0 +1,114 @@ +/** + * 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.hazelcast.seda.springboot; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.seda.HazelcastSedaComponent; +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! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(HazelcastSedaComponentAutoConfiguration.Condition.class) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(HazelcastSedaComponentConfiguration.class) +public class HazelcastSedaComponentAutoConfiguration { + + @Lazy + @Bean(name = "hazelcast-seda-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(HazelcastSedaComponent.class) + public HazelcastSedaComponent configureHazelcastSedaComponent( + CamelContext camelContext, + HazelcastSedaComponentConfiguration configuration) throws Exception { + HazelcastSedaComponent component = new HazelcastSedaComponent(); + 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; + } + + @Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.hazelcast-seda"); + if (isEnabled(conditionContext, "camel.component.hazelcast-seda.", + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentConfiguration.java new file mode 100644 index 0000000..33ead30 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentConfiguration.java @@ -0,0 +1,76 @@ +/** + * 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.hazelcast.seda.springboot; + +import javax.annotation.Generated; +import com.hazelcast.core.HazelcastInstance; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * The hazelcast-seda component is used to access Hazelcast BlockingQueue. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.hazelcast-seda") +public class HazelcastSedaComponentConfiguration { + + /** + * The hazelcast instance reference which can be used for hazelcast + * endpoint. If you don't specify the instance reference camel use the + * default hazelcast instance from the camel-hazelcast instance. + */ + @NestedConfigurationProperty + private HazelcastInstance hazelcastInstance; + /** + * The hazelcast mode reference which kind of instance should be used. If + * you don't specify the mode then the node mode will be the default. + */ + private String hazelcastMode = "node"; + /** + * 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 HazelcastInstance getHazelcastInstance() { + return hazelcastInstance; + } + + public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { + this.hazelcastInstance = hazelcastInstance; + } + + public String getHazelcastMode() { + return hazelcastMode; + } + + public void setHazelcastMode(String hazelcastMode) { + this.hazelcastMode = hazelcastMode; + } + + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java new file mode 100644 index 0000000..18717d8 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java @@ -0,0 +1,114 @@ +/** + * 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.hazelcast.set.springboot; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.set.HazelcastSetComponent; +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! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(HazelcastSetComponentAutoConfiguration.Condition.class) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(HazelcastSetComponentConfiguration.class) +public class HazelcastSetComponentAutoConfiguration { + + @Lazy + @Bean(name = "hazelcast-set-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(HazelcastSetComponent.class) + public HazelcastSetComponent configureHazelcastSetComponent( + CamelContext camelContext, + HazelcastSetComponentConfiguration configuration) throws Exception { + HazelcastSetComponent component = new HazelcastSetComponent(); + 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; + } + + @Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.hazelcast-set"); + if (isEnabled(conditionContext, "camel.component.hazelcast-set.", + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentConfiguration.java new file mode 100644 index 0000000..16aa2bf --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentConfiguration.java @@ -0,0 +1,76 @@ +/** + * 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.hazelcast.set.springboot; + +import javax.annotation.Generated; +import com.hazelcast.core.HazelcastInstance; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * The camel Endpoint to access Hazelcast distributed set. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.hazelcast-set") +public class HazelcastSetComponentConfiguration { + + /** + * The hazelcast instance reference which can be used for hazelcast + * endpoint. If you don't specify the instance reference camel use the + * default hazelcast instance from the camel-hazelcast instance. + */ + @NestedConfigurationProperty + private HazelcastInstance hazelcastInstance; + /** + * The hazelcast mode reference which kind of instance should be used. If + * you don't specify the mode then the node mode will be the default. + */ + private String hazelcastMode = "node"; + /** + * 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 HazelcastInstance getHazelcastInstance() { + return hazelcastInstance; + } + + public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { + this.hazelcastInstance = hazelcastInstance; + } + + public String getHazelcastMode() { + return hazelcastMode; + } + + public void setHazelcastMode(String hazelcastMode) { + this.hazelcastMode = hazelcastMode; + } + + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java new file mode 100644 index 0000000..3d225f4 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java @@ -0,0 +1,115 @@ +/** + * 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.hazelcast.topic.springboot; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.hazelcast.topic.HazelcastTopicComponent; +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! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(HazelcastTopicComponentAutoConfiguration.Condition.class) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(HazelcastTopicComponentConfiguration.class) +public class HazelcastTopicComponentAutoConfiguration { + + @Lazy + @Bean(name = "hazelcast-topic-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(HazelcastTopicComponent.class) + public HazelcastTopicComponent configureHazelcastTopicComponent( + CamelContext camelContext, + HazelcastTopicComponentConfiguration configuration) + throws Exception { + HazelcastTopicComponent component = new HazelcastTopicComponent(); + 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; + } + + @Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.hazelcast-topic"); + if (isEnabled(conditionContext, "camel.component.hazelcast-topic.", + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentConfiguration.java new file mode 100644 index 0000000..92cf232 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentConfiguration.java @@ -0,0 +1,76 @@ +/** + * 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.hazelcast.topic.springboot; + +import javax.annotation.Generated; +import com.hazelcast.core.HazelcastInstance; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * The hazelcast-topic component is used to access Hazelcast distributed topic. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.hazelcast-topic") +public class HazelcastTopicComponentConfiguration { + + /** + * The hazelcast instance reference which can be used for hazelcast + * endpoint. If you don't specify the instance reference camel use the + * default hazelcast instance from the camel-hazelcast instance. + */ + @NestedConfigurationProperty + private HazelcastInstance hazelcastInstance; + /** + * The hazelcast mode reference which kind of instance should be used. If + * you don't specify the mode then the node mode will be the default. + */ + private String hazelcastMode = "node"; + /** + * 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 HazelcastInstance getHazelcastInstance() { + return hazelcastInstance; + } + + public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { + this.hazelcastInstance = hazelcastInstance; + } + + public String getHazelcastMode() { + return hazelcastMode; + } + + public void setHazelcastMode(String hazelcastMode) { + this.hazelcastMode = hazelcastMode; + } + + 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/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 89d80d7..5a63a3a 100644 --- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -5,6 +5,72 @@ "name": "camel.component.hazelcast.enabled", "description": "Enable hazelcast component", "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-list.enabled", + "description": "Enable hazelcast-list component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-map.enabled", + "description": "Enable hazelcast-map component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-replicatedmap.enabled", + "description": "Enable hazelcast-replicatedmap component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-queue.enabled", + "description": "Enable hazelcast-queue component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-set.enabled", + "description": "Enable hazelcast-set component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-topic.enabled", + "description": "Enable hazelcast-topic component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-seda.enabled", + "description": "Enable hazelcast-seda component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-multimap.enabled", + "description": "Enable hazelcast-multimap component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-ringbuffer.enabled", + "description": "Enable hazelcast-ringbuffer component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-instance.enabled", + "description": "Enable hazelcast-instance component", + "type": "java.lang.Boolean" + }, + { + "defaultValue": true, + "name": "camel.component.hazelcast-atomicvalue.enabled", + "description": "Enable hazelcast-atomicvalue component", + "type": "java.lang.Boolean" } ] } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/bf10d278/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/spring.factories index fa335f5..7e358e7 100644 --- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/spring.factories +++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/resources/META-INF/spring.factories @@ -15,4 +15,26 @@ ## limitations under the License. ## --------------------------------------------------------------------------- org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.camel.component.hazelcast.springboot.HazelcastComponentAutoConfiguration +org.apache.camel.component.hazelcast.springboot.HazelcastComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.list.springboot.HazelcastListComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.map.springboot.HazelcastMapComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.replicatedmap.springboot.HazelcastReplicatedmapComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.queue.springboot.HazelcastQueueComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.set.springboot.HazelcastSetComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.topic.springboot.HazelcastTopicComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.seda.springboot.HazelcastSedaComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.multimap.springboot.HazelcastMultimapComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.ringbuffer.springboot.HazelcastRingbufferComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.instance.springboot.HazelcastInstanceComponentAutoConfiguration,\ +org.apache.camel.component.hazelcast.atomicnumber.springboot.HazelcastAtomicnumberComponentAutoConfiguration + + + + + + + + + + +