You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/06/11 11:16:50 UTC

svn commit: r783707 - in /camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: CxfEndpoint.java spring/CxfEndpointBeanDefinitionParser.java

Author: ningjiang
Date: Thu Jun 11 09:16:49 2009
New Revision: 783707

URL: http://svn.apache.org/viewvc?rev=783707&view=rev
Log:
CAMEL-1696 fixed the 'BeanFactory not initialiezed or already closed' issue of refeshing a bundle with a camel-cxf route

Modified:
    camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java

Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=783707&r1=783706&r2=783707&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Thu Jun 11 09:16:49 2009
@@ -38,6 +38,7 @@
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
 import org.springframework.context.ApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.support.AbstractApplicationContext;
 
 
@@ -216,8 +217,8 @@
 
     public void configure(Object beanInstance) {
         // check the ApplicationContext states first , and call the refresh if necessary
-        if (((SpringCamelContext)getCamelContext()).getApplicationContext() instanceof AbstractApplicationContext) {
-            AbstractApplicationContext context = (AbstractApplicationContext)((SpringCamelContext)getCamelContext()).getApplicationContext();
+        if (((SpringCamelContext)getCamelContext()).getApplicationContext() instanceof ConfigurableApplicationContext) {
+            ConfigurableApplicationContext context = (ConfigurableApplicationContext)((SpringCamelContext)getCamelContext()).getApplicationContext();
             if (!context.isActive()) {
                 context.refresh();
             }

Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java?rev=783707&r1=783706&r2=783707&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java Thu Jun 11 09:16:49 2009
@@ -33,6 +33,7 @@
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ConfigurableApplicationContext;
 
 
 
@@ -112,7 +113,12 @@
                 Bus bus = BusFactory.getDefaultBus();                
                 setBus(bus);
             }
-            BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(getBus(), ctx);
+            // check the application status first, just update the bus reference in an active application Context
+            if (ctx instanceof ConfigurableApplicationContext) {
+                if (((ConfigurableApplicationContext)ctx).isActive()) {
+                    BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(getBus(), ctx); 
+                }
+            }            
         }
         
     }