You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/10/02 15:29:28 UTC

[camel] branch master updated (dbcd302 -> 46282ab)

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

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


    from dbcd302  Regen docs
     new b65e62f  chore(main): filter properties by prefix
     new 46282ab  chore(main): make utility methods protected so they can be used by classes extending MainSupport

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../AbstractLocationPropertiesSource.java          |  2 +-
 .../java/org/apache/camel/main/MainSupport.java    | 26 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)


[camel] 02/02: chore(main): make utility methods protected so they can be used by classes extending MainSupport

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 46282abf72112c268727a96d7b5d6b48f0eba6ae
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Oct 2 15:01:42 2019 +0200

    chore(main): make utility methods protected so they can be used by classes extending MainSupport
---
 .../src/main/java/org/apache/camel/main/MainSupport.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index e8289b1..c98ccff 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -1252,13 +1252,6 @@ public abstract class MainSupport extends ServiceSupport {
         }
     }
 
-    private static String optionKey(String key) {
-        // as we ignore case for property names we should use keys in same case and without dashes
-        key = StringHelper.replaceAll(key, "-", "");
-        key = key.toLowerCase(Locale.US);
-        return key;
-    }
-
     public void addRouteBuilder(RouteBuilder routeBuilder) {
         getRouteBuilders().add(routeBuilder);
     }
@@ -1279,7 +1272,14 @@ public abstract class MainSupport extends ServiceSupport {
         setRouteBuilderClasses(existing);
     }
 
-    private static boolean setPropertiesOnTarget(CamelContext context, Object target, Map<String, Object> properties,
+    protected static String optionKey(String key) {
+        // as we ignore case for property names we should use keys in same case and without dashes
+        key = StringHelper.replaceAll(key, "-", "");
+        key = key.toLowerCase(Locale.US);
+        return key;
+    }
+
+    protected static boolean setPropertiesOnTarget(CamelContext context, Object target, Map<String, Object> properties,
                                                  String optionKey, String optionPrefix, boolean failIfNotSet, boolean ignoreCase,
                                                  Map<String, String> autoConfiguredProperties) throws Exception {
         ObjectHelper.notNull(context, "context");


[camel] 01/02: chore(main): filter properties by prefix

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b65e62fea7d21a3f1bb313b6157378d70c99a3fb
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Oct 2 14:58:57 2019 +0200

    chore(main): filter properties by prefix
    
    This is to avoid properties sources that need to perform
    some i/o operation to load every property
---
 .../component/properties/AbstractLocationPropertiesSource.java |  2 +-
 .../src/main/java/org/apache/camel/main/MainSupport.java       | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java b/core/camel-base/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java
index a019ac9..1e08cb5 100644
--- a/core/camel-base/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java
+++ b/core/camel-base/src/main/java/org/apache/camel/component/properties/AbstractLocationPropertiesSource.java
@@ -54,7 +54,7 @@ public abstract class AbstractLocationPropertiesSource extends ServiceSupport im
     public Properties loadProperties(Predicate<String> filter) {
         Properties answer = new Properties();
 
-        for (String name: answer.stringPropertyNames()) {
+        for (String name: properties.stringPropertyNames()) {
             if (filter.test(name)) {
                 answer.put(name, properties.get(name));
             }
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index 9c77827..e8289b1 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -836,7 +836,7 @@ public abstract class MainSupport extends ServiceSupport {
 
     protected void autoConfigurationFailFast(CamelContext camelContext, Map<String, String> autoConfiguredProperties) throws Exception {
         // load properties
-        Properties prop = camelContext.getPropertiesComponent().loadProperties();
+        Properties prop = camelContext.getPropertiesComponent().loadProperties(name -> name.startsWith("camel."));
         LOG.debug("Properties from Camel properties component:");
         for (String key : prop.stringPropertyNames()) {
             LOG.debug("    {}={}", key, prop.getProperty(key));
@@ -921,7 +921,7 @@ public abstract class MainSupport extends ServiceSupport {
         DefaultConfigurationConfigurer.afterPropertiesSet(camelContext);
 
         // now configure context/hystrix/rest with additional properties
-        Properties prop = camelContext.getPropertiesComponent().loadProperties();
+        Properties prop = camelContext.getPropertiesComponent().loadProperties(name -> name.startsWith("camel."));
 
         // load properties from ENV (override existing)
         if (mainConfigurationProperties.isAutoConfigurationEnvironmentVariablesEnabled()) {
@@ -1011,7 +1011,7 @@ public abstract class MainSupport extends ServiceSupport {
 
     protected void autoConfigurationPropertiesComponent(CamelContext camelContext, Map<String, String> autoConfiguredProperties) throws Exception {
         // load properties
-        Properties prop = camelContext.getPropertiesComponent().loadProperties();
+        Properties prop = camelContext.getPropertiesComponent().loadProperties(name -> name.startsWith("camel."));
 
         // load properties from ENV (override existing)
         if (mainConfigurationProperties.isAutoConfigurationEnvironmentVariablesEnabled()) {
@@ -1050,7 +1050,7 @@ public abstract class MainSupport extends ServiceSupport {
 
     protected void autoConfigurationMainConfiguration(CamelContext camelContext, MainConfigurationProperties config, Map<String, String> autoConfiguredProperties) throws Exception {
         // load properties
-        Properties prop = camelContext.getPropertiesComponent().loadProperties();
+        Properties prop = camelContext.getPropertiesComponent().loadProperties(name -> name.startsWith("camel."));
 
         // load properties from ENV (override existing)
         if (mainConfigurationProperties.isAutoConfigurationEnvironmentVariablesEnabled()) {
@@ -1109,7 +1109,7 @@ public abstract class MainSupport extends ServiceSupport {
         }
 
         // load properties from properties component (override existing)
-        Properties propPC = camelContext.getPropertiesComponent().loadProperties();
+        Properties propPC = camelContext.getPropertiesComponent().loadProperties(name -> name.startsWith("camel."));
         prop.putAll(propPC);
 
         // load properties from ENV (override existing)