This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
commit 1d7938293efb95bf4ccf611810b6523ee970d377 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Mon May 24 08:44:17 2021 +0200 Regen --- .../springboot/catalog/components/kamelet.json | 5 +- .../src/main/docs/kamelet-starter.adoc | 5 +- .../KameletComponentAutoConfiguration.java | 2 +- .../springboot/KameletComponentConfiguration.java | 19 ++++++- .../springboot/KameletComponentConverter.java | 65 ++++++++++++++++++++++ .../src/main/resources/META-INF/spring.factories | 4 +- .../src/main/docs/spring-boot.adoc | 4 +- docs/modules/ROOT/pages/kamelet-starter.adoc | 5 +- docs/modules/ROOT/pages/spring-boot.adoc | 4 +- tooling/camel-spring-boot-dependencies/pom.xml | 10 ++++ 10 files changed, 110 insertions(+), 13 deletions(-) diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/kamelet.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/kamelet.json index ac66e5c..4460494 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/kamelet.json +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/kamelet.json @@ -22,14 +22,15 @@ "lenientProperties": true }, "componentProperties": { - "location": { "kind": "property", "displayName": "Location", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "classpath:\/kamelets", "description": "The location of the Kamelets on the file system." }, + "location": { "kind": "property", "displayName": "Location", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "classpath:\/kamelets", "description": "The location(s) of the Kamelets on the file system. Multiple locations can be set separated by comma." }, "routeProperties": { "kind": "property", "displayName": "Route Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.util.Properties>", "deprecated": false, "autowired": false, "secret": false, "description": "Set route local parameters." }, "templateProperties": { "kind": "property", "displayName": "Template Properties", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.util.Properties>", "deprecated": false, "autowired": false, "secret": false, "description": "Set template local parameters." }, "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a me [...] "block": { "kind": "property", "displayName": "Block", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "If sending a message to a kamelet endpoint which has no active consumer, then we can tell the producer to block and wait for the consumer to become active." }, "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] "timeout": { "kind": "property", "displayName": "Timeout", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 30000, "description": "The timeout value to use if block is enabled." }, - "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] + "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] + "kameletResourceLoaderListener": { "kind": "property", "displayName": "Kamelet Resource Loader Listener", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.kamelet.KameletResourceLoaderListener", "deprecated": false, "autowired": false, "secret": false, "description": "To plugin a custom listener for when the Kamelet component is loading Kamelets from external resources." } }, "properties": { "templateId": { "kind": "path", "displayName": "Template Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Route Template ID" }, diff --git a/components-starter/camel-kamelet-starter/src/main/docs/kamelet-starter.adoc b/components-starter/camel-kamelet-starter/src/main/docs/kamelet-starter.adoc index 1b0e8ea..e1b31fc 100644 --- a/components-starter/camel-kamelet-starter/src/main/docs/kamelet-starter.adoc +++ b/components-starter/camel-kamelet-starter/src/main/docs/kamelet-starter.adoc @@ -17,7 +17,7 @@ When using kamelet with Spring Boot make sure to use the following Maven depende ---- -The component supports 9 options, which are listed below. +The component supports 10 options, which are listed below. @@ -28,8 +28,9 @@ The component supports 9 options, which are listed below. | *camel.component.kamelet.block* | If sending a message to a kamelet endpoint which has no active consumer, then we can tell the producer to block and wait for the consumer to become active. | true | Boolean | *camel.component.kamelet.bridge-error-handler* | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean | *camel.component.kamelet.enabled* | Whether to enable auto configuration of the kamelet component. This is enabled by default. | | Boolean +| *camel.component.kamelet.kamelet-resource-loader-listener* | To plugin a custom listener for when the Kamelet component is loading Kamelets from external resources. The option is a org.apache.camel.component.kamelet.KameletResourceLoaderListener type. | | KameletResourceLoaderListener | *camel.component.kamelet.lazy-start-producer* | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed th [...] -| *camel.component.kamelet.location* | The location of the Kamelets on the file system. | classpath:/kamelets | String +| *camel.component.kamelet.location* | The location(s) of the Kamelets on the file system. Multiple locations can be set separated by comma. | classpath:/kamelets | String | *camel.component.kamelet.route-properties* | Set route local parameters. | | Map | *camel.component.kamelet.template-properties* | Set template local parameters. | | Map | *camel.component.kamelet.timeout* | The timeout value to use if block is enabled. | 30000 | Long diff --git a/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentAutoConfiguration.java b/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentAutoConfiguration.java index 6551170..b8e0fba 100644 --- a/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentAutoConfiguration.java +++ b/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentAutoConfiguration.java @@ -44,7 +44,7 @@ import org.springframework.context.annotation.Lazy; @Conditional(ConditionalOnCamelContextAndAutoConfigurationBeans.class) @EnableConfigurationProperties({ComponentConfigurationProperties.class,KameletComponentConfiguration.class}) @ConditionalOnHierarchicalProperties({"camel.component", "camel.component.kamelet"}) -@AutoConfigureAfter(CamelAutoConfiguration.class) +@AutoConfigureAfter({CamelAutoConfiguration.class, KameletComponentConverter.class}) public class KameletComponentAutoConfiguration { @Autowired diff --git a/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentConfiguration.java b/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentConfiguration.java index 562a956..1246b3d 100644 --- a/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentConfiguration.java +++ b/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentConfiguration.java @@ -19,6 +19,7 @@ package org.apache.camel.component.kamelet.springboot; import java.util.Map; import java.util.Properties; import javax.annotation.Generated; +import org.apache.camel.component.kamelet.KameletResourceLoaderListener; import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -39,7 +40,8 @@ public class KameletComponentConfiguration */ private Boolean enabled; /** - * The location of the Kamelets on the file system. + * The location(s) of the Kamelets on the file system. Multiple locations + * can be set separated by comma. */ private String location = "classpath:/kamelets"; /** @@ -89,6 +91,12 @@ public class KameletComponentConfiguration * etc. */ private Boolean autowiredEnabled = true; + /** + * To plugin a custom listener for when the Kamelet component is loading + * Kamelets from external resources. The option is a + * org.apache.camel.component.kamelet.KameletResourceLoaderListener type. + */ + private KameletResourceLoaderListener kameletResourceLoaderListener; public String getLocation() { return location; @@ -153,4 +161,13 @@ public class KameletComponentConfiguration public void setAutowiredEnabled(Boolean autowiredEnabled) { this.autowiredEnabled = autowiredEnabled; } + + public KameletResourceLoaderListener getKameletResourceLoaderListener() { + return kameletResourceLoaderListener; + } + + public void setKameletResourceLoaderListener( + KameletResourceLoaderListener kameletResourceLoaderListener) { + this.kameletResourceLoaderListener = kameletResourceLoaderListener; + } } \ No newline at end of file diff --git a/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentConverter.java b/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentConverter.java new file mode 100644 index 0000000..8a60fcb --- /dev/null +++ b/components-starter/camel-kamelet-starter/src/main/java/org/apache/camel/component/kamelet/springboot/KameletComponentConverter.java @@ -0,0 +1,65 @@ +/* + * 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.kamelet.springboot; + +import java.util.LinkedHashSet; +import java.util.Set; +import javax.annotation.Generated; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import org.springframework.stereotype.Component; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.springboot.maven.SpringBootAutoConfigurationMojo") +@Configuration(proxyBeanMethods = false) +@ConfigurationPropertiesBinding +@Component +public class KameletComponentConverter implements GenericConverter { + + @Autowired + private ApplicationContext applicationContext; + + public Set<ConvertiblePair> getConvertibleTypes() { + Set<ConvertiblePair> answer = new LinkedHashSet<>(); + answer.add(new ConvertiblePair(String.class, org.apache.camel.component.kamelet.KameletResourceLoaderListener.class)); + return answer; + } + + public Object convert( + Object source, + TypeDescriptor sourceType, + TypeDescriptor targetType) { + if (source == null) { + return null; + } + String ref = source.toString(); + if (!ref.startsWith("#")) { + return null; + } + ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1); + switch (targetType.getName()) { + case "org.apache.camel.component.kamelet.KameletResourceLoaderListener": return applicationContext.getBean(ref, org.apache.camel.component.kamelet.KameletResourceLoaderListener.class); + } + return null; + } +} \ No newline at end of file diff --git a/components-starter/camel-kamelet-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-kamelet-starter/src/main/resources/META-INF/spring.factories index 15c9167..4a87f5f 100644 --- a/components-starter/camel-kamelet-starter/src/main/resources/META-INF/spring.factories +++ b/components-starter/camel-kamelet-starter/src/main/resources/META-INF/spring.factories @@ -16,4 +16,6 @@ ## --------------------------------------------------------------------------- org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.camel.component.kamelet.springboot.KameletComponentAutoConfiguration +org.apache.camel.component.kamelet.springboot.KameletComponentAutoConfiguration,\ +org.apache.camel.component.kamelet.springboot.KameletComponentConverter + diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.adoc b/core/camel-spring-boot/src/main/docs/spring-boot.adoc index ca9ee60..e549df8 100644 --- a/core/camel-spring-boot/src/main/docs/spring-boot.adoc +++ b/core/camel-spring-boot/src/main/docs/spring-boot.adoc @@ -265,9 +265,9 @@ The component supports 172 options, which are listed below. | *management.endpoint.camelroutecontroller.cache.time-to-live* | Maximum time that a response can be cached. | 0ms | Duration | *management.endpoint.camelroutecontroller.enabled* | To turn on or off information about Camel Route Controller via actuator endpoint. | true | Boolean | *management.endpoint.camelroutes.cache.time-to-live* | Maximum time that a response can be cached. | 0ms | Duration -| *management.endpoint.camelroutes.enabled* | | false | Boolean -| *management.endpoint.camelroutes.enabled* | Whether to enable the camelroutes endpoint. | true | Boolean | *management.endpoint.camelroutes.enabled* | To turn on or off information about Camel Routes via actuator endpoint. | true | Boolean +| *management.endpoint.camelroutes.enabled* | Whether to enable the camelroutes endpoint. | true | Boolean +| *management.endpoint.camelroutes.enabled* | | false | Boolean | *management.endpoint.camelroutes.read-only* | Whether Camel Routes actuator is in read-only mode. If not in read-only mode then operations to start/stop routes would be enabled. | true | Boolean | *management.info.camel.enabled* | Whether to enable Camel info. | true | Boolean | *camel.springboot.route-controller-logging-level* | *Deprecated* Sets the logging level used for logging route activity (such as starting and stopping routes). The default logging level is DEBUG. | | LoggingLevel diff --git a/docs/modules/ROOT/pages/kamelet-starter.adoc b/docs/modules/ROOT/pages/kamelet-starter.adoc index 1b0e8ea..e1b31fc 100644 --- a/docs/modules/ROOT/pages/kamelet-starter.adoc +++ b/docs/modules/ROOT/pages/kamelet-starter.adoc @@ -17,7 +17,7 @@ When using kamelet with Spring Boot make sure to use the following Maven depende ---- -The component supports 9 options, which are listed below. +The component supports 10 options, which are listed below. @@ -28,8 +28,9 @@ The component supports 9 options, which are listed below. | *camel.component.kamelet.block* | If sending a message to a kamelet endpoint which has no active consumer, then we can tell the producer to block and wait for the consumer to become active. | true | Boolean | *camel.component.kamelet.bridge-error-handler* | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean | *camel.component.kamelet.enabled* | Whether to enable auto configuration of the kamelet component. This is enabled by default. | | Boolean +| *camel.component.kamelet.kamelet-resource-loader-listener* | To plugin a custom listener for when the Kamelet component is loading Kamelets from external resources. The option is a org.apache.camel.component.kamelet.KameletResourceLoaderListener type. | | KameletResourceLoaderListener | *camel.component.kamelet.lazy-start-producer* | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed th [...] -| *camel.component.kamelet.location* | The location of the Kamelets on the file system. | classpath:/kamelets | String +| *camel.component.kamelet.location* | The location(s) of the Kamelets on the file system. Multiple locations can be set separated by comma. | classpath:/kamelets | String | *camel.component.kamelet.route-properties* | Set route local parameters. | | Map | *camel.component.kamelet.template-properties* | Set template local parameters. | | Map | *camel.component.kamelet.timeout* | The timeout value to use if block is enabled. | 30000 | Long diff --git a/docs/modules/ROOT/pages/spring-boot.adoc b/docs/modules/ROOT/pages/spring-boot.adoc index ca9ee60..e549df8 100644 --- a/docs/modules/ROOT/pages/spring-boot.adoc +++ b/docs/modules/ROOT/pages/spring-boot.adoc @@ -265,9 +265,9 @@ The component supports 172 options, which are listed below. | *management.endpoint.camelroutecontroller.cache.time-to-live* | Maximum time that a response can be cached. | 0ms | Duration | *management.endpoint.camelroutecontroller.enabled* | To turn on or off information about Camel Route Controller via actuator endpoint. | true | Boolean | *management.endpoint.camelroutes.cache.time-to-live* | Maximum time that a response can be cached. | 0ms | Duration -| *management.endpoint.camelroutes.enabled* | | false | Boolean -| *management.endpoint.camelroutes.enabled* | Whether to enable the camelroutes endpoint. | true | Boolean | *management.endpoint.camelroutes.enabled* | To turn on or off information about Camel Routes via actuator endpoint. | true | Boolean +| *management.endpoint.camelroutes.enabled* | Whether to enable the camelroutes endpoint. | true | Boolean +| *management.endpoint.camelroutes.enabled* | | false | Boolean | *management.endpoint.camelroutes.read-only* | Whether Camel Routes actuator is in read-only mode. If not in read-only mode then operations to start/stop routes would be enabled. | true | Boolean | *management.info.camel.enabled* | Whether to enable Camel info. | true | Boolean | *camel.springboot.route-controller-logging-level* | *Deprecated* Sets the logging level used for logging route activity (such as starting and stopping routes). The default logging level is DEBUG. | | LoggingLevel diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index 755b638..bbf0d9a 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -3289,6 +3289,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-kamelet-main</artifactId> + <version>3.11.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-kamelet-reify</artifactId> <version>3.11.0-SNAPSHOT</version> </dependency> @@ -3674,6 +3679,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-resourceresolver-github</artifactId> + <version>3.11.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-rest</artifactId> <version>3.11.0-SNAPSHOT</version> </dependency>