You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/04/19 10:37:31 UTC

[camel] branch master updated: CAMEL-16528: camel-main - Remove autowire.properties as the has been removed

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 21ce74c  CAMEL-16528: camel-main - Remove autowire.properties as the has been removed
21ce74c is described below

commit 21ce74c9149171cb995151be057fe5f3c7e87e1e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 19 12:36:32 2021 +0200

    CAMEL-16528: camel-main - Remove autowire.properties as the has been removed
---
 .../main/camel-main-configuration-metadata.json    |  2 +-
 .../camel-main-configuration-metadata.json         |  2 +-
 core/camel-main/src/main/docs/main.adoc            |  2 +-
 .../org/apache/camel/main/BaseMainSupport.java     | 25 +---------------------
 .../camel/main/MainConfigurationProperties.java    |  5 ++---
 5 files changed, 6 insertions(+), 30 deletions(-)

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 b4f38a5..025eed5 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
@@ -11,7 +11,7 @@
   ],
   "properties": [
     { "name": "camel.main.allowUseOriginalMessage", "description": "Sets whether to allow access to the original message from Camel's error handler, or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). Turning this off can optimize performance, as defensive copy of the original message is not needed. Default is false.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
-    { "name": "camel.main.autoConfigurationEnabled", "description": "Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component and optionally from the classpath file META-INF\/services\/org\/apache\/camel\/autowire.properties. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.na [...]
+    { "name": "camel.main.autoConfigurationEnabled", "description": "Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=value2 - camel.language.name.option1=value1 - cam [...]
     { "name": "camel.main.autoConfigurationEnvironmentVariablesEnabled", "description": "Whether auto configuration should include OS environment variables as well. When enabled this allows to overrule any configuration using an OS environment variable. For example to set a shutdown timeout of 5 seconds: CAMEL_MAIN_SHUTDOWNTIMEOUT=5. This option is default enabled.", "sourceType": "org.apache.camel.main.MainConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue [...]
     { "name": "camel.main.autoConfigurationFailFast", "description": "Whether auto configuration should fail fast when configuring one ore more properties fails for whatever reason such as a invalid property name, etc. This option is default enabled.", "sourceType": "org.apache.camel.main.MainConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true },
     { "name": "camel.main.autoConfigurationLogSummary", "description": "Whether auto configuration should log a summary with the configured properties. This option is default enabled.", "sourceType": "org.apache.camel.main.MainConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true },
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 b4f38a5..025eed5 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
@@ -11,7 +11,7 @@
   ],
   "properties": [
     { "name": "camel.main.allowUseOriginalMessage", "description": "Sets whether to allow access to the original message from Camel's error handler, or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). Turning this off can optimize performance, as defensive copy of the original message is not needed. Default is false.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": "false" },
-    { "name": "camel.main.autoConfigurationEnabled", "description": "Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component and optionally from the classpath file META-INF\/services\/org\/apache\/camel\/autowire.properties. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.na [...]
+    { "name": "camel.main.autoConfigurationEnabled", "description": "Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=value2 - camel.language.name.option1=value1 - cam [...]
     { "name": "camel.main.autoConfigurationEnvironmentVariablesEnabled", "description": "Whether auto configuration should include OS environment variables as well. When enabled this allows to overrule any configuration using an OS environment variable. For example to set a shutdown timeout of 5 seconds: CAMEL_MAIN_SHUTDOWNTIMEOUT=5. This option is default enabled.", "sourceType": "org.apache.camel.main.MainConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue [...]
     { "name": "camel.main.autoConfigurationFailFast", "description": "Whether auto configuration should fail fast when configuring one ore more properties fails for whatever reason such as a invalid property name, etc. This option is default enabled.", "sourceType": "org.apache.camel.main.MainConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true },
     { "name": "camel.main.autoConfigurationLogSummary", "description": "Whether auto configuration should log a summary with the configured properties. This option is default enabled.", "sourceType": "org.apache.camel.main.MainConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true },
diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc
index 0878162..3d82806 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -23,7 +23,7 @@ The following table lists all the options:
 |===
 | Name | Description | Default | Type
 | *camel.main.allowUseOriginal{zwsp}Message* | Sets whether to allow access to the original message from Camel's error handler, or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). Turning this off can optimize performance, as defensive copy of the original message is not needed. Default is false. | false | boolean
-| *camel.main.autoConfiguration{zwsp}Enabled* | Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component and optionally from the classpath file META-INF/services/org/apache/camel/autowire.properties. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel. [...]
+| *camel.main.autoConfiguration{zwsp}Enabled* | Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the configuration parameters are loaded from the properties component. You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=value2 - camel.language.name.option1=value1 - camel.language.name.opti [...]
 | *camel.main.autoConfiguration{zwsp}EnvironmentVariablesEnabled* | Whether auto configuration should include OS environment variables as well. When enabled this allows to overrule any configuration using an OS environment variable. For example to set a shutdown timeout of 5 seconds: CAMEL_MAIN_SHUTDOWNTIMEOUT=5. This option is default enabled. | true | boolean
 | *camel.main.autoConfiguration{zwsp}FailFast* | Whether auto configuration should fail fast when configuring one ore more properties fails for whatever reason such as a invalid property name, etc. This option is default enabled. | true | boolean
 | *camel.main.autoConfiguration{zwsp}LogSummary* | Whether auto configuration should log a summary with the configured properties. This option is default enabled. | true | boolean
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 fce220b..5e29e6b 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
@@ -59,7 +59,6 @@ import org.apache.camel.support.ResourceHelper;
 import org.apache.camel.support.service.BaseService;
 import org.apache.camel.support.startup.LoggingStartupStepRecorder;
 import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.OrderedProperties;
 import org.apache.camel.util.PropertiesHelper;
@@ -1167,29 +1166,7 @@ public abstract class BaseMainSupport extends BaseService {
 
     protected void autoConfigurationFromProperties(CamelContext camelContext, Map<String, String> autoConfiguredProperties)
             throws Exception {
-        // load optional META-INF/services/org/apache/camel/autowire.properties
         Properties prop = new OrderedProperties();
-        try {
-            InputStream is = camelContext.getClassResolver()
-                    .loadResourceAsStream("/META-INF/services/org/apache/camel/autowire.properties");
-            if (is != null) {
-                prop.load(is);
-                if (!prop.isEmpty()) {
-                    LOG.info(
-                            "Autowired enabled from classpath: META-INF/services/org/apache/camel/autowire.properties with {} properties",
-                            prop.size());
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Properties from classpath: META-INF/services/org/apache/camel/autowire.properties:");
-                        for (String key : prop.stringPropertyNames()) {
-                            LOG.debug("    {}={}", key, prop.getProperty(key));
-                        }
-                    }
-                }
-                IOHelper.close(is);
-            }
-        } catch (Throwable e) {
-            // ignore as this file is optional
-        }
 
         // load properties from properties component (override existing)
         Properties propPC = camelContext.getPropertiesComponent().loadProperties(name -> name.startsWith("camel."));
@@ -1221,7 +1198,7 @@ public abstract class BaseMainSupport extends BaseService {
         }
         // load properties from JVM (override existing)
         if (mainConfigurationProperties.isAutoConfigurationSystemPropertiesEnabled()) {
-            Properties propJVM = helper.loadJvmSystemPropertiesAsProperties(
+            Properties propJVM = MainHelper.loadJvmSystemPropertiesAsProperties(
                     new String[] { "camel.component.", "camel.dataformat.", "camel.language." });
             if (!propJVM.isEmpty()) {
                 prop.putAll(propJVM);
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/MainConfigurationProperties.java
index f9c5f0a..a36a67f4 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainConfigurationProperties.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainConfigurationProperties.java
@@ -223,9 +223,8 @@ public class MainConfigurationProperties extends DefaultConfigurationProperties<
 
     /**
      * Whether auto configuration of components, dataformats, languages is enabled or not. When enabled the
-     * configuration parameters are loaded from the properties component and optionally from the classpath file
-     * META-INF/services/org/apache/camel/autowire.properties. You can prefix the parameters in the properties file
-     * with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 -
+     * configuration parameters are loaded from the properties component. You can prefix the parameters in the
+     * properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 -
      * camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=value2 - camel.language.name.option1=value1
      * - camel.language.name.option2=value2 Where name is the name of the component, dataformat or language such as
      * seda,direct,jaxb.