camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r1069440 - /camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java
Date Thu, 10 Feb 2011 16:00:30 GMT
Author: jstrachan
Date: Thu Feb 10 16:00:30 2011
New Revision: 1069440

URL: http://svn.apache.org/viewvc?rev=1069440&view=rev
Log:
allow the same Camel Type Conversion we support for Endpoints to also work for Components
when resolving a component in the registry for CAMEL-3651 and CAMEL-3563

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java?rev=1069440&r1=1069439&r2=1069440&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java
Thu Feb 10 16:00:30 2011
@@ -23,6 +23,7 @@ import org.apache.camel.Component;
 import org.apache.camel.NoFactoryAvailableException;
 import org.apache.camel.spi.ComponentResolver;
 import org.apache.camel.spi.FactoryFinder;
+import org.apache.camel.util.CamelContextHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -55,6 +56,13 @@ public class DefaultComponentResolver im
         if (bean != null) {
             if (bean instanceof Component) {
                 return (Component) bean;
+            } else {
+                // lets use Camel's type conversion mechanism to convert things like CamelContext
+                // and other types into a valid Component
+                Component component = CamelContextHelper.convertTo(context, Component.class,
bean);
+                if (component != null) {
+                    return component;
+                }
             }
             // we do not throw the exception here and try to auto create a component
         }



Mime
View raw message