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/08/24 17:29:16 UTC

[camel] 01/02: CAMEL-13870: Generating fast component options configurer

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 5d4d3715e4ef77ebd823775f5d95df427cd84378
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Aug 24 19:15:00 2019 +0200

    CAMEL-13870: Generating fast component options configurer
---
 .../src/main/java/org/apache/camel/main/MainSupport.java     | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 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 9d32d7d..00a4393 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
@@ -51,6 +51,7 @@ import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.EventNotifier;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.PropertiesComponent;
+import org.apache.camel.spi.PropertyConfigurer;
 import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.support.LifecycleStrategySupport;
 import org.apache.camel.support.PropertyBindingSupport;
@@ -1246,6 +1247,13 @@ public abstract class MainSupport extends ServiceSupport {
         boolean rc = false;
         Iterator it = properties.entrySet().iterator();
 
+        PropertyConfigurer configurer = null;
+        if (target instanceof Component) {
+            // the component needs to be initialized to have the configurer ready
+            ServiceHelper.initService(target);
+            configurer = ((Component) target).getComponentPropertyConfigurer();
+        }
+
         while (it.hasNext()) {
             Map.Entry<String, Object> entry = (Map.Entry) it.next();
             String name = entry.getKey();
@@ -1262,10 +1270,10 @@ public abstract class MainSupport extends ServiceSupport {
             try {
                 boolean hit;
                 if (failIfNotSet) {
-                    PropertyBindingSupport.build().withMandatory(true).withIgnoreCase(ignoreCase).bind(context, target, name, stringValue);
+                    PropertyBindingSupport.build().withMandatory(true).withConfigurer(configurer).withIgnoreCase(ignoreCase).bind(context, target, name, stringValue);
                     hit = true;
                 } else {
-                    hit = PropertyBindingSupport.build().withIgnoreCase(true).bind(context, target, name, stringValue);
+                    hit = PropertyBindingSupport.build().withConfigurer(configurer).withIgnoreCase(true).bind(context, target, name, stringValue);
                 }
                 if (hit) {
                     it.remove();