You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2010/09/20 08:29:10 UTC

svn commit: r998796 - /servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java

Author: ffang
Date: Mon Sep 20 06:29:09 2010
New Revision: 998796

URL: http://svn.apache.org/viewvc?rev=998796&view=rev
Log:
[SMXCOMP-803]enable inject org.apache.servicemix.jbi.runtime.ComponentRegistry to CxfSeProxy bean directly

Modified:
    servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java

Modified: servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java?rev=998796&r1=998795&r2=998796&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java (original)
+++ servicemix/components/engines/servicemix-cxf-se/trunk/src/main/java/org/apache/servicemix/cxfse/CxfSeProxyFactoryBean.java Mon Sep 20 06:29:09 2010
@@ -86,6 +86,8 @@ public class CxfSeProxyFactoryBean imple
     private boolean useSOAPEnvelope = true;
 
     private boolean mtomEnabled;
+    
+    private Object componentRegistry;
 
     public Object getObject() throws Exception {
         if (proxy == null) {
@@ -158,14 +160,24 @@ public class CxfSeProxyFactoryBean imple
 
     protected ComponentContext getInternalContext() throws Exception {
         if (CxfSeComponent.getComponentRegistry() != null) {
-            //in osgi container
+            //in osgi container, use ComponentRegistry from CxfSeComponent
             Object componentRegistry = CxfSeComponent.getComponentRegistry();
             //use reflection to avoid nmr project dependency
             Method mth = componentRegistry.getClass().getMethod("createComponentContext");
             if (mth != null) {
                 context = (ComponentContext) mth.invoke(componentRegistry);
             }
+        } else if (getComponentRegistry() != null) {
+            //in osgi container, use ComponentRegistry from Proxy directly, 
+            //this won't depend on the CxfSeComponent Bundle start first
+            Object componentRegistry = getComponentRegistry();
+            //use reflection to avoid nmr project dependency
+            Method mth = componentRegistry.getClass().getMethod("createComponentContext");
+            if (mth != null) {
+                context = (ComponentContext) mth.invoke(componentRegistry);
+            }
         }
+        
         if (context == null) {
             if (factory == null) {
                 if (container != null) {
@@ -331,13 +343,20 @@ public class CxfSeProxyFactoryBean imple
 		return useSOAPEnvelope;
 	}
 
-        public void setMtomEnabled(boolean mtomEnabled) {
-            this.mtomEnabled = mtomEnabled;
-        }
+    public void setMtomEnabled(boolean mtomEnabled) {
+        this.mtomEnabled = mtomEnabled;
+    }
 
-        public boolean isMtomEnabled() {
-            return mtomEnabled;
-        }
+    public boolean isMtomEnabled() {
+        return mtomEnabled;
+    }
 
+    public void setComponentRegistry(Object componentRegistry) {
+        this.componentRegistry = componentRegistry;
+    }
+
+    public Object getComponentRegistry() {
+        return componentRegistry;
+    }
 
 }