camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r755502 - /camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java
Date Wed, 18 Mar 2009 08:04:13 GMT
Author: ningjiang
Date: Wed Mar 18 08:04:13 2009
New Revision: 755502

URL: http://svn.apache.org/viewvc?rev=755502&view=rev
Log:
CAMLE-1427 added the state check of the ApplicationContext state

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java?rev=755502&r1=755501&r2=755502&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java
Wed Mar 18 08:04:13 2009
@@ -19,6 +19,9 @@
 import java.lang.reflect.Proxy;
 import javax.xml.namespace.QName;
 
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.component.cxf.spring.CxfEndpointBean;
 import org.apache.camel.component.cxf.util.CxfEndpointUtils;
@@ -60,8 +63,7 @@
     
 
     private void init(CxfEndpointBean bean) throws Exception {
-        this.bean = bean;
-        
+        this.bean = bean;        
         // create configurer
         configurer = new ConfigurerImpl(((SpringCamelContext)getCamelContext())
             .getApplicationContext());
@@ -178,6 +180,13 @@
     }
 
     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 (!context.isActive()) {
+                context.refresh();
+            }
+        }
         configurer.configureBean(beanId, beanInstance);
     }
     



Mime
View raw message