Fixed CS errors
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/df487b28 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/df487b28 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/df487b28 Branch: refs/heads/master Commit: df487b283198b03a56de536ce6b1e4784747be17 Parents: 76f7914 Author: Dhiraj Bokde <dhira...@yahoo.com> Authored: Thu Sep 29 17:38:19 2016 -0700 Committer: Dhiraj Bokde <dhira...@yahoo.com> Committed: Thu Sep 29 17:38:19 2016 -0700 ---------------------------------------------------------------------- .../EjbComponentAutoConfiguration.java | 71 +++++ .../springboot/EjbComponentConfiguration.java | 56 ++++ .../main/resources/META-INF/spring.factories | 19 ++ .../IBatisComponentAutoConfiguration.java | 71 +++++ .../IBatisComponentConfiguration.java | 70 +++++ .../main/resources/META-INF/spring.factories | 19 ++ .../JcloudsComponentAutoConfiguration.java | 72 ++++++ .../JcloudsComponentConfiguration.java | 57 +++++ .../main/resources/META-INF/spring.factories | 19 ++ .../QuartzComponentAutoConfiguration.java | 71 +++++ .../QuartzComponentConfiguration.java | 122 +++++++++ .../main/resources/META-INF/spring.factories | 19 ++ .../SparkComponentAutoConfiguration.java | 71 +++++ .../springboot/SparkComponentConfiguration.java | 256 +++++++++++++++++++ .../main/resources/META-INF/spring.factories | 19 ++ .../component/netty4/NettyConfiguration.java | 2 +- .../component/netty4/NettyPayloadHelper.java | 2 +- 17 files changed, 1014 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java b/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java new file mode 100644 index 0000000..64936bb --- /dev/null +++ b/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentAutoConfiguration.java @@ -0,0 +1,71 @@ +/** + * 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.ejb.springboot; + +import java.util.HashMap; +import java.util.Map; +import org.apache.camel.CamelContext; +import org.apache.camel.component.ejb.EjbComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration +@EnableConfigurationProperties(EjbComponentConfiguration.class) +public class EjbComponentAutoConfiguration { + + @Bean(name = "ejb-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(EjbComponent.class) + public EjbComponent configureEjbComponent(CamelContext camelContext, + EjbComponentConfiguration configuration) throws Exception { + EjbComponent component = new EjbComponent(); + 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; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentConfiguration.java b/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentConfiguration.java new file mode 100644 index 0000000..3ff10d9 --- /dev/null +++ b/components-starter/camel-ejb-starter/src/main/java/org/apache/camel/component/ejb/springboot/EjbComponentConfiguration.java @@ -0,0 +1,56 @@ +/** + * 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.ejb.springboot; + +import java.util.Properties; +import javax.naming.Context; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The ejb component is for invoking EJB Java beans from Camel. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.ejb") +public class EjbComponentConfiguration { + + /** + * The Context to use for looking up the EJBs + */ + private Context context; + /** + * Properties for creating javax.naming.Context if a context has not been + * configured. + */ + private Properties properties; + + public Context getContext() { + return context; + } + + public void setContext(Context context) { + this.context = context; + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-ejb-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/components-starter/camel-ejb-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-ejb-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..807a34b --- /dev/null +++ b/components-starter/camel-ejb-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +# +# 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. +# + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.ejb.springboot.EjbComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentAutoConfiguration.java b/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentAutoConfiguration.java new file mode 100644 index 0000000..98329f2 --- /dev/null +++ b/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentAutoConfiguration.java @@ -0,0 +1,71 @@ +/** + * 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.ibatis.springboot; + +import java.util.HashMap; +import java.util.Map; +import org.apache.camel.CamelContext; +import org.apache.camel.component.ibatis.IBatisComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration +@EnableConfigurationProperties(IBatisComponentConfiguration.class) +public class IBatisComponentAutoConfiguration { + + @Bean(name = "ibatis-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(IBatisComponent.class) + public IBatisComponent configureIBatisComponent(CamelContext camelContext, + IBatisComponentConfiguration configuration) throws Exception { + IBatisComponent component = new IBatisComponent(); + 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; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentConfiguration.java b/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentConfiguration.java new file mode 100644 index 0000000..e21fa68 --- /dev/null +++ b/components-starter/camel-ibatis-starter/src/main/java/org/apache/camel/component/ibatis/springboot/IBatisComponentConfiguration.java @@ -0,0 +1,70 @@ +/** + * 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.ibatis.springboot; + +import com.ibatis.sqlmap.client.SqlMapClient; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * Performs a query poll insert update or delete in a relational database using + * Apache iBATIS. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.ibatis") +public class IBatisComponentConfiguration { + + /** + * To use the given com.ibatis.sqlmap.client.SqlMapClient + */ + @NestedConfigurationProperty + private SqlMapClient sqlMapClient; + /** + * Location of iBatis xml configuration file. The default value is: + * SqlMapConfig.xml loaded from the classpath + */ + private String sqlMapConfig; + /** + * Whether to use transactions. This option is by default true. + */ + private Boolean useTransactions; + + public SqlMapClient getSqlMapClient() { + return sqlMapClient; + } + + public void setSqlMapClient(SqlMapClient sqlMapClient) { + this.sqlMapClient = sqlMapClient; + } + + public String getSqlMapConfig() { + return sqlMapConfig; + } + + public void setSqlMapConfig(String sqlMapConfig) { + this.sqlMapConfig = sqlMapConfig; + } + + public Boolean getUseTransactions() { + return useTransactions; + } + + public void setUseTransactions(Boolean useTransactions) { + this.useTransactions = useTransactions; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-ibatis-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/components-starter/camel-ibatis-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-ibatis-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..d222b9c --- /dev/null +++ b/components-starter/camel-ibatis-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +# +# 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. +# + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.ibatis.springboot.IBatisComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentAutoConfiguration.java b/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentAutoConfiguration.java new file mode 100644 index 0000000..20f116f --- /dev/null +++ b/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentAutoConfiguration.java @@ -0,0 +1,72 @@ +/** + * 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.jclouds.springboot; + +import java.util.HashMap; +import java.util.Map; +import org.apache.camel.CamelContext; +import org.apache.camel.component.jclouds.JcloudsComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration +@EnableConfigurationProperties(JcloudsComponentConfiguration.class) +public class JcloudsComponentAutoConfiguration { + + @Bean(name = "jclouds-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(JcloudsComponent.class) + public JcloudsComponent configureJcloudsComponent( + CamelContext camelContext, + JcloudsComponentConfiguration configuration) throws Exception { + JcloudsComponent component = new JcloudsComponent(); + 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; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentConfiguration.java b/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentConfiguration.java new file mode 100644 index 0000000..34164ec --- /dev/null +++ b/components-starter/camel-jclouds-starter/src/main/java/org/apache/camel/component/jclouds/springboot/JcloudsComponentConfiguration.java @@ -0,0 +1,57 @@ +/** + * 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.jclouds.springboot; + +import java.util.List; +import org.jclouds.blobstore.BlobStore; +import org.jclouds.compute.ComputeService; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * For interacting with cloud compute & blobstore service via jclouds. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.jclouds") +public class JcloudsComponentConfiguration { + + /** + * To use the given BlobStore which must be configured when using blobstore. + */ + private List<BlobStore> blobStores; + /** + * To use the given ComputeService which must be configured when use + * compute. + */ + private List<ComputeService> computeServices; + + public List<BlobStore> getBlobStores() { + return blobStores; + } + + public void setBlobStores(List<BlobStore> blobStores) { + this.blobStores = blobStores; + } + + public List<ComputeService> getComputeServices() { + return computeServices; + } + + public void setComputeServices(List<ComputeService> computeServices) { + this.computeServices = computeServices; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-jclouds-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/components-starter/camel-jclouds-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-jclouds-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..a73c82d --- /dev/null +++ b/components-starter/camel-jclouds-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +# +# 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. +# + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.jclouds.springboot.JcloudsComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentAutoConfiguration.java b/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentAutoConfiguration.java new file mode 100644 index 0000000..6da90b1 --- /dev/null +++ b/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentAutoConfiguration.java @@ -0,0 +1,71 @@ +/** + * 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.quartz.springboot; + +import java.util.HashMap; +import java.util.Map; +import org.apache.camel.CamelContext; +import org.apache.camel.component.quartz.QuartzComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration +@EnableConfigurationProperties(QuartzComponentConfiguration.class) +public class QuartzComponentAutoConfiguration { + + @Bean(name = "quartz-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(QuartzComponent.class) + public QuartzComponent configureQuartzComponent(CamelContext camelContext, + QuartzComponentConfiguration configuration) throws Exception { + QuartzComponent component = new QuartzComponent(); + 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; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentConfiguration.java b/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentConfiguration.java new file mode 100644 index 0000000..36509be --- /dev/null +++ b/components-starter/camel-quartz-starter/src/main/java/org/apache/camel/component/quartz/springboot/QuartzComponentConfiguration.java @@ -0,0 +1,122 @@ +/** + * 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.quartz.springboot; + +import java.util.Properties; +import org.quartz.Scheduler; +import org.quartz.SchedulerFactory; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * Provides a scheduled delivery of messages using the Quartz 1.x scheduler. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.quartz") +public class QuartzComponentConfiguration { + + /** + * To use the custom SchedulerFactory which is used to create the Scheduler. + */ + @NestedConfigurationProperty + private SchedulerFactory factory; + /** + * To use the custom configured Quartz scheduler instead of creating a new + * Scheduler. + */ + @NestedConfigurationProperty + private Scheduler scheduler; + /** + * Properties to configure the Quartz scheduler. + */ + private Properties properties; + /** + * File name of the properties to load from the classpath + */ + private String propertiesFile; + /** + * Seconds to wait before starting the quartz scheduler. + */ + private Integer startDelayedSeconds; + /** + * Whether or not the scheduler should be auto started. This options is + * default true + */ + private Boolean autoStartScheduler; + /** + * Whether to enable Quartz JMX which allows to manage the Quartz scheduler + * from JMX. This options is default true + */ + private Boolean enableJmx; + + public SchedulerFactory getFactory() { + return factory; + } + + public void setFactory(SchedulerFactory factory) { + this.factory = factory; + } + + public Scheduler getScheduler() { + return scheduler; + } + + public void setScheduler(Scheduler scheduler) { + this.scheduler = scheduler; + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } + + public String getPropertiesFile() { + return propertiesFile; + } + + public void setPropertiesFile(String propertiesFile) { + this.propertiesFile = propertiesFile; + } + + public Integer getStartDelayedSeconds() { + return startDelayedSeconds; + } + + public void setStartDelayedSeconds(Integer startDelayedSeconds) { + this.startDelayedSeconds = startDelayedSeconds; + } + + public Boolean getAutoStartScheduler() { + return autoStartScheduler; + } + + public void setAutoStartScheduler(Boolean autoStartScheduler) { + this.autoStartScheduler = autoStartScheduler; + } + + public Boolean getEnableJmx() { + return enableJmx; + } + + public void setEnableJmx(Boolean enableJmx) { + this.enableJmx = enableJmx; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-quartz-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/components-starter/camel-quartz-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-quartz-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..d33d8b8 --- /dev/null +++ b/components-starter/camel-quartz-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +# +# 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. +# + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.quartz.springboot.QuartzComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentAutoConfiguration.java b/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentAutoConfiguration.java new file mode 100644 index 0000000..ec93210 --- /dev/null +++ b/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentAutoConfiguration.java @@ -0,0 +1,71 @@ +/** + * 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.sparkrest.springboot; + +import java.util.HashMap; +import java.util.Map; +import org.apache.camel.CamelContext; +import org.apache.camel.component.sparkrest.SparkComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration +@EnableConfigurationProperties(SparkComponentConfiguration.class) +public class SparkComponentAutoConfiguration { + + @Bean(name = "spark-rest-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(SparkComponent.class) + public SparkComponent configureSparkComponent(CamelContext camelContext, + SparkComponentConfiguration configuration) throws Exception { + SparkComponent component = new SparkComponent(); + 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; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentConfiguration.java b/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentConfiguration.java new file mode 100644 index 0000000..29cb06d --- /dev/null +++ b/components-starter/camel-spark-rest-starter/src/main/java/org/apache/camel/component/sparkrest/springboot/SparkComponentConfiguration.java @@ -0,0 +1,256 @@ +/** + * 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.sparkrest.springboot; + +import org.apache.camel.component.sparkrest.SparkBinding; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * The spark-rest component is used for hosting REST services which has been + * defined using Camel rest-dsl. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.spark-rest") +public class SparkComponentConfiguration { + + /** + * Port number. Will by default use 4567 + */ + private Integer port; + /** + * Set the IP address that Spark should listen on. If not called the default + * address is '0.0.0.0'. + */ + private String ipAddress; + /** + * Minimum number of threads in Spark thread-pool (shared globally) + */ + private Integer minThreads; + /** + * Maximum number of threads in Spark thread-pool (shared globally) + */ + private Integer maxThreads; + /** + * Thread idle timeout in millis where threads that has been idle for a + * longer period will be terminated from the thread pool + */ + private Integer timeOutMillis; + /** + * Configures connection to be secure to use the keystore file + */ + private String keystoreFile; + /** + * Configures connection to be secure to use the keystore password + */ + private String keystorePassword; + /** + * Configures connection to be secure to use the truststore file + */ + private String truststoreFile; + /** + * Configures connection to be secure to use the truststore password + */ + private String truststorePassword; + /** + * To use the shared SparkConfiguration + */ + private SparkConfigurationNestedConfiguration sparkConfiguration; + /** + * To use a custom SparkBinding to map to/from Camel message. + */ + @NestedConfigurationProperty + private SparkBinding sparkBinding; + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public Integer getMinThreads() { + return minThreads; + } + + public void setMinThreads(Integer minThreads) { + this.minThreads = minThreads; + } + + public Integer getMaxThreads() { + return maxThreads; + } + + public void setMaxThreads(Integer maxThreads) { + this.maxThreads = maxThreads; + } + + public Integer getTimeOutMillis() { + return timeOutMillis; + } + + public void setTimeOutMillis(Integer timeOutMillis) { + this.timeOutMillis = timeOutMillis; + } + + public String getKeystoreFile() { + return keystoreFile; + } + + public void setKeystoreFile(String keystoreFile) { + this.keystoreFile = keystoreFile; + } + + public String getKeystorePassword() { + return keystorePassword; + } + + public void setKeystorePassword(String keystorePassword) { + this.keystorePassword = keystorePassword; + } + + public String getTruststoreFile() { + return truststoreFile; + } + + public void setTruststoreFile(String truststoreFile) { + this.truststoreFile = truststoreFile; + } + + public String getTruststorePassword() { + return truststorePassword; + } + + public void setTruststorePassword(String truststorePassword) { + this.truststorePassword = truststorePassword; + } + + public SparkConfigurationNestedConfiguration getSparkConfiguration() { + return sparkConfiguration; + } + + public void setSparkConfiguration( + SparkConfigurationNestedConfiguration sparkConfiguration) { + this.sparkConfiguration = sparkConfiguration; + } + + public SparkBinding getSparkBinding() { + return sparkBinding; + } + + public void setSparkBinding(SparkBinding sparkBinding) { + this.sparkBinding = sparkBinding; + } + + public static class SparkConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.sparkrest.SparkConfiguration.class; + /** + * If this option is enabled, then during binding from Spark to Camel + * Message then the headers will be mapped as well (eg added as header + * to the Camel Message as well). You can turn off this option to + * disable this. The headers can still be accessed from the + * org.apache.camel.component.sparkrest.SparkMessage message with the + * method getRequest() that returns the Spark HTTP request instance. + */ + private Boolean mapHeaders; + /** + * Determines whether or not the raw input stream from Spark + * HttpRequest#getContent() is cached or not (Camel will read the stream + * into a in light-weight memory based Stream caching) cache. By default + * Camel will cache the Netty input stream to support reading it + * multiple times to ensure Camel can retrieve all data from the stream. + * However you can set this option to true when you for example need to + * access the raw stream, such as streaming it directly to a file or + * other persistent store. Mind that if you enable this option, then you + * cannot read the Netty stream multiple times out of the box, and you + * would need manually to reset the reader index on the Spark raw + * stream. + */ + private Boolean disableStreamCache; + /** + * If this option is enabled, then during binding from Spark to Camel + * Message then the header values will be URL decoded (eg %20 will be a + * space character.) + */ + private Boolean urlDecodeHeaders; + /** + * If enabled and an Exchange failed processing on the consumer side, + * and if the caused Exception was send back serialized in the response + * as a application/x-java-serialized-object content type. + * <p/> + * This is by default turned off. If you enable this then be aware that + * Java will deserialize the incoming data from the request to Java and + * that can be a potential security risk. + */ + private Boolean transferException; + /** + * Whether or not the consumer should try to find a target consumer by + * matching the URI prefix if no exact match is found. + */ + private Boolean matchOnUriPrefix; + + public Boolean getMapHeaders() { + return mapHeaders; + } + + public void setMapHeaders(Boolean mapHeaders) { + this.mapHeaders = mapHeaders; + } + + public Boolean getDisableStreamCache() { + return disableStreamCache; + } + + public void setDisableStreamCache(Boolean disableStreamCache) { + this.disableStreamCache = disableStreamCache; + } + + public Boolean getUrlDecodeHeaders() { + return urlDecodeHeaders; + } + + public void setUrlDecodeHeaders(Boolean urlDecodeHeaders) { + this.urlDecodeHeaders = urlDecodeHeaders; + } + + public Boolean getTransferException() { + return transferException; + } + + public void setTransferException(Boolean transferException) { + this.transferException = transferException; + } + + public Boolean getMatchOnUriPrefix() { + return matchOnUriPrefix; + } + + public void setMatchOnUriPrefix(Boolean matchOnUriPrefix) { + this.matchOnUriPrefix = matchOnUriPrefix; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components-starter/camel-spark-rest-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/components-starter/camel-spark-rest-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-spark-rest-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..9f7f38a --- /dev/null +++ b/components-starter/camel-spark-rest-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +# +# 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. +# + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.sparkrest.springboot.SparkComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java index 0863290..22ba5ad 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java @@ -429,7 +429,7 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem } public boolean isAllowSerializedHeaders() { - return allowSerializedHeaders; + return allowSerializedHeaders; } /** http://git-wip-us.apache.org/repos/asf/camel/blob/df487b28/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java index d2c0731..f24af60 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyPayloadHelper.java @@ -41,7 +41,7 @@ public final class NettyPayloadHelper { public static Object getIn(NettyEndpoint endpoint, Exchange exchange) { if (endpoint.getConfiguration().isTransferExchange()) { // we should transfer the entire exchange over the wire (includes in/out) - return DefaultExchangeHolder.marshal(exchange, true, endpoint.getConfiguration().isAllowSerializedHeaders()); + return DefaultExchangeHolder.marshal(exchange, true, endpoint.getConfiguration().isAllowSerializedHeaders()); } else { if (endpoint.getConfiguration().isUseByteBuf()) { // Just leverage the type converter