This is an automated email from the ASF dual-hosted git repository. fmariani pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 6fe6a9e7fac CAMEL-21801: Spring Cloud Config Porperty Function 6fe6a9e7fac is described below commit 6fe6a9e7fac75556bb20fa5f8fd7f4a8a8cfcd3a Author: Croway <federico.mariani.1...@gmail.com> AuthorDate: Wed Apr 2 17:04:50 2025 +0200 CAMEL-21801: Spring Cloud Config Porperty Function Use Camel ConfigurationProperties Documentation --- bom/camel-bom/pom.xml | 5 + catalog/camel-allcomponents/pom.xml | 5 + .../main/camel-main-configuration-metadata.json | 10 +- .../camel-spring-cloud-config/pom.xml | 82 +++++++++++++++ .../services/org/apache/camel/other.properties | 7 ++ .../camel/periodic-task/spring-config-refresh | 2 + .../apache/camel/properties-function/spring-config | 2 + .../generated/resources/spring-cloud-config.json | 14 +++ .../main/docs/spring-cloud-config-component.adoc | 100 +++++++++++++++++++ .../SpringCloudConfigPropertiesFunction.java | 111 +++++++++++++++++++++ .../config/SpringCloudConfigReloadTriggerTask.java | 78 +++++++++++++++ .../spring/cloud/config/SpringConfigProvider.java | 110 ++++++++++++++++++++ .../cloud/config/SpringConfigRemaindersCache.java | 36 +++++++ components/camel-spring-parent/pom.xml | 1 + .../vault/SpringCloudConfigConfiguration.java | 106 ++++++++++++++++++++ .../org/apache/camel/vault/VaultConfiguration.java | 16 +++ core/camel-main/pom.xml | 2 + .../main/AwsVaultConfigurationConfigurer.java | 6 ++ .../AwsVaultConfigurationPropertiesConfigurer.java | 7 ++ .../main/AzureVaultConfigurationConfigurer.java | 6 ++ ...zureVaultConfigurationPropertiesConfigurer.java | 7 ++ .../main/GcpVaultConfigurationConfigurer.java | 6 ++ .../GcpVaultConfigurationPropertiesConfigurer.java | 7 ++ .../HashicorpVaultConfigurationConfigurer.java | 6 ++ ...corpVaultConfigurationPropertiesConfigurer.java | 7 ++ ...SecretsManagerVaultConfigurationConfigurer.java | 6 ++ ...agerVaultConfigurationPropertiesConfigurer.java | 7 ++ ...netesConfigMapVaultConfigurationConfigurer.java | 6 ++ ...mapsVaultConfigurationPropertiesConfigurer.java | 7 ++ .../KubernetesVaultConfigurationConfigurer.java | 6 ++ ...etesVaultConfigurationPropertiesConfigurer.java | 7 ++ ... SpringCloudConfigConfigurationConfigurer.java} | 59 ++++++----- ...udConfigConfigurationPropertiesConfigurer.java} | 71 +++++++------ .../camel-main-configuration-metadata.json | 10 +- ...l.main.SpringCloudConfigConfigurationProperties | 2 + ...ache.camel.vault.SpringCloudConfigConfiguration | 2 + .../org/apache/camel/main/BaseMainSupport.java | 3 + .../camel/main/DefaultConfigurationConfigurer.java | 19 ++++ .../SpringCloudConfigConfigurationProperties.java | 72 +++++++++++++ .../camel/main/VaultConfigurationProperties.java | 12 +++ docs/components/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/spring-cloud-config-component.adoc | 1 + .../others/examples/json/spring-cloud-config.json | 1 + parent/pom.xml | 6 ++ .../maven/packaging/PrepareCamelMainMojo.java | 12 +++ 45 files changed, 980 insertions(+), 69 deletions(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 8498261435e..014102d6e44 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -1912,6 +1912,11 @@ <artifactId>camel-spring-batch</artifactId> <version>4.12.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-cloud-config</artifactId> + <version>4.12.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-jdbc</artifactId> diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml index 12264b9ea6b..82d6c18ccf3 100644 --- a/catalog/camel-allcomponents/pom.xml +++ b/catalog/camel-allcomponents/pom.xml @@ -1716,6 +1716,11 @@ <artifactId>camel-spring-batch</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-cloud-config</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-jdbc</artifactId> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json index 8db967e7b0c..d0bb8edc242 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json @@ -405,6 +405,14 @@ { "name": "camel.vault.kubernetes.refreshEnabled", "description": "Whether to automatically reload Camel upon secrets being updated in Kubernetes Cluster.", "sourceType": "org.apache.camel.vault.KubernetesVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.vault.kubernetes.secrets", "description": "Specify the secret names (or pattern) to check for updates. Multiple secrets can be separated by comma.", "sourceType": "org.apache.camel.vault.KubernetesVaultConfiguration", "type": "string", "javaType": "java.lang.String" }, { "name": "camel.vault.kubernetescm.configmaps", "description": "Specify the configmap names (or pattern) to check for updates. Multiple configmaps can be separated by comma.", "sourceType": "org.apache.camel.vault.KubernetesConfigMapVaultConfiguration", "type": "string", "javaType": "java.lang.String" }, - { "name": "camel.vault.kubernetescm.refreshEnabled", "description": "Whether to automatically reload Camel upon configmaps being updated in Kubernetes Cluster.", "sourceType": "org.apache.camel.vault.KubernetesConfigMapVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" } + { "name": "camel.vault.kubernetescm.refreshEnabled", "description": "Whether to automatically reload Camel upon configmaps being updated in Kubernetes Cluster.", "sourceType": "org.apache.camel.vault.KubernetesConfigMapVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.vault.springConfig.label", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.password", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.profile", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.refreshEnabled", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.vault.springConfig.refreshPeriod", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "integer", "javaType": "long", "defaultValue": 30000 }, + { "name": "camel.vault.springConfig.token", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.uris", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String", "defaultValue": "http:\/\/localhost:8888" }, + { "name": "camel.vault.springConfig.username", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String", "defaultValue": "user" } ] } diff --git a/components/camel-spring-parent/camel-spring-cloud-config/pom.xml b/components/camel-spring-parent/camel-spring-cloud-config/pom.xml new file mode 100644 index 00000000000..29d10cb25de --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/pom.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-parent</artifactId> + <version>4.12.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-spring-cloud-config</artifactId> + <packaging>jar</packaging> + <name>Camel :: Spring Cloud Config</name> + <description>Camel Spring Cloud Config support</description> + + <properties> + <firstVersion>4.12.0</firstVersion> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-config-dependencies</artifactId> + <version>${spring-cloud-config-version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-config-client</artifactId> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-junit-jupiter</artifactId> + <version>${mockito-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring-junit5</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/other.properties new file mode 100644 index 00000000000..6da24f89990 --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/other.properties @@ -0,0 +1,7 @@ +# Generated by camel build tools - do NOT edit this file! +name=spring-cloud-config +groupId=org.apache.camel +artifactId=camel-spring-cloud-config +version=4.12.0-SNAPSHOT +projectName=Camel :: Spring Cloud Config +projectDescription=Camel Spring Cloud Config support diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/periodic-task/spring-config-refresh b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/periodic-task/spring-config-refresh new file mode 100644 index 00000000000..bae9e1d26cb --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/periodic-task/spring-config-refresh @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.spring.cloud.config.SpringCloudConfigReloadTriggerTask diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/properties-function/spring-config b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/properties-function/spring-config new file mode 100644 index 00000000000..696486495a5 --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/META-INF/services/org/apache/camel/properties-function/spring-config @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.spring.cloud.config.SpringCloudConfigPropertiesFunction diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/spring-cloud-config.json b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/spring-cloud-config.json new file mode 100644 index 00000000000..803202097b9 --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/spring-cloud-config.json @@ -0,0 +1,14 @@ +{ + "other": { + "kind": "other", + "name": "spring-cloud-config", + "title": "Spring Cloud Config", + "description": "Camel Spring Cloud Config support", + "deprecated": false, + "firstVersion": "4.12.0", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-spring-cloud-config", + "version": "4.12.0-SNAPSHOT" + } +} diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/main/docs/spring-cloud-config-component.adoc b/components/camel-spring-parent/camel-spring-cloud-config/src/main/docs/spring-cloud-config-component.adoc new file mode 100644 index 00000000000..46f887c7083 --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/main/docs/spring-cloud-config-component.adoc @@ -0,0 +1,100 @@ += Spring Cloud Config Component +:doctitle: Spring Cloud Config +:shortname: spring-cloud-config +:artifactid: camel-spring-cloud-config +:description: Retrieve configurations from a Spring Cloud Config Server. +:since: 4.11.0 +:supportlevel: Stable +:tabs-sync-option: +:component-header: Only PropertyFunctions is supported +//Manually maintained attributes +:group: Spring + +*Since Camel {since}* + +*{component-header}* + +The Spring Cloud Config component provides integration between Apache Camel and Spring Cloud Config, +allowing applications to retrieve configuration properties from a centralized Spring Cloud Config Server. +This component includes a Properties Function implementation that allows Apache Camel to resolve property placeholders +directly from Spring Cloud Config. + +== Components +This component provides the following features: + +- Property resolution from Spring Cloud Config via property placeholders +- Periodic monitoring for property changes +- Automatic context reloading when configuration changes are detected + +== Maven Dependency +To use the Spring Cloud Config component in your project, add the following Maven dependency: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-cloud-config</artifactId> + <version>x.x.x</version> <!-- Use the appropriate Camel version --> +</dependency> +---- + +== Property Function +=== Overview + +This component provides a PropertiesFunction implementation that resolves property placeholders with the prefix spring-config: using values from a Spring Cloud Config Server. + +=== Configuration +The integration with Spring Cloud Config is configured through the Camel context's vault configuration. The following properties can be set: + +[options="header"] +|=== +|Property |Type |Description +|username |String |Username for authentication with the Config Server +|password |String |Password for authentication with the Config Server +|token |String |Authentication token for the Config Server +|uris |String |Comma-separated list of Config Server URIs +|label |String |Config Server label to use (e.g., git branch) +|profile |String |Configuration profile to use +|=== + +These properties should be configured using the SpringCloudConfigConfiguration on the Camel context. + +=== Usage +To use the Spring Cloud Config property function in your Camel routes or configuration, use the following syntax: + +[source,java] +---- +{{spring-config:myProperty}} +---- + +The property function will resolve `myProperty` from the Spring Cloud Config Server. + +=== Example +A simple example of using the Spring Cloud Config property function in a Camel route, +given that a Spring Cloud Config Server is running at `config-server:8888` and Spring Security is enabled on the server: + +[source,properties] +---- +camel.vault.spring-config.uris=http://config-server:8888 +camel.vault.spring-config.refresh-enabled=true +camel.vault.spring-config.username=configUser +camel.vault.spring-config.password=configPass +camel.vault.spring-config.label=latest +---- + +[source,java] +---- +from("direct") +.setHeader("MyHeader", simple("{{spring-config:custom.property}}")) +.to("log"); +---- + +== Automatic Configuration Reload +=== Overview +The component includes a periodic task that monitors Spring Cloud Config properties for changes and triggers a Camel context reload when property values have changed. + +== See Also + +link:https://camel.apache.org/components/latest/others/properties.html[Camel Properties Component] +link:https://spring.io/projects/spring-cloud-config[Spring Cloud Config] +link:https://camel.apache.org/manual/latest/using-propertyplaceholder.html[Using Property Placeholders] diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringCloudConfigPropertiesFunction.java b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringCloudConfigPropertiesFunction.java new file mode 100644 index 00000000000..dd9be7dd494 --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringCloudConfigPropertiesFunction.java @@ -0,0 +1,111 @@ +/* + * 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.spring.cloud.config; + +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.spi.PropertiesFunction; +import org.apache.camel.support.service.ServiceSupport; +import org.springframework.boot.context.config.ConfigData; +import org.springframework.context.EnvironmentAware; +import org.springframework.core.env.Environment; +import org.springframework.core.env.PropertySource; + +/** + * Properties Function implementation that provides integration with Spring Cloud Config. This class allows Camel to + * resolve property placeholders using values from Spring Cloud Config. + * <p> + * When a property placeholder with the prefix "spring-config:" is encountered in Camel routes or configuration, this + * function will be called to resolve the property value from Spring Cloud Config sources. + * <p> + * The implementation first attempts to resolve properties through the Spring {@link Environment} if available. If not + * available or the property is not found, it falls back to retrieving the configuration from Spring Config directly. + * <p> + * Usage example in Camel routes or configuration: + * + * <pre> + * {{spring-config:my.property.name}} + * </pre> + * + */ +@org.apache.camel.spi.annotations.PropertiesFunction("spring-config") +public class SpringCloudConfigPropertiesFunction extends ServiceSupport + implements PropertiesFunction, CamelContextAware, EnvironmentAware { + + private CamelContext camelContext; + + private Environment environment; + + /** + * Resolves the specified property from Spring Cloud Config. + * <p> + * The resolution process follows these steps: + * <ol> + * <li>If a Spring Environment is available, attempt to resolve the property from it</li> + * <li>Otherwise, retrieve the configuration from Spring Config directly</li> + * <li>Search through all available property sources for the property</li> + * <li>Cache the result for future lookups by {@link SpringCloudConfigReloadTriggerTask}</li> + * </ol> + * + * @param remainder the property name to resolve (without the "spring-config:" prefix) + * @return the property value, or null if not found + * @throws RuntimeCamelException if the Spring Config data cannot be retrieved + */ + @Override + public String apply(String remainder) { + if (environment != null) { + return environment.getProperty(remainder); + } + + ConfigData configData = new SpringConfigProvider().getConfigData(getCamelContext()); + if (configData == null) { + throw new RuntimeCamelException("Cannot retrieve any config data from Spring Config for property " + remainder); + } + + String result = null; + for (PropertySource propertySource : configData.getPropertySources()) { + if (propertySource.containsProperty(remainder)) { + result = propertySource.getProperty(remainder).toString(); + } + } + + SpringConfigRemaindersCache.put(remainder, result); + + return result; + } + + @Override + public void setCamelContext(CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Override + public CamelContext getCamelContext() { + return this.camelContext; + } + + @Override + public String getName() { + return "spring-config"; + } + + @Override + public void setEnvironment(Environment environment) { + this.environment = environment; + } +} diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringCloudConfigReloadTriggerTask.java b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringCloudConfigReloadTriggerTask.java new file mode 100644 index 00000000000..29d6da71ed8 --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringCloudConfigReloadTriggerTask.java @@ -0,0 +1,78 @@ +/* + * 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.spring.cloud.config; + +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.CamelContextAware; +import org.apache.camel.spi.ContextReloadStrategy; +import org.apache.camel.spi.annotations.PeriodicTask; +import org.apache.camel.support.service.ServiceSupport; +import org.springframework.boot.context.config.ConfigData; +import org.springframework.core.env.PropertySource; + +/** + * A periodic task that monitors Spring Cloud Config properties for changes and triggers a Camel context reload when + * property values have changed. + * <p> + * It compares the current property values in Spring Cloud Config with cached values stored in + * {@link SpringConfigRemaindersCache}. When a property value has changed, it triggers the reload of the Camel context + * using the {@link ContextReloadStrategy} service. + * </p> + * + * @see ContextReloadStrategy + * @see SpringConfigRemaindersCache + * @see SpringConfigProvider + */ +@PeriodicTask("spring-config-refresh") +public class SpringCloudConfigReloadTriggerTask extends ServiceSupport implements CamelContextAware, Runnable { + + private CamelContext camelContext; + + @Override + public void run() { + if (SpringConfigRemaindersCache.get().isEmpty()) { + return; + } + + ConfigData configData = new SpringConfigProvider().getConfigData(getCamelContext()); + + for (Map.Entry<String, String> entry : SpringConfigRemaindersCache.get().entrySet()) { + for (PropertySource propertySource : configData.getPropertySources()) { + if (propertySource.containsProperty(entry.getKey()) + && !propertySource.getProperty(entry.getKey()).equals(entry.getValue())) { + ContextReloadStrategy reload = camelContext.hasService(ContextReloadStrategy.class); + if (reload != null) { + // trigger reload + reload.onReload(this); + } + } + } + } + } + + @Override + public void setCamelContext(CamelContext camelContext) { + this.camelContext = camelContext; + } + + @Override + public CamelContext getCamelContext() { + return this.camelContext; + } +} diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringConfigProvider.java b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringConfigProvider.java new file mode 100644 index 00000000000..a54904a51f8 --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringConfigProvider.java @@ -0,0 +1,110 @@ +/* + * 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.spring.cloud.config; + +import org.apache.camel.CamelContext; +import org.apache.camel.vault.SpringCloudConfigConfiguration; +import org.apache.commons.logging.LogFactory; +import org.springframework.boot.BootstrapRegistry; +import org.springframework.boot.ConfigurableBootstrapContext; +import org.springframework.boot.DefaultBootstrapContext; +import org.springframework.boot.context.config.ConfigData; +import org.springframework.boot.context.config.ConfigDataLoaderContext; +import org.springframework.boot.logging.DeferredLogs; +import org.springframework.cloud.config.client.ConfigClientProperties; +import org.springframework.cloud.config.client.ConfigClientRequestTemplateFactory; +import org.springframework.cloud.config.client.ConfigServerConfigDataLoader; +import org.springframework.cloud.config.client.ConfigServerConfigDataResource; +import org.springframework.core.env.Environment; +import org.springframework.core.env.StandardEnvironment; +import org.springframework.web.client.RestTemplate; + +/** + * Provider class that retrieves configuration data from a Spring Cloud Config Server. + * <p> + * This class serves as a bridge between Apache Camel and Spring Cloud Config, allowing Camel contexts to fetch their + * configuration from a centralized Spring Cloud Config Server. It handles the authentication and connection details + * necessary to communicate with the config server. + * <p> + * The configuration parameters are sourced from {@link SpringCloudConfigConfiguration} which is obtained from the Camel + * context's vault configuration. + * + * @see org.apache.camel.vault.SpringCloudConfigConfiguration + * @see org.springframework.cloud.config.client.ConfigServerConfigDataLoader + */ +public class SpringConfigProvider { + + /** + * Retrieves configuration data from a Spring Cloud Config Server for the given Camel context. + * <p> + * This method sets up the necessary Spring Cloud Config components to connect to a config server using the + * parameters defined in the Camel context's Spring Cloud Config configuration. It handles authentication + * credentials, connection URIs, and other configuration properties. + * + * @param camelContext The Camel context for which to retrieve configuration data. This context is used to obtain + * configuration parameters and to identify the application name to be used when fetching + * configuration from the server. + * @return A {@link ConfigData} object containing the configuration properties retrieved from the + * Spring Cloud Config Server. + * + * @see org.springframework.boot.context.config.ConfigData + * @see org.apache.camel.CamelContext + */ + public ConfigData getConfigData(CamelContext camelContext) { + SpringCloudConfigConfiguration configuration = camelContext.getVaultConfiguration().springConfig(); + ConfigServerConfigDataLoader configServerConfigDataLoader = new ConfigServerConfigDataLoader(new DeferredLogs()); + + Environment camelEnvironment = new StandardEnvironment(); + ConfigClientProperties configClientProperties = new ConfigClientProperties(camelEnvironment); + configClientProperties.setName(camelContext.getName()); + configClientProperties.setUsername(configuration.getUsername()); + configClientProperties.setPassword(configuration.getPassword()); + configClientProperties.setToken(configuration.getToken()); + + if (configuration.getLabel() != null) { + configClientProperties.setLabel(configuration.getLabel()); + } + if (configuration.getProfile() != null) { + configClientProperties.setProfile(configuration.getProfile()); + } + if (configuration.getUris() != null && !configuration.getUris().isEmpty()) { + configClientProperties.setUri(configuration.getUris().split(",")); + } + + // Spring Cloud Config does not expose a plain Spring API easy to use + // This code implements a similar behaviour to Spring Boot Config usage + ConfigurableBootstrapContext configurableBootstrapContext = new DefaultBootstrapContext(); + configurableBootstrapContext.register(RestTemplate.class, + BootstrapRegistry.InstanceSupplier.of(new RestTemplate())); + configurableBootstrapContext.register(ConfigClientProperties.class, + BootstrapRegistry.InstanceSupplier.of(configClientProperties)); + configurableBootstrapContext.register(ConfigClientRequestTemplateFactory.class, + BootstrapRegistry.InstanceSupplier.of(new ConfigClientRequestTemplateFactory( + LogFactory.getLog(SpringCloudConfigPropertiesFunction.class), + configClientProperties))); + + ConfigDataLoaderContext configDataLoaderContext = () -> configurableBootstrapContext; + + ConfigServerConfigDataResource configServerConfigDataResource + = new ConfigServerConfigDataResource(configClientProperties, true, null); + + ConfigData configData = configServerConfigDataLoader.doLoad(configDataLoaderContext, + configServerConfigDataResource); + + return configData; + } +} diff --git a/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringConfigRemaindersCache.java b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringConfigRemaindersCache.java new file mode 100644 index 00000000000..e365d1e6d3c --- /dev/null +++ b/components/camel-spring-parent/camel-spring-cloud-config/src/main/java/org/apache/camel/component/spring/cloud/config/SpringConfigRemaindersCache.java @@ -0,0 +1,36 @@ +/* + * 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.spring.cloud.config; + +import java.util.HashMap; +import java.util.Map; + +public class SpringConfigRemaindersCache { + + private SpringConfigRemaindersCache() { + } + + private static final Map<String, String> REMAINDERS_CACHE = new HashMap<>(); + + public static Map<String, String> get() { + return REMAINDERS_CACHE; + } + + public static void put(String remainder, String value) { + REMAINDERS_CACHE.put(remainder, value); + } +} diff --git a/components/camel-spring-parent/pom.xml b/components/camel-spring-parent/pom.xml index 745a3951f5d..184139276ff 100644 --- a/components/camel-spring-parent/pom.xml +++ b/components/camel-spring-parent/pom.xml @@ -45,6 +45,7 @@ <module>camel-spring-ws</module> <module>camel-spring-xml</module> <module>camel-undertow-spring-security</module> + <module>camel-spring-cloud-config</module> </modules> </project> diff --git a/core/camel-api/src/main/java/org/apache/camel/vault/SpringCloudConfigConfiguration.java b/core/camel-api/src/main/java/org/apache/camel/vault/SpringCloudConfigConfiguration.java new file mode 100644 index 00000000000..c92536c9be5 --- /dev/null +++ b/core/camel-api/src/main/java/org/apache/camel/vault/SpringCloudConfigConfiguration.java @@ -0,0 +1,106 @@ +/* + * 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.vault; + +import org.apache.camel.spi.Metadata; + +/** + * Configuration for Spring Cloud Config + */ +public class SpringCloudConfigConfiguration extends VaultConfiguration { + + @Metadata(secret = true) + private String password; + @Metadata(defaultValue = "user") + private String username = "user"; + @Metadata(defaultValue = "http://localhost:8888", description = "Comma separated list of Spring Config Server URIs") + private String uris = "http://localhost:8888"; + @Metadata + private boolean refreshEnabled; + @Metadata(defaultValue = "30000") + private long refreshPeriod = 30000; + @Metadata(secret = true) + private String token; + @Metadata + private String label; + @Metadata + private String profile; + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUris() { + return uris; + } + + public void setUris(String uris) { + this.uris = uris; + } + + public boolean isRefreshEnabled() { + return refreshEnabled; + } + + public void setRefreshEnabled(boolean refreshEnabled) { + this.refreshEnabled = refreshEnabled; + } + + public long getRefreshPeriod() { + return refreshPeriod; + } + + public void setRefreshPeriod(long refreshPeriod) { + this.refreshPeriod = refreshPeriod; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getProfile() { + return profile; + } + + public void setProfile(String profile) { + this.profile = profile; + } +} diff --git a/core/camel-api/src/main/java/org/apache/camel/vault/VaultConfiguration.java b/core/camel-api/src/main/java/org/apache/camel/vault/VaultConfiguration.java index e2025405cd3..a76b041fe1f 100644 --- a/core/camel-api/src/main/java/org/apache/camel/vault/VaultConfiguration.java +++ b/core/camel-api/src/main/java/org/apache/camel/vault/VaultConfiguration.java @@ -28,6 +28,7 @@ public class VaultConfiguration { private KubernetesVaultConfiguration kubernetes; private KubernetesConfigMapVaultConfiguration kubernetesConfigmaps; private IBMSecretsManagerVaultConfiguration ibmSecretsManager; + private SpringCloudConfigConfiguration springConfig; /** * AWS Vault Configuration @@ -99,6 +100,13 @@ public class VaultConfiguration { return ibmSecretsManager; } + public SpringCloudConfigConfiguration springConfig() { + if (springConfig == null) { + springConfig = new SpringCloudConfigConfiguration(); + } + return springConfig; + } + public AwsVaultConfiguration getAwsVaultConfiguration() { return aws; } @@ -154,4 +162,12 @@ public class VaultConfiguration { public void setIBMSecretsManagerVaultConfiguration(IBMSecretsManagerVaultConfiguration ibmSecretsManager) { this.ibmSecretsManager = ibmSecretsManager; } + + public SpringCloudConfigConfiguration getSpringCloudConfigConfiguration() { + return springConfig; + } + + public void setSpringCloudConfigConfiguration(SpringCloudConfigConfiguration springCloudConfigConfiguration) { + this.springConfig = springCloudConfigConfiguration; + } } diff --git a/core/camel-main/pom.xml b/core/camel-main/pom.xml index 9c928dad21d..fac7e18f738 100644 --- a/core/camel-main/pom.xml +++ b/core/camel-main/pom.xml @@ -171,6 +171,8 @@ <class>org.apache.camel.vault.KubernetesConfigMapVaultConfiguration=org.apache.camel.main.KubernetesConfigMapVaultConfiguration</class> <!-- we want to have configurer for IBMSecretsManagerVaultConfiguration in the package main to prevent a split packages issue --> <class>org.apache.camel.vault.IBMSecretsManagerVaultConfiguration=org.apache.camel.main.IBMSecretsManagerVaultConfiguration</class> + <!-- we want to have configurer for SpringCloudConfigConfiguration in the package main to prevent a split packages issue --> + <class>org.apache.camel.vault.SpringCloudConfigConfiguration=org.apache.camel.main.SpringCloudConfigConfiguration</class> </classes> </configuration> </execution> diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java index b3c2e8b9f5a..8b85a576fd7 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java @@ -55,6 +55,8 @@ public class AwsVaultConfigurationConfigurer extends org.apache.camel.support.co case "secretkey": case "secretKey": target.setSecretKey(property(camelContext, java.lang.String.class, value)); return true; case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "sqsqueueurl": case "sqsQueueUrl": target.setSqsQueueUrl(property(camelContext, java.lang.String.class, value)); return true; case "uriendpointoverride": @@ -100,6 +102,8 @@ public class AwsVaultConfigurationConfigurer extends org.apache.camel.support.co case "secretkey": case "secretKey": return java.lang.String.class; case "secrets": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "sqsqueueurl": case "sqsQueueUrl": return java.lang.String.class; case "uriendpointoverride": @@ -146,6 +150,8 @@ public class AwsVaultConfigurationConfigurer extends org.apache.camel.support.co case "secretkey": case "secretKey": return target.getSecretKey(); case "secrets": return target.getSecrets(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "sqsqueueurl": case "sqsQueueUrl": return target.getSqsQueueUrl(); case "uriendpointoverride": diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java index 32234d8f7c3..80a7594e384 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java @@ -39,6 +39,7 @@ public class AwsVaultConfigurationPropertiesConfigurer extends org.apache.camel. map.put("Region", java.lang.String.class); map.put("SecretKey", java.lang.String.class); map.put("Secrets", java.lang.String.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); map.put("SqsQueueUrl", java.lang.String.class); map.put("UriEndpointOverride", java.lang.String.class); map.put("UseSqsNotification", boolean.class); @@ -81,6 +82,8 @@ public class AwsVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "secretkey": case "secretKey": target.setSecretKey(property(camelContext, java.lang.String.class, value)); return true; case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "sqsqueueurl": case "sqsQueueUrl": target.setSqsQueueUrl(property(camelContext, java.lang.String.class, value)); return true; case "uriendpointoverride": @@ -131,6 +134,8 @@ public class AwsVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "secretkey": case "secretKey": return java.lang.String.class; case "secrets": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "sqsqueueurl": case "sqsQueueUrl": return java.lang.String.class; case "uriendpointoverride": @@ -177,6 +182,8 @@ public class AwsVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "secretkey": case "secretKey": return target.getSecretKey(); case "secrets": return target.getSecrets(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "sqsqueueurl": case "sqsQueueUrl": return target.getSqsQueueUrl(); case "uriendpointoverride": diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationConfigurer.java index 62411aa2f9f..3aa171ae276 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationConfigurer.java @@ -56,6 +56,8 @@ public class AzureVaultConfigurationConfigurer extends org.apache.camel.support. case "refreshperiod": case "refreshPeriod": target.setRefreshPeriod(property(camelContext, long.class, value)); return true; case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "tenantid": case "tenantId": target.setTenantId(property(camelContext, java.lang.String.class, value)); return true; case "vaultname": @@ -100,6 +102,8 @@ public class AzureVaultConfigurationConfigurer extends org.apache.camel.support. case "refreshperiod": case "refreshPeriod": return long.class; case "secrets": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "tenantid": case "tenantId": return java.lang.String.class; case "vaultname": @@ -145,6 +149,8 @@ public class AzureVaultConfigurationConfigurer extends org.apache.camel.support. case "refreshperiod": case "refreshPeriod": return target.getRefreshPeriod(); case "secrets": return target.getSecrets(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "tenantid": case "tenantId": return target.getTenantId(); case "vaultname": diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationPropertiesConfigurer.java index 34fc1165cd1..143e964988c 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/AzureVaultConfigurationPropertiesConfigurer.java @@ -39,6 +39,7 @@ public class AzureVaultConfigurationPropertiesConfigurer extends org.apache.came map.put("RefreshEnabled", boolean.class); map.put("RefreshPeriod", long.class); map.put("Secrets", java.lang.String.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); map.put("TenantId", java.lang.String.class); map.put("VaultName", java.lang.String.class); ALL_OPTIONS = map; @@ -81,6 +82,8 @@ public class AzureVaultConfigurationPropertiesConfigurer extends org.apache.came case "refreshperiod": case "refreshPeriod": target.setRefreshPeriod(property(camelContext, long.class, value)); return true; case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "tenantid": case "tenantId": target.setTenantId(property(camelContext, java.lang.String.class, value)); return true; case "vaultname": @@ -130,6 +133,8 @@ public class AzureVaultConfigurationPropertiesConfigurer extends org.apache.came case "refreshperiod": case "refreshPeriod": return long.class; case "secrets": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "tenantid": case "tenantId": return java.lang.String.class; case "vaultname": @@ -175,6 +180,8 @@ public class AzureVaultConfigurationPropertiesConfigurer extends org.apache.came case "refreshperiod": case "refreshPeriod": return target.getRefreshPeriod(); case "secrets": return target.getSecrets(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "tenantid": case "tenantId": return target.getTenantId(); case "vaultname": diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationConfigurer.java index 6ac3e5e2a0a..edcc9a89ccd 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationConfigurer.java @@ -46,6 +46,8 @@ public class GcpVaultConfigurationConfigurer extends org.apache.camel.support.co case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; case "serviceaccountkey": case "serviceAccountKey": target.setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "subscriptionname": case "subscriptionName": target.setSubscriptionName(property(camelContext, java.lang.String.class, value)); return true; case "usedefaultinstance": @@ -80,6 +82,8 @@ public class GcpVaultConfigurationConfigurer extends org.apache.camel.support.co case "secrets": return java.lang.String.class; case "serviceaccountkey": case "serviceAccountKey": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "subscriptionname": case "subscriptionName": return java.lang.String.class; case "usedefaultinstance": @@ -115,6 +119,8 @@ public class GcpVaultConfigurationConfigurer extends org.apache.camel.support.co case "secrets": return target.getSecrets(); case "serviceaccountkey": case "serviceAccountKey": return target.getServiceAccountKey(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "subscriptionname": case "subscriptionName": return target.getSubscriptionName(); case "usedefaultinstance": diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationPropertiesConfigurer.java index a8b9fe502e7..3ba413b8188 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationPropertiesConfigurer.java @@ -34,6 +34,7 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. map.put("RefreshPeriod", long.class); map.put("Secrets", java.lang.String.class); map.put("ServiceAccountKey", java.lang.String.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); map.put("SubscriptionName", java.lang.String.class); map.put("UseDefaultInstance", boolean.class); ALL_OPTIONS = map; @@ -66,6 +67,8 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; case "serviceaccountkey": case "serviceAccountKey": target.setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "subscriptionname": case "subscriptionName": target.setSubscriptionName(property(camelContext, java.lang.String.class, value)); return true; case "usedefaultinstance": @@ -105,6 +108,8 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "secrets": return java.lang.String.class; case "serviceaccountkey": case "serviceAccountKey": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "subscriptionname": case "subscriptionName": return java.lang.String.class; case "usedefaultinstance": @@ -140,6 +145,8 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "secrets": return target.getSecrets(); case "serviceaccountkey": case "serviceAccountKey": return target.getServiceAccountKey(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "subscriptionname": case "subscriptionName": return target.getSubscriptionName(); case "usedefaultinstance": diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java index f047233b3c6..5c50d335664 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationConfigurer.java @@ -42,6 +42,8 @@ public class HashicorpVaultConfigurationConfigurer extends org.apache.camel.supp case "namespace": target.setNamespace(property(camelContext, java.lang.String.class, value)); return true; case "port": target.setPort(property(camelContext, java.lang.String.class, value)); return true; case "scheme": target.setScheme(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "token": target.setToken(property(camelContext, java.lang.String.class, value)); return true; default: return false; } @@ -69,6 +71,8 @@ public class HashicorpVaultConfigurationConfigurer extends org.apache.camel.supp case "namespace": return java.lang.String.class; case "port": return java.lang.String.class; case "scheme": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "token": return java.lang.String.class; default: return null; } @@ -97,6 +101,8 @@ public class HashicorpVaultConfigurationConfigurer extends org.apache.camel.supp case "namespace": return target.getNamespace(); case "port": return target.getPort(); case "scheme": return target.getScheme(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "token": return target.getToken(); default: return null; } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java index f96da8dce63..36a3c51f79d 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/HashicorpVaultConfigurationPropertiesConfigurer.java @@ -34,6 +34,7 @@ public class HashicorpVaultConfigurationPropertiesConfigurer extends org.apache. map.put("Namespace", java.lang.String.class); map.put("Port", java.lang.String.class); map.put("Scheme", java.lang.String.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); map.put("Token", java.lang.String.class); ALL_OPTIONS = map; } @@ -61,6 +62,8 @@ public class HashicorpVaultConfigurationPropertiesConfigurer extends org.apache. case "namespace": target.setNamespace(property(camelContext, java.lang.String.class, value)); return true; case "port": target.setPort(property(camelContext, java.lang.String.class, value)); return true; case "scheme": target.setScheme(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "token": target.setToken(property(camelContext, java.lang.String.class, value)); return true; default: return false; } @@ -93,6 +96,8 @@ public class HashicorpVaultConfigurationPropertiesConfigurer extends org.apache. case "namespace": return java.lang.String.class; case "port": return java.lang.String.class; case "scheme": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "token": return java.lang.String.class; default: return null; } @@ -121,6 +126,8 @@ public class HashicorpVaultConfigurationPropertiesConfigurer extends org.apache. case "namespace": return target.getNamespace(); case "port": return target.getPort(); case "scheme": return target.getScheme(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "token": return target.getToken(); default: return null; } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationConfigurer.java index 6cb28ea5990..fb582583f2f 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationConfigurer.java @@ -54,6 +54,8 @@ public class IBMSecretsManagerVaultConfigurationConfigurer extends org.apache.ca case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; case "serviceurl": case "serviceUrl": target.setServiceUrl(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "token": target.setToken(property(camelContext, java.lang.String.class, value)); return true; default: return false; } @@ -93,6 +95,8 @@ public class IBMSecretsManagerVaultConfigurationConfigurer extends org.apache.ca case "secrets": return java.lang.String.class; case "serviceurl": case "serviceUrl": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "token": return java.lang.String.class; default: return null; } @@ -133,6 +137,8 @@ public class IBMSecretsManagerVaultConfigurationConfigurer extends org.apache.ca case "secrets": return target.getSecrets(); case "serviceurl": case "serviceUrl": return target.getServiceUrl(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "token": return target.getToken(); default: return null; } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationPropertiesConfigurer.java index a028422bcba..0b549029015 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/IBMSecretsManagerVaultConfigurationPropertiesConfigurer.java @@ -38,6 +38,7 @@ public class IBMSecretsManagerVaultConfigurationPropertiesConfigurer extends org map.put("RefreshEnabled", boolean.class); map.put("Secrets", java.lang.String.class); map.put("ServiceUrl", java.lang.String.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); map.put("Token", java.lang.String.class); ALL_OPTIONS = map; } @@ -77,6 +78,8 @@ public class IBMSecretsManagerVaultConfigurationPropertiesConfigurer extends org case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; case "serviceurl": case "serviceUrl": target.setServiceUrl(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; case "token": target.setToken(property(camelContext, java.lang.String.class, value)); return true; default: return false; } @@ -121,6 +124,8 @@ public class IBMSecretsManagerVaultConfigurationPropertiesConfigurer extends org case "secrets": return java.lang.String.class; case "serviceurl": case "serviceUrl": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; case "token": return java.lang.String.class; default: return null; } @@ -161,6 +166,8 @@ public class IBMSecretsManagerVaultConfigurationPropertiesConfigurer extends org case "secrets": return target.getSecrets(); case "serviceurl": case "serviceUrl": return target.getServiceUrl(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); case "token": return target.getToken(); default: return null; } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigMapVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigMapVaultConfigurationConfigurer.java index a578c0138d7..d0076d8b568 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigMapVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigMapVaultConfigurationConfigurer.java @@ -40,6 +40,8 @@ public class KubernetesConfigMapVaultConfigurationConfigurer extends org.apache. case "kubernetesVaultConfiguration": target.setKubernetesVaultConfiguration(property(camelContext, org.apache.camel.vault.KubernetesVaultConfiguration.class, value)); return true; case "refreshenabled": case "refreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; default: return false; } } @@ -64,6 +66,8 @@ public class KubernetesConfigMapVaultConfigurationConfigurer extends org.apache. case "kubernetesVaultConfiguration": return org.apache.camel.vault.KubernetesVaultConfiguration.class; case "refreshenabled": case "refreshEnabled": return boolean.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; default: return null; } } @@ -89,6 +93,8 @@ public class KubernetesConfigMapVaultConfigurationConfigurer extends org.apache. case "kubernetesVaultConfiguration": return target.getKubernetesVaultConfiguration(); case "refreshenabled": case "refreshEnabled": return target.isRefreshEnabled(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); default: return null; } } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigmapsVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigmapsVaultConfigurationPropertiesConfigurer.java index b56d9f689e7..4fed952a1a5 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigmapsVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesConfigmapsVaultConfigurationPropertiesConfigurer.java @@ -31,6 +31,7 @@ public class KubernetesConfigmapsVaultConfigurationPropertiesConfigurer extends map.put("KubernetesConfigMapVaultConfiguration", org.apache.camel.vault.KubernetesConfigMapVaultConfiguration.class); map.put("KubernetesVaultConfiguration", org.apache.camel.vault.KubernetesVaultConfiguration.class); map.put("RefreshEnabled", boolean.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); ALL_OPTIONS = map; } @@ -55,6 +56,8 @@ public class KubernetesConfigmapsVaultConfigurationPropertiesConfigurer extends case "kubernetesVaultConfiguration": target.setKubernetesVaultConfiguration(property(camelContext, org.apache.camel.vault.KubernetesVaultConfiguration.class, value)); return true; case "refreshenabled": case "refreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; default: return false; } } @@ -84,6 +87,8 @@ public class KubernetesConfigmapsVaultConfigurationPropertiesConfigurer extends case "kubernetesVaultConfiguration": return org.apache.camel.vault.KubernetesVaultConfiguration.class; case "refreshenabled": case "refreshEnabled": return boolean.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; default: return null; } } @@ -109,6 +114,8 @@ public class KubernetesConfigmapsVaultConfigurationPropertiesConfigurer extends case "kubernetesVaultConfiguration": return target.getKubernetesVaultConfiguration(); case "refreshenabled": case "refreshEnabled": return target.isRefreshEnabled(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); default: return null; } } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationConfigurer.java index 4fb4aadaab6..d3abb96af9e 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationConfigurer.java @@ -40,6 +40,8 @@ public class KubernetesVaultConfigurationConfigurer extends org.apache.camel.sup case "refreshenabled": case "refreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true; case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; default: return false; } } @@ -64,6 +66,8 @@ public class KubernetesVaultConfigurationConfigurer extends org.apache.camel.sup case "refreshenabled": case "refreshEnabled": return boolean.class; case "secrets": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; default: return null; } } @@ -89,6 +93,8 @@ public class KubernetesVaultConfigurationConfigurer extends org.apache.camel.sup case "refreshenabled": case "refreshEnabled": return target.isRefreshEnabled(); case "secrets": return target.getSecrets(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); default: return null; } } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationPropertiesConfigurer.java index 279b129113c..04c0b1c5d89 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/KubernetesVaultConfigurationPropertiesConfigurer.java @@ -31,6 +31,7 @@ public class KubernetesVaultConfigurationPropertiesConfigurer extends org.apache map.put("KubernetesVaultConfiguration", org.apache.camel.vault.KubernetesVaultConfiguration.class); map.put("RefreshEnabled", boolean.class); map.put("Secrets", java.lang.String.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); ALL_OPTIONS = map; } @@ -55,6 +56,8 @@ public class KubernetesVaultConfigurationPropertiesConfigurer extends org.apache case "refreshenabled": case "refreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true; case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; default: return false; } } @@ -84,6 +87,8 @@ public class KubernetesVaultConfigurationPropertiesConfigurer extends org.apache case "refreshenabled": case "refreshEnabled": return boolean.class; case "secrets": return java.lang.String.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; default: return null; } } @@ -109,6 +114,8 @@ public class KubernetesVaultConfigurationPropertiesConfigurer extends org.apache case "refreshenabled": case "refreshEnabled": return target.isRefreshEnabled(); case "secrets": return target.getSecrets(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); default: return null; } } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/SpringCloudConfigConfigurationConfigurer.java similarity index 70% copy from core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationConfigurer.java copy to core/camel-main/src/generated/java/org/apache/camel/main/SpringCloudConfigConfigurationConfigurer.java index 6ac3e5e2a0a..1604734741d 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/SpringCloudConfigConfigurationConfigurer.java @@ -10,18 +10,18 @@ import org.apache.camel.spi.PropertyConfigurerGetter; import org.apache.camel.spi.ConfigurerStrategy; import org.apache.camel.spi.GeneratedPropertyConfigurer; import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.vault.GcpVaultConfiguration; +import org.apache.camel.vault.SpringCloudConfigConfiguration; /** * Generated by camel build tools - do NOT edit this file! */ @Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo") @SuppressWarnings("unchecked") -public class GcpVaultConfigurationConfigurer extends org.apache.camel.support.component.PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { +public class SpringCloudConfigConfigurationConfigurer extends org.apache.camel.support.component.PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { @Override public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - org.apache.camel.vault.GcpVaultConfiguration target = (org.apache.camel.vault.GcpVaultConfiguration) obj; + org.apache.camel.vault.SpringCloudConfigConfiguration target = (org.apache.camel.vault.SpringCloudConfigConfiguration) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "awsvaultconfiguration": case "awsVaultConfiguration": target.setAwsVaultConfiguration(property(camelContext, org.apache.camel.vault.AwsVaultConfiguration.class, value)); return true; @@ -37,19 +37,18 @@ public class GcpVaultConfigurationConfigurer extends org.apache.camel.support.co case "kubernetesConfigMapVaultConfiguration": target.setKubernetesConfigMapVaultConfiguration(property(camelContext, org.apache.camel.vault.KubernetesConfigMapVaultConfiguration.class, value)); return true; case "kubernetesvaultconfiguration": case "kubernetesVaultConfiguration": target.setKubernetesVaultConfiguration(property(camelContext, org.apache.camel.vault.KubernetesVaultConfiguration.class, value)); return true; - case "projectid": - case "projectId": target.setProjectId(property(camelContext, java.lang.String.class, value)); return true; + case "label": target.setLabel(property(camelContext, java.lang.String.class, value)); return true; + case "password": target.setPassword(property(camelContext, java.lang.String.class, value)); return true; + case "profile": target.setProfile(property(camelContext, java.lang.String.class, value)); return true; case "refreshenabled": case "refreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true; case "refreshperiod": case "refreshPeriod": target.setRefreshPeriod(property(camelContext, long.class, value)); return true; - case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; - case "serviceaccountkey": - case "serviceAccountKey": target.setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; - case "subscriptionname": - case "subscriptionName": target.setSubscriptionName(property(camelContext, java.lang.String.class, value)); return true; - case "usedefaultinstance": - case "useDefaultInstance": target.setUseDefaultInstance(property(camelContext, boolean.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; + case "token": target.setToken(property(camelContext, java.lang.String.class, value)); return true; + case "uris": target.setUris(property(camelContext, java.lang.String.class, value)); return true; + case "username": target.setUsername(property(camelContext, java.lang.String.class, value)); return true; default: return false; } } @@ -71,26 +70,25 @@ public class GcpVaultConfigurationConfigurer extends org.apache.camel.support.co case "kubernetesConfigMapVaultConfiguration": return org.apache.camel.vault.KubernetesConfigMapVaultConfiguration.class; case "kubernetesvaultconfiguration": case "kubernetesVaultConfiguration": return org.apache.camel.vault.KubernetesVaultConfiguration.class; - case "projectid": - case "projectId": return java.lang.String.class; + case "label": return java.lang.String.class; + case "password": return java.lang.String.class; + case "profile": return java.lang.String.class; case "refreshenabled": case "refreshEnabled": return boolean.class; case "refreshperiod": case "refreshPeriod": return long.class; - case "secrets": return java.lang.String.class; - case "serviceaccountkey": - case "serviceAccountKey": return java.lang.String.class; - case "subscriptionname": - case "subscriptionName": return java.lang.String.class; - case "usedefaultinstance": - case "useDefaultInstance": return boolean.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; + case "token": return java.lang.String.class; + case "uris": return java.lang.String.class; + case "username": return java.lang.String.class; default: return null; } } @Override public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - org.apache.camel.vault.GcpVaultConfiguration target = (org.apache.camel.vault.GcpVaultConfiguration) obj; + org.apache.camel.vault.SpringCloudConfigConfiguration target = (org.apache.camel.vault.SpringCloudConfigConfiguration) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "awsvaultconfiguration": case "awsVaultConfiguration": return target.getAwsVaultConfiguration(); @@ -106,19 +104,18 @@ public class GcpVaultConfigurationConfigurer extends org.apache.camel.support.co case "kubernetesConfigMapVaultConfiguration": return target.getKubernetesConfigMapVaultConfiguration(); case "kubernetesvaultconfiguration": case "kubernetesVaultConfiguration": return target.getKubernetesVaultConfiguration(); - case "projectid": - case "projectId": return target.getProjectId(); + case "label": return target.getLabel(); + case "password": return target.getPassword(); + case "profile": return target.getProfile(); case "refreshenabled": case "refreshEnabled": return target.isRefreshEnabled(); case "refreshperiod": case "refreshPeriod": return target.getRefreshPeriod(); - case "secrets": return target.getSecrets(); - case "serviceaccountkey": - case "serviceAccountKey": return target.getServiceAccountKey(); - case "subscriptionname": - case "subscriptionName": return target.getSubscriptionName(); - case "usedefaultinstance": - case "useDefaultInstance": return target.isUseDefaultInstance(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); + case "token": return target.getToken(); + case "uris": return target.getUris(); + case "username": return target.getUsername(); default: return null; } } diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/SpringCloudConfigConfigurationPropertiesConfigurer.java similarity index 70% copy from core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationPropertiesConfigurer.java copy to core/camel-main/src/generated/java/org/apache/camel/main/SpringCloudConfigConfigurationPropertiesConfigurer.java index a8b9fe502e7..32db893ddd9 100644 --- a/core/camel-main/src/generated/java/org/apache/camel/main/GcpVaultConfigurationPropertiesConfigurer.java +++ b/core/camel-main/src/generated/java/org/apache/camel/main/SpringCloudConfigConfigurationPropertiesConfigurer.java @@ -10,14 +10,14 @@ import org.apache.camel.spi.PropertyConfigurerGetter; import org.apache.camel.spi.ConfigurerStrategy; import org.apache.camel.spi.GeneratedPropertyConfigurer; import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.main.GcpVaultConfigurationProperties; +import org.apache.camel.main.SpringCloudConfigConfigurationProperties; /** * Generated by camel build tools - do NOT edit this file! */ @Generated("org.apache.camel.maven.packaging.GenerateConfigurerMojo") @SuppressWarnings("unchecked") -public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel.support.component.PropertyConfigurerSupport implements GeneratedPropertyConfigurer, ExtendedPropertyConfigurerGetter { +public class SpringCloudConfigConfigurationPropertiesConfigurer extends org.apache.camel.support.component.PropertyConfigurerSupport implements GeneratedPropertyConfigurer, ExtendedPropertyConfigurerGetter { private static final Map<String, Object> ALL_OPTIONS; static { @@ -29,19 +29,21 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. map.put("IBMSecretsManagerVaultConfiguration", org.apache.camel.vault.IBMSecretsManagerVaultConfiguration.class); map.put("KubernetesConfigMapVaultConfiguration", org.apache.camel.vault.KubernetesConfigMapVaultConfiguration.class); map.put("KubernetesVaultConfiguration", org.apache.camel.vault.KubernetesVaultConfiguration.class); - map.put("ProjectId", java.lang.String.class); + map.put("Label", java.lang.String.class); + map.put("Password", java.lang.String.class); + map.put("Profile", java.lang.String.class); map.put("RefreshEnabled", boolean.class); map.put("RefreshPeriod", long.class); - map.put("Secrets", java.lang.String.class); - map.put("ServiceAccountKey", java.lang.String.class); - map.put("SubscriptionName", java.lang.String.class); - map.put("UseDefaultInstance", boolean.class); + map.put("SpringCloudConfigConfiguration", org.apache.camel.vault.SpringCloudConfigConfiguration.class); + map.put("Token", java.lang.String.class); + map.put("Uris", java.lang.String.class); + map.put("Username", java.lang.String.class); ALL_OPTIONS = map; } @Override public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - org.apache.camel.main.GcpVaultConfigurationProperties target = (org.apache.camel.main.GcpVaultConfigurationProperties) obj; + org.apache.camel.main.SpringCloudConfigConfigurationProperties target = (org.apache.camel.main.SpringCloudConfigConfigurationProperties) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "awsvaultconfiguration": case "awsVaultConfiguration": target.setAwsVaultConfiguration(property(camelContext, org.apache.camel.vault.AwsVaultConfiguration.class, value)); return true; @@ -57,19 +59,18 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "kubernetesConfigMapVaultConfiguration": target.setKubernetesConfigMapVaultConfiguration(property(camelContext, org.apache.camel.vault.KubernetesConfigMapVaultConfiguration.class, value)); return true; case "kubernetesvaultconfiguration": case "kubernetesVaultConfiguration": target.setKubernetesVaultConfiguration(property(camelContext, org.apache.camel.vault.KubernetesVaultConfiguration.class, value)); return true; - case "projectid": - case "projectId": target.setProjectId(property(camelContext, java.lang.String.class, value)); return true; + case "label": target.setLabel(property(camelContext, java.lang.String.class, value)); return true; + case "password": target.setPassword(property(camelContext, java.lang.String.class, value)); return true; + case "profile": target.setProfile(property(camelContext, java.lang.String.class, value)); return true; case "refreshenabled": case "refreshEnabled": target.setRefreshEnabled(property(camelContext, boolean.class, value)); return true; case "refreshperiod": case "refreshPeriod": target.setRefreshPeriod(property(camelContext, long.class, value)); return true; - case "secrets": target.setSecrets(property(camelContext, java.lang.String.class, value)); return true; - case "serviceaccountkey": - case "serviceAccountKey": target.setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; - case "subscriptionname": - case "subscriptionName": target.setSubscriptionName(property(camelContext, java.lang.String.class, value)); return true; - case "usedefaultinstance": - case "useDefaultInstance": target.setUseDefaultInstance(property(camelContext, boolean.class, value)); return true; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": target.setSpringCloudConfigConfiguration(property(camelContext, org.apache.camel.vault.SpringCloudConfigConfiguration.class, value)); return true; + case "token": target.setToken(property(camelContext, java.lang.String.class, value)); return true; + case "uris": target.setUris(property(camelContext, java.lang.String.class, value)); return true; + case "username": target.setUsername(property(camelContext, java.lang.String.class, value)); return true; default: return false; } } @@ -96,26 +97,25 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "kubernetesConfigMapVaultConfiguration": return org.apache.camel.vault.KubernetesConfigMapVaultConfiguration.class; case "kubernetesvaultconfiguration": case "kubernetesVaultConfiguration": return org.apache.camel.vault.KubernetesVaultConfiguration.class; - case "projectid": - case "projectId": return java.lang.String.class; + case "label": return java.lang.String.class; + case "password": return java.lang.String.class; + case "profile": return java.lang.String.class; case "refreshenabled": case "refreshEnabled": return boolean.class; case "refreshperiod": case "refreshPeriod": return long.class; - case "secrets": return java.lang.String.class; - case "serviceaccountkey": - case "serviceAccountKey": return java.lang.String.class; - case "subscriptionname": - case "subscriptionName": return java.lang.String.class; - case "usedefaultinstance": - case "useDefaultInstance": return boolean.class; + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return org.apache.camel.vault.SpringCloudConfigConfiguration.class; + case "token": return java.lang.String.class; + case "uris": return java.lang.String.class; + case "username": return java.lang.String.class; default: return null; } } @Override public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - org.apache.camel.main.GcpVaultConfigurationProperties target = (org.apache.camel.main.GcpVaultConfigurationProperties) obj; + org.apache.camel.main.SpringCloudConfigConfigurationProperties target = (org.apache.camel.main.SpringCloudConfigConfigurationProperties) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "awsvaultconfiguration": case "awsVaultConfiguration": return target.getAwsVaultConfiguration(); @@ -131,19 +131,18 @@ public class GcpVaultConfigurationPropertiesConfigurer extends org.apache.camel. case "kubernetesConfigMapVaultConfiguration": return target.getKubernetesConfigMapVaultConfiguration(); case "kubernetesvaultconfiguration": case "kubernetesVaultConfiguration": return target.getKubernetesVaultConfiguration(); - case "projectid": - case "projectId": return target.getProjectId(); + case "label": return target.getLabel(); + case "password": return target.getPassword(); + case "profile": return target.getProfile(); case "refreshenabled": case "refreshEnabled": return target.isRefreshEnabled(); case "refreshperiod": case "refreshPeriod": return target.getRefreshPeriod(); - case "secrets": return target.getSecrets(); - case "serviceaccountkey": - case "serviceAccountKey": return target.getServiceAccountKey(); - case "subscriptionname": - case "subscriptionName": return target.getSubscriptionName(); - case "usedefaultinstance": - case "useDefaultInstance": return target.isUseDefaultInstance(); + case "springcloudconfigconfiguration": + case "springCloudConfigConfiguration": return target.getSpringCloudConfigConfiguration(); + case "token": return target.getToken(); + case "uris": return target.getUris(); + case "username": return target.getUsername(); default: return null; } } diff --git a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json index 8db967e7b0c..d0bb8edc242 100644 --- a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json +++ b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json @@ -405,6 +405,14 @@ { "name": "camel.vault.kubernetes.refreshEnabled", "description": "Whether to automatically reload Camel upon secrets being updated in Kubernetes Cluster.", "sourceType": "org.apache.camel.vault.KubernetesVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, { "name": "camel.vault.kubernetes.secrets", "description": "Specify the secret names (or pattern) to check for updates. Multiple secrets can be separated by comma.", "sourceType": "org.apache.camel.vault.KubernetesVaultConfiguration", "type": "string", "javaType": "java.lang.String" }, { "name": "camel.vault.kubernetescm.configmaps", "description": "Specify the configmap names (or pattern) to check for updates. Multiple configmaps can be separated by comma.", "sourceType": "org.apache.camel.vault.KubernetesConfigMapVaultConfiguration", "type": "string", "javaType": "java.lang.String" }, - { "name": "camel.vault.kubernetescm.refreshEnabled", "description": "Whether to automatically reload Camel upon configmaps being updated in Kubernetes Cluster.", "sourceType": "org.apache.camel.vault.KubernetesConfigMapVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" } + { "name": "camel.vault.kubernetescm.refreshEnabled", "description": "Whether to automatically reload Camel upon configmaps being updated in Kubernetes Cluster.", "sourceType": "org.apache.camel.vault.KubernetesConfigMapVaultConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.vault.springConfig.label", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.password", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.profile", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.refreshEnabled", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "boolean", "javaType": "boolean", "defaultValue": "false" }, + { "name": "camel.vault.springConfig.refreshPeriod", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "integer", "javaType": "long", "defaultValue": 30000 }, + { "name": "camel.vault.springConfig.token", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String" }, + { "name": "camel.vault.springConfig.uris", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String", "defaultValue": "http:\/\/localhost:8888" }, + { "name": "camel.vault.springConfig.username", "description": null, "sourceType": "org.apache.camel.vault.SpringCloudConfigConfiguration", "type": "string", "javaType": "java.lang.String", "defaultValue": "user" } ] } diff --git a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.SpringCloudConfigConfigurationProperties b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.SpringCloudConfigConfigurationProperties new file mode 100644 index 00000000000..76f448aec6a --- /dev/null +++ b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.main.SpringCloudConfigConfigurationProperties @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.main.SpringCloudConfigConfigurationPropertiesConfigurer diff --git a/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.vault.SpringCloudConfigConfiguration b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.vault.SpringCloudConfigConfiguration new file mode 100644 index 00000000000..facb1d15e3a --- /dev/null +++ b/core/camel-main/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.vault.SpringCloudConfigConfiguration @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.main.SpringCloudConfigConfigurationConfigurer diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java index 4ea9e09307e..9846da59e14 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java @@ -1927,6 +1927,9 @@ public abstract class BaseMainSupport extends BaseService { if ("kubernetescm".equalsIgnoreCase(name)) { target = target.kubernetesConfigmaps(); } + if ("springConfig".equalsIgnoreCase(name)) { + target = target.springConfig(); + } if ("ibm".equalsIgnoreCase(name)) { target = target.ibmSecretsManager(); } diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java index 001ad910e5b..d1dee0fb9dd 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java @@ -767,6 +767,25 @@ public final class DefaultConfigurationConfigurer { scheduler.scheduledTask(r); } } + + if (vc.springConfig().isRefreshEnabled()) { + Optional<Runnable> task = PluginHelper.getPeriodTaskResolver(camelContext) + .newInstance("spring-config-refresh", Runnable.class); + if (task.isPresent()) { + long period = vc.springConfig().getRefreshPeriod(); + Runnable r = task.get(); + if (LOG.isDebugEnabled()) { + LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false)); + } + if (camelContext.hasService(ContextReloadStrategy.class) == null) { + // refresh is enabled then we need to automatically enable context-reload as well + ContextReloadStrategy reloader = new DefaultContextReloadStrategy(); + camelContext.addService(reloader); + } + PeriodTaskScheduler scheduler = PluginHelper.getPeriodTaskScheduler(camelContext); + scheduler.schedulePeriodTask(r, period); + } + } } public static void afterPropertiesSet(final CamelContext camelContext) throws Exception { diff --git a/core/camel-main/src/main/java/org/apache/camel/main/SpringCloudConfigConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/SpringCloudConfigConfigurationProperties.java new file mode 100644 index 00000000000..1a16a1fcadb --- /dev/null +++ b/core/camel-main/src/main/java/org/apache/camel/main/SpringCloudConfigConfigurationProperties.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.main; + +import org.apache.camel.spi.BootstrapCloseable; +import org.apache.camel.spi.Configurer; +import org.apache.camel.vault.SpringCloudConfigConfiguration; + +@Configurer(extended = true) +public class SpringCloudConfigConfigurationProperties extends SpringCloudConfigConfiguration implements BootstrapCloseable { + private MainConfigurationProperties parent; + + public SpringCloudConfigConfigurationProperties(MainConfigurationProperties parent) { + this.parent = parent; + } + + public MainConfigurationProperties end() { + return parent; + } + + @Override + public void close() { + parent = null; + } + + // getter and setters + // -------------------------------------------------------------- + + // these are inherited from the parent class + + // fluent builders + // -------------------------------------------------------------- + + public SpringCloudConfigConfigurationProperties withUser(String user) { + setUsername(user); + return this; + } + + public SpringCloudConfigConfigurationProperties withPassword(String password) { + setPassword(password); + return this; + } + + public SpringCloudConfigConfigurationProperties withUris(String uris) { + setUris(uris); + return this; + } + + public SpringCloudConfigConfigurationProperties withRefreshEnabled(boolean refreshEanbled) { + setRefreshEnabled(refreshEanbled); + return this; + } + + public SpringCloudConfigConfigurationProperties withRefreshPeriod(int refreshPeriod) { + setRefreshPeriod(refreshPeriod); + return this; + } +} diff --git a/core/camel-main/src/main/java/org/apache/camel/main/VaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/VaultConfigurationProperties.java index 56dd26d74ae..78586acafbd 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/VaultConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/VaultConfigurationProperties.java @@ -29,6 +29,7 @@ public class VaultConfigurationProperties extends VaultConfiguration implements private KubernetesVaultConfigurationProperties kubernetes; private KubernetesConfigmapsVaultConfigurationProperties kubernetesConfigmaps; private IBMSecretsManagerVaultConfigurationProperties ibmSecretsManager; + private SpringCloudConfigConfigurationProperties springConfig; public VaultConfigurationProperties(MainConfigurationProperties parent) { this.parent = parent; @@ -62,6 +63,9 @@ public class VaultConfigurationProperties extends VaultConfiguration implements if (ibmSecretsManager != null) { ibmSecretsManager.close(); } + if (springConfig != null) { + springConfig.close(); + } } // getter and setters @@ -127,4 +131,12 @@ public class VaultConfigurationProperties extends VaultConfiguration implements } return ibmSecretsManager; } + + @Override + public SpringCloudConfigConfigurationProperties springConfig() { + if (springConfig == null) { + springConfig = new SpringCloudConfigConfigurationProperties(parent); + } + return springConfig; + } } diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc index 8e48c1a194e..427c6333b47 100644 --- a/docs/components/modules/ROOT/nav.adoc +++ b/docs/components/modules/ROOT/nav.adoc @@ -311,6 +311,7 @@ ** xref:splunk-hec-component.adoc[Splunk HEC] ** xref:spring-summary.adoc[Spring] *** xref:spring-batch-component.adoc[Spring Batch] +*** xref:spring-cloud-config-component.adoc[Spring Cloud Config] *** xref:spring-event-component.adoc[Spring Event] *** xref:spring-jdbc-component.adoc[Spring JDBC] *** xref:spring-ldap-component.adoc[Spring LDAP] diff --git a/docs/components/modules/ROOT/pages/spring-cloud-config-component.adoc b/docs/components/modules/ROOT/pages/spring-cloud-config-component.adoc new file mode 120000 index 00000000000..4fe975f4711 --- /dev/null +++ b/docs/components/modules/ROOT/pages/spring-cloud-config-component.adoc @@ -0,0 +1 @@ +../../../../../components/camel-spring-parent/camel-spring-cloud-config/src/main/docs/spring-cloud-config-component.adoc \ No newline at end of file diff --git a/docs/components/modules/others/examples/json/spring-cloud-config.json b/docs/components/modules/others/examples/json/spring-cloud-config.json new file mode 120000 index 00000000000..744c660b4fc --- /dev/null +++ b/docs/components/modules/others/examples/json/spring-cloud-config.json @@ -0,0 +1 @@ +../../../../../../components/camel-spring-parent/camel-spring-cloud-config/src/generated/resources/spring-cloud-config.json \ No newline at end of file diff --git a/parent/pom.xml b/parent/pom.xml index 6325b65619c..0cd794eaadb 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -467,6 +467,7 @@ <solr-zookeeper-version>3.9.3</solr-zookeeper-version> <splunk-version>1.9.5_1</splunk-version> <spock-version>2.3-groovy-4.0</spock-version> + <spring-cloud-config-version>4.2.1</spring-cloud-config-version> <spring-batch-version>5.2.2</spring-batch-version> <spring-data-redis-version>3.4.4</spring-data-redis-version> <spring-ldap-version>3.2.11</spring-ldap-version> @@ -2353,6 +2354,11 @@ <artifactId>camel-spring-batch</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-cloud-config</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-jdbc</artifactId> diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java index b237087036a..39c7e697b0a 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java @@ -213,6 +213,8 @@ public class PrepareCamelMainMojo extends AbstractGeneratorMojo { prefix = "camel.vault.hashicorp."; } else if (file.getName().contains("IBMSecretsManagerVault")) { prefix = "camel.vault.ibm."; + } else if (file.getName().contains("SpringCloudConfig")) { + prefix = "camel.vault.springConfig."; } else if (file.getName().contains("Health")) { prefix = "camel.health."; } else if (file.getName().contains("StartupCondition")) { @@ -302,6 +304,16 @@ public class PrepareCamelMainMojo extends AbstractGeneratorMojo { throw new MojoFailureException("Error parsing file " + kubernetesVaultConfig + " due " + e.getMessage(), e); } + File springCloudConfigConfig + = new File(camelApiDir, "src/main/java/org/apache/camel/vault/SpringCloudConfigConfiguration.java"); + try { + List<MainModel.MainOptionModel> model = parseConfigurationSource(springCloudConfigConfig); + model.forEach(m -> m.setName("camel.vault.springConfig." + m.getName())); + data.addAll(model); + } catch (Exception e) { + throw new MojoFailureException("Error parsing file " + springCloudConfigConfig + " due " + e.getMessage(), e); + } + File kubernetesConfigmapsVaultConfig = new File(camelApiDir, "src/main/java/org/apache/camel/vault/KubernetesConfigMapVaultConfiguration.java"); try {