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

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


The following commit(s) were added to refs/heads/CAMEL-13870 by this push:
     new 9e958a8  CAMEL-13870: Fast property configuration of Camel endpoints. 
Work in progress.
9e958a8 is described below

commit 9e958a80d430bc7015d768fcc03180d6b21bf66f
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Aug 22 15:06:19 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in 
progress.
---
 .../camel/impl/engine/CamelPostProcessorHelper.java  |  4 ++--
 .../camel/impl/engine/DefaultBeanIntrospection.java  | 20 ++++++++++++--------
 .../cloud/ServiceCallExpressionConfiguration.java    |  2 +-
 .../ServiceCallServiceChooserConfiguration.java      |  2 +-
 .../ServiceCallServiceDiscoveryConfiguration.java    |  2 +-
 .../cloud/ServiceCallServiceFilterConfiguration.java |  2 +-
 .../ServiceCallServiceLoadBalancerConfiguration.java |  2 +-
 .../camel/model/language/ExpressionDefinition.java   |  2 +-
 .../camel/reifier/dataformat/DataFormatReifier.java  |  4 ++--
 .../camel/reifier/rest/RestBindingReifier.java       | 14 +++++++-------
 .../camel/main/DefaultConfigurationConfigurer.java   |  4 ++--
 .../management/ManagedBeanIntrospectionTest.java     |  2 +-
 .../org/apache/camel/support/DefaultComponent.java   |  2 +-
 .../org/apache/camel/support/EndpointHelper.java     |  2 +-
 .../apache/camel/support/PropertyBindingSupport.java | 18 +++++++++---------
 .../apache/camel/support/ScheduledPollConsumer.java  |  2 +-
 .../camel/support/builder/ExpressionBuilder.java     |  2 +-
 .../support/component/AbstractApiComponent.java      |  2 +-
 .../support/component/ApiMethodPropertiesHelper.java |  2 +-
 .../camel/support/management/MBeanInfoAssembler.java |  2 +-
 20 files changed, 48 insertions(+), 44 deletions(-)

diff --git 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java
 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java
index 56cfdf2..b28cf0f 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/CamelPostProcessorHelper.java
@@ -178,10 +178,10 @@ public class CamelPostProcessorHelper implements 
CamelContextAware {
         // 2. then the getter with Endpoint as postfix
         // 3. then if start with on then try step 1 and 2 again, but omit the 
on prefix
         try {
-            Object value = 
getCamelContext().getExtension(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(bean,
 propertyName, null);
+            Object value = 
getCamelContext().adapt(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(bean,
 propertyName, null);
             if (value == null) {
                 // try endpoint as postfix
-                value = 
getCamelContext().getExtension(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(bean,
 propertyName + "Endpoint", null);
+                value = 
getCamelContext().adapt(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(bean,
 propertyName + "Endpoint", null);
             }
             if (value == null && propertyName.startsWith("on")) {
                 // retry but without the on as prefix
diff --git 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
index 1560890..8035f72 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
@@ -145,10 +145,11 @@ public class DefaultBeanIntrospection extends 
ServiceSupport implements BeanIntr
     public boolean setProperty(CamelContext context, TypeConverter 
typeConverter, Object target, String name, Object value, String refName, 
boolean allowBuilderPattern) throws Exception {
         invoked.incrementAndGet();
         if (logger.shouldLog()) {
+            Object text = value;
             if (SECRETS.matcher(name).find()) {
-                value = "xxxxxx";
+                text = "xxxxxx";
             }
-            log("setProperty", target, name, value);
+            log("setProperty", target, name, text);
         }
         return IntrospectionSupport.setProperty(context, typeConverter, 
target, name, value, refName, allowBuilderPattern);
     }
@@ -157,10 +158,11 @@ public class DefaultBeanIntrospection extends 
ServiceSupport implements BeanIntr
     public boolean setProperty(CamelContext context, TypeConverter 
typeConverter, Object target, String name, Object value, String refName, 
boolean allowBuilderPattern, boolean allowPrivateSetter, boolean ignoreCase) 
throws Exception {
         invoked.incrementAndGet();
         if (logger.shouldLog()) {
+            Object text = value;
             if (SECRETS.matcher(name).find()) {
-                value = "xxxxxx";
+                text = "xxxxxx";
             }
-            log("setProperty", target, name, value);
+            log("setProperty", target, name, text);
         }
         return IntrospectionSupport.setProperty(context, typeConverter, 
target, name, value, refName, allowBuilderPattern, allowPrivateSetter, 
ignoreCase);
     }
@@ -169,10 +171,11 @@ public class DefaultBeanIntrospection extends 
ServiceSupport implements BeanIntr
     public boolean setProperty(CamelContext context, Object target, String 
name, Object value) throws Exception {
         invoked.incrementAndGet();
         if (logger.shouldLog()) {
+            Object text = value;
             if (SECRETS.matcher(name).find()) {
-                value = "xxxxxx";
+                text = "xxxxxx";
             }
-            log("setProperty", target, name, value);
+            log("setProperty", target, name, text);
         }
         return IntrospectionSupport.setProperty(context, target, name, value);
     }
@@ -181,10 +184,11 @@ public class DefaultBeanIntrospection extends 
ServiceSupport implements BeanIntr
     public boolean setProperty(TypeConverter typeConverter, Object target, 
String name, Object value) throws Exception {
         invoked.incrementAndGet();
         if (logger.shouldLog()) {
+            Object text = value;
             if (SECRETS.matcher(name).find()) {
-                value = "xxxxxx";
+                text = "xxxxxx";
             }
-            log("setProperty", target, name, value);
+            log("setProperty", target, name, text);
         }
         return IntrospectionSupport.setProperty(typeConverter, target, name, 
value);
     }
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
index 3335e76..960b011 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
@@ -243,7 +243,7 @@ public class ServiceCallExpressionConfiguration extends 
IdentifiedType implement
 
                 try {
                     Map<String, Object> parameters = new HashMap<>();
-                    
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
+                    
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
 
                     parameters.replaceAll(
                         (k, v) -> {
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
index 033dcf0..8f2d92b 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
@@ -161,7 +161,7 @@ public class ServiceCallServiceChooserConfiguration extends 
IdentifiedType imple
 
             try {
                 Map<String, Object> parameters = new HashMap<>();
-                
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
+                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
 
                 parameters.replaceAll(
                     (k, v) -> {
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
index b2b334a..881c539 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
@@ -168,7 +168,7 @@ public class ServiceCallServiceDiscoveryConfiguration 
extends IdentifiedType imp
 
             try {
                 Map<String, Object> parameters = new HashMap<>();
-                
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
+                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
 
                 parameters.replaceAll(
                     (k, v) -> {
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
index 6b704f7..4fa36f9 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
@@ -161,7 +161,7 @@ public class ServiceCallServiceFilterConfiguration extends 
IdentifiedType implem
 
             try {
                 Map<String, Object> parameters = new HashMap<>();
-                
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
+                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
 
                 parameters.replaceAll(
                     (k, v) -> {
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
index 417c83e..590177c 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
@@ -161,7 +161,7 @@ public class ServiceCallServiceLoadBalancerConfiguration 
extends IdentifiedType
 
             try {
                 Map<String, Object> parameters = new HashMap<>();
-                
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
+                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 parameters, null, false);
 
                 parameters.replaceAll(
                     (k, v) -> {
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
 
b/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
index b5ec0b6..b5d4628 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
@@ -329,7 +329,7 @@ public class ExpressionDefinition implements Expression, 
Predicate, OtherAttribu
      */
     protected void setProperty(CamelContext camelContext, Object bean, String 
name, Object value) {
         try {
-            
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 bean, name, value);
+            
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 bean, name, value);
         } catch (Exception e) {
             throw new IllegalArgumentException("Failed to set property " + 
name + " on " + bean
                                                + ". Reason: " + e, e);
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
 
b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
index ffb7d6f..0afe04c 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
@@ -232,9 +232,9 @@ public abstract class DataFormatReifier<T extends 
DataFormatDefinition> {
         try {
             String ref = value instanceof String ? value.toString() : null;
             if (isReferenceParameter(ref) && camelContext != null) {
-                
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 camelContext.getTypeConverter(), bean, name, null, ref, true);
+                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 camelContext.getTypeConverter(), bean, name, null, ref, true);
             } else {
-                
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 bean, name, value);
+                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 bean, name, value);
             }
         } catch (Exception e) {
             throw new IllegalArgumentException("Failed to set property: " + 
name + " on: " + bean + ". Reason: " + e, e);
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
 
b/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
index 4b245b9..6095257 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
@@ -96,8 +96,8 @@ public class RestBindingReifier {
                     clazz = 
context.getClassResolver().resolveMandatoryClass(typeName);
                 }
                 if (clazz != null) {
-                    
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 json, "unmarshalType", clazz);
-                    
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 json, "useList", type.endsWith("[]"));
+                    
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 json, "unmarshalType", clazz);
+                    
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 json, "useList", type.endsWith("[]"));
                 }
                 setAdditionalConfiguration(config, context, json, "json.in.");
 
@@ -108,8 +108,8 @@ public class RestBindingReifier {
                     outClazz = 
context.getClassResolver().resolveMandatoryClass(typeName);
                 }
                 if (outClazz != null) {
-                    
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJson, "unmarshalType", outClazz);
-                    
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJson, "useList", outType.endsWith("[]"));
+                    
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJson, "unmarshalType", outClazz);
+                    
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJson, "useList", outType.endsWith("[]"));
                 }
                 setAdditionalConfiguration(config, context, outJson, 
"json.out.");
             }
@@ -147,7 +147,7 @@ public class RestBindingReifier {
                 }
                 if (clazz != null) {
                     JAXBContext jc = JAXBContext.newInstance(clazz);
-                    
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 jaxb, "context", jc);
+                    
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 jaxb, "context", jc);
                 }
                 setAdditionalConfiguration(config, context, jaxb, "xml.in.");
 
@@ -159,11 +159,11 @@ public class RestBindingReifier {
                 }
                 if (outClazz != null) {
                     JAXBContext jc = JAXBContext.newInstance(outClazz);
-                    
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJaxb, "context", jc);
+                    
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJaxb, "context", jc);
                 } else if (clazz != null) {
                     // fallback and use the context from the input
                     JAXBContext jc = JAXBContext.newInstance(clazz);
-                    
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJaxb, "context", jc);
+                    
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(),
 outJaxb, "context", jc);
                 }
                 setAdditionalConfiguration(config, context, outJaxb, 
"xml.out.");
             }
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 88de495..caafea8 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
@@ -85,9 +85,9 @@ public final class DefaultConfigurationConfigurer {
      * @param config       the configuration
      */
     public static void configure(CamelContext camelContext, 
DefaultConfigurationProperties config) throws Exception {
-        
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setExtendedStatistics(config.isBeanIntrospectionExtendedStatistics());
+        
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setExtendedStatistics(config.isBeanIntrospectionExtendedStatistics());
         if (config.getBeanIntrospectionLoggingLevel() != null) {
-            
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setLoggingLevel(config.getBeanIntrospectionLoggingLevel());
+            
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setLoggingLevel(config.getBeanIntrospectionLoggingLevel());
         }
 
         if (!config.isJmxEnabled()) {
diff --git 
a/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedBeanIntrospectionTest.java
 
b/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedBeanIntrospectionTest.java
index 93596d6..0ec992b 100644
--- 
a/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedBeanIntrospectionTest.java
+++ 
b/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedBeanIntrospectionTest.java
@@ -65,7 +65,7 @@ public class ManagedBeanIntrospectionTest extends 
ManagementTestSupport {
         Long counter = (Long) mbeanServer.getAttribute(on, "InvokedCounter");
         assertEquals("Should not have been invoked", 0, counter.intValue());
 
-        Object dummy = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(this,
 "dummy", null);
+        Object dummy = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(this,
 "dummy", null);
         assertEquals("MyDummy", dummy);
 
         counter = (Long) mbeanServer.getAttribute(on, "InvokedCounter");
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
index fbcd4ea..3ae0cc1 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
@@ -343,7 +343,7 @@ public abstract class DefaultComponent extends 
ServiceSupport implements Compone
                 name = StringHelper.before(name, ",");
             }
             try {
-                Optional<Class<?>> clazz = 
getCamelContext().getExtension(ExtendedCamelContext.class).getFactoryFinder(RESOURCE_PATH)
+                Optional<Class<?>> clazz = 
getCamelContext().adapt(ExtendedCamelContext.class).getFactoryFinder(RESOURCE_PATH)
                         .findOptionalClass(name + "-endpoint", null);
                 clazz.ifPresent(aClass -> endpointPropertyConfigurerClass = 
aClass);
             } catch (NoFactoryAvailableException e) {
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java 
b/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
index 7e5d00f..393fd82 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
@@ -182,7 +182,7 @@ public final class EndpointHelper {
             Object v = entry.getValue();
             String value = v != null ? v.toString() : null;
             if (isReferenceParameter(value)) {
-                boolean hit = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), bean, name, null, value, true);
+                boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), bean, name, null, value, true);
                 if (hit) {
                     // must remove as its a valid option and we could 
configure it
                     it.remove();
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
index 1d3e7a9..5966751 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
@@ -338,7 +338,7 @@ public final class PropertyBindingSupport {
                                                                      boolean 
bindNullOnly, boolean deepNesting, OnAutowiring callback) throws Exception {
 
         Map<String, Object> properties = new LinkedHashMap<>();
-        
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(target,
 properties, null);
+        
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(target,
 properties, null);
 
         boolean hit = false;
 
@@ -361,7 +361,7 @@ public final class PropertyBindingSupport {
                     if (lookup.size() == 1) {
                         value = lookup.iterator().next();
                         if (value != null) {
-                            hit |= 
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 target, key, value);
+                            hit |= 
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 target, key, value);
                             if (hit && callback != null) {
                                 callback.onAutowire(target, key, type, value);
                             }
@@ -637,7 +637,7 @@ public final class PropertyBindingSupport {
             }
         }
 
-        boolean hit = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), target, name, value, refName, fluentBuilder, 
allowPrivateSetter, ignoreCase);
+        boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), target, name, value, refName, fluentBuilder, 
allowPrivateSetter, ignoreCase);
         if (!hit && mandatory) {
             // there is no setter with this given name, so lets report this as 
a problem
             throw new IllegalArgumentException("Cannot find setter method: " + 
name + " on bean: " + target + " of type: " + target.getClass().getName() + " 
when binding property: " + ognlPath);
@@ -656,7 +656,7 @@ public final class PropertyBindingSupport {
             key = property.substring(0, pos);
         }
 
-        Object answer = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(target,
 key, defaultValue, ignoreCase);
+        Object answer = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().getOrElseProperty(target,
 key, defaultValue, ignoreCase);
         if (answer instanceof Map && lookupKey != null) {
             Map map = (Map) answer;
             answer = map.getOrDefault(lookupKey, defaultValue);
@@ -680,14 +680,14 @@ public final class PropertyBindingSupport {
     private static Method findBestSetterMethod(CamelContext context, Class 
clazz, String name,
                                                boolean fluentBuilder, boolean 
allowPrivateSetter, boolean ignoreCase) {
         // is there a direct setter?
-        Set<Method> candidates = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().findSetterMethods(clazz,
 name, false, allowPrivateSetter, ignoreCase);
+        Set<Method> candidates = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().findSetterMethods(clazz,
 name, false, allowPrivateSetter, ignoreCase);
         if (candidates.size() == 1) {
             return candidates.iterator().next();
         }
 
         // okay now try with builder pattern
         if (fluentBuilder) {
-            candidates = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().findSetterMethods(clazz,
 name, fluentBuilder, allowPrivateSetter, ignoreCase);
+            candidates = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().findSetterMethods(clazz,
 name, fluentBuilder, allowPrivateSetter, ignoreCase);
             if (candidates.size() == 1) {
                 return candidates.iterator().next();
             }
@@ -699,12 +699,12 @@ public final class PropertyBindingSupport {
     private static Class getGetterType(CamelContext context, Object target, 
String name, boolean ignoreCase) {
         try {
             if (ignoreCase) {
-                Method getter = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getPropertyGetter(target.getClass(),
 name, true);
+                Method getter = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().getPropertyGetter(target.getClass(),
 name, true);
                 if (getter != null) {
                     return getter.getReturnType();
                 }
             } else {
-                Method getter = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getPropertyGetter(target.getClass(),
 name);
+                Method getter = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().getPropertyGetter(target.getClass(),
 name);
                 if (getter != null) {
                     return getter.getReturnType();
                 }
@@ -735,7 +735,7 @@ public final class PropertyBindingSupport {
             String value = v != null ? v.toString() : null;
             if (isReferenceParameter(value)) {
                 try {
-                    boolean hit = 
context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), target, name, null, value, true);
+                    boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), target, name, null, value, true);
                     if (hit) {
                         // must remove as its a valid option and we could 
configure it
                         it.remove();
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
index 098ff92..4b1b630 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
@@ -420,7 +420,7 @@ public abstract class ScheduledPollConsumer extends 
DefaultConsumer implements R
 
         // configure scheduler with options from this consumer
         Map<String, Object> properties = new LinkedHashMap<>();
-        
getEndpoint().getCamelContext().getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 properties, null);
+        
getEndpoint().getCamelContext().adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(this,
 properties, null);
         PropertyBindingSupport.build().bind(getEndpoint().getCamelContext(), 
scheduler, properties);
         if (schedulerProperties != null && !schedulerProperties.isEmpty()) {
             // need to use a copy in case the consumer is restarted so we keep 
the properties
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
index 00cc314..cd9d93e 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
@@ -1417,7 +1417,7 @@ public class ExpressionBuilder {
 
     protected static void setProperty(CamelContext camelContext, Object bean, 
String name, Object value) {
         try {
-            
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 bean, name, value);
+            
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 bean, name, value);
         } catch (Exception e) {
             throw new IllegalArgumentException("Failed to set property " + 
name + " on " + bean + ". Reason: " + e, e);
         }
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java
index 84a9077..eeed3b2 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java
@@ -108,7 +108,7 @@ public abstract class AbstractApiComponent<E extends 
Enum<E> & ApiName, T, S ext
         final Map<String, Object> componentProperties = new HashMap<>();
         // copy component configuration, if set
         if (configuration != null) {
-            
getCamelContext().getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(configuration,
 componentProperties, null, false);
+            
getCamelContext().adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(configuration,
 componentProperties, null, false);
         }
 
         // create endpoint configuration with component properties
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java
index 3016a78..0893303 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java
@@ -91,7 +91,7 @@ public abstract class ApiMethodPropertiesHelper<C> {
 
     public void getEndpointProperties(CamelContext context, Object 
endpointConfiguration, Map<String, Object> properties) {
         Set<String> names = null;
-        if 
(context.getExtension(ExtendedCamelContext.class).getBeanIntrospection().getProperties(endpointConfiguration,
 properties, null, false)) {
+        if 
(context.adapt(ExtendedCamelContext.class).getBeanIntrospection().getProperties(endpointConfiguration,
 properties, null, false)) {
             names = properties.keySet();
             // remove component config properties so we only have endpoint 
properties
             names.removeAll(componentConfigFields);
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java
index 5602122..a45cdcb 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/management/MBeanInfoAssembler.java
@@ -192,7 +192,7 @@ public class MBeanInfoAssembler implements Service {
         LOG.trace("Extracting attributes and operations from class: {}", 
managedClass);
 
         // introspect the class, and leverage the cache to have better 
performance
-        BeanIntrospection.ClassInfo cache = 
camelContext.getExtension(ExtendedCamelContext.class).getBeanIntrospection().cacheClass(managedClass);
+        BeanIntrospection.ClassInfo cache = 
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().cacheClass(managedClass);
 
         for (BeanIntrospection.MethodInfo cacheInfo : cache.methods) {
             // must be from declaring class

Reply via email to