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 2019/06/26 12:46:35 UTC
[camel] 03/07: CAMEL-13681: Property binding support should have
support for ignore case in property keys
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
commit 13a2457ae293e954bb36daac3cce08f3027360d2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jun 26 10:06:22 2019 +0200
CAMEL-13681: Property binding support should have support for ignore case in property keys
---
.../src/main/java/org/apache/camel/main/MainSupport.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 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 c9e3ce1..fb8abff 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
@@ -1015,7 +1015,7 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(dot + 1);
- if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ if (component != null && ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
Map<String, Object> values = properties.getOrDefault(component, new LinkedHashMap<>());
values.put(option, value);
properties.put(component, values);
@@ -1029,7 +1029,7 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(dot + 1);
- if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ if (dataformat != null && ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
Map<String, Object> values = properties.getOrDefault(dataformat, new LinkedHashMap<>());
values.put(option, value);
properties.put(dataformat, values);
@@ -1043,7 +1043,7 @@ public abstract class MainSupport extends ServiceSupport {
// grab the value
String value = prop.getProperty(key);
String option = key.substring(dot + 1);
- if (ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
+ if (language != null && ObjectHelper.isNotEmpty(value) && ObjectHelper.isNotEmpty(option)) {
Map<String, Object> values = properties.getOrDefault(language, new LinkedHashMap<>());
values.put(option, value);
properties.put(language, values);
@@ -1051,6 +1051,8 @@ public abstract class MainSupport extends ServiceSupport {
}
}
+ // TODO: filter out duplicte properties due to ignore-case
+
if (!properties.isEmpty()) {
long total = properties.values().stream().mapToLong(Map::size).sum();
LOG.info("Auto configuring {} components/dataformat/languages from loaded properties: {}", properties.size(), total);
@@ -1060,6 +1062,9 @@ public abstract class MainSupport extends ServiceSupport {
Map<String, Object> values = properties.get(obj);
setPropertiesOnTarget(camelContext, obj, values, true, true);
}
+
+ // TODO: Log if any options was not configured (and check if they are on classpath)
+
}
protected void autoConfigurationFromRegistry(CamelContext camelContext, boolean deepNesting) throws Exception {