camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1044221 - in /camel/trunk/components: camel-core-xml/src/main/java/org/apache/camel/core/xml/ camel-spring/src/main/java/org/apache/camel/spring/ camel-spring/src/test/resources/org/apache/camel/spring/
Date Fri, 10 Dec 2010 07:04:52 GMT
Author: davsclaus
Date: Fri Dec 10 07:04:52 2010
New Revision: 1044221

URL: http://svn.apache.org/viewvc?rev=1044221&view=rev
Log:
CAMEL-3186: Fixed so camel-spring works again.

Modified:
    camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
    camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringConsumerTemplateOutOfCamelContextTest-context.xml

Modified: camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java?rev=1044221&r1=1044220&r2=1044221&view=diff
==============================================================================
--- camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
(original)
+++ camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFactoryBean.java
Fri Dec 10 07:04:52 2010
@@ -47,9 +47,6 @@ public abstract class AbstractCamelFacto
         if (camelContext == null && camelContextId != null) {
             camelContext = getCamelContextWithId(camelContextId);
         }
-        if (camelContext == null) {
-            throw new IllegalArgumentException("A CamelContext or a CamelContextId must be
injected!");
-        }
         return camelContext;
     }
 

Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?rev=1044221&r1=1044220&r2=1044221&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
(original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
Fri Dec 10 07:04:52 2010
@@ -101,7 +101,7 @@ public class CamelBeanPostProcessor impl
         if (bean instanceof CamelContextAware && canSetCamelContext(bean, beanName))
{
             CamelContextAware contextAware = (CamelContextAware)bean;
             if (camelContext == null) {
-                LOG.warn("No CamelContext defined yet so cannot inject into: " + bean);
+                LOG.warn("No CamelContext defined yet so cannot inject into bean: " + beanName);
             } else {
                 contextAware.setCamelContext(camelContext);
             }
@@ -204,20 +204,18 @@ public class CamelBeanPostProcessor impl
     
     
     protected boolean canSetCamelContext(Object bean, String beanName) {
-        boolean answer = true;
         if (bean instanceof CamelContextAware) {
             CamelContextAware camelContextAware = (CamelContextAware) bean;
             CamelContext context = camelContextAware.getCamelContext();
             if (context != null) {
                 if (LOG.isTraceEnabled()) {
-                    LOG.trace("The camel context of " + beanName + " is set, so we skip inject
the camel context of it.");
+                    LOG.trace("CamelContext already set on bean with id [" + beanName + "].
Will keep existing CamelContext on bean.");
                 }
-                answer = false;
+                return false;
             }
-        } else {
-            answer = false;
         }
-        return answer;
+
+        return true;
     }
 
     /**

Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringConsumerTemplateOutOfCamelContextTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringConsumerTemplateOutOfCamelContextTest-context.xml?rev=1044221&r1=1044220&r2=1044221&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringConsumerTemplateOutOfCamelContextTest-context.xml
(original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringConsumerTemplateOutOfCamelContextTest-context.xml
Fri Dec 10 07:04:52 2010
@@ -22,15 +22,15 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
-   
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+    <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
         <route>
             <from uri="seda:foo"/>
             <to id="result" uri="mock:result"/>
         </route>
     </camelContext>
-    
-    <camel:template id="template" camelContextId="camel" />
-    <camel:consumerTemplate id="consumerTemplate" camelContextId="camel"/>
+
+    <camel:template id="template" camelContextId="myCamel"/>
+    <camel:consumerTemplate id="consumerTemplate" camelContextId="myCamel"/>
 
 </beans>
\ No newline at end of file



Mime
View raw message