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/01/07 06:48:53 UTC

svn commit: r896758 - in /servicemix/components/bindings/servicemix-cxf-bc/trunk/src: main/java/org/apache/servicemix/cxfbc/ test/resources/org/apache/servicemix/cxfbc/ws/security/ test/resources/org/apache/servicemix/cxfbc/ws/security/provider/

Author: ffang
Date: Thu Jan  7 05:48:51 2010
New Revision: 896758

URL: http://svn.apache.org/viewvc?rev=896758&view=rev
Log:
[SMXCOMP-688]servicemix-cxf-bc endpoint cannot load busCfg file when packaged as an OSGi bundle

Modified:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider.xml
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=896758&r1=896757&r2=896758&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Thu Jan  7 05:48:51 2010
@@ -152,6 +152,8 @@
 
     private Bus bus;
 
+    private Bus providedBus;
+    
     private boolean mtomEnabled;
 
     private String locationURI;
@@ -382,8 +384,13 @@
         server.stop();
         if (!isComponentBus()) {
             //if use the endpoint own bus, then shutdown it
-            bus.shutdown(true);
-            bus = null;
+            if (providedBus != null) {
+                providedBus.shutdown(true);
+                providedBus = null;
+            } else {
+                bus.shutdown(true);
+                bus = null;
+            }
         }
         super.deactivate();
     }
@@ -606,7 +613,9 @@
     }
 
     protected Bus getBus() {
-        if (getBusCfg() != null) {
+        if (providedBus != null) {
+            return providedBus;
+        } else if (getBusCfg() != null) {
             if (bus == null) {
                 SpringBusFactory bf = new SpringBusFactory();
                 bus = bf.createBus(getBusCfg());
@@ -1132,5 +1141,18 @@
         this.schemaValidationEnabled = schemaValidationEnabled;
     }
 
+    /**
+     * Specifies a preconfigured CXF bus to use.
+     *
+     * @param providedBus   
+     * @org.apache.xbean.Property description="a preconfigured CXF Bus object to use; overrides busCfg"
+     * */
+     public void setProvidedBus(Bus providedBus) {
+         this.providedBus = providedBus;
+     }
+     
+     public Bus getProvidedBus() {
+         return this.providedBus;
+     }
 
 }

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java?rev=896758&r1=896757&r2=896758&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java Thu Jan  7 05:48:51 2010
@@ -136,6 +136,8 @@
     private String busCfg;
 
     private Bus bus;
+    
+    private Bus providedBus;
 
     private ConduitInitiator conduitInit;
     private Conduit conduit;
@@ -595,7 +597,9 @@
     }
 
     protected Bus getBus() {
-        if (getBusCfg() != null) {
+        if (providedBus != null) {
+            return providedBus;
+        } else if (getBusCfg() != null) {
             if (bus == null) {
                 SpringBusFactory bf = new SpringBusFactory();
                 bus = bf.createBus(getBusCfg());
@@ -741,10 +745,25 @@
      * @param schemaValidationEnabled
      *            a boolean
      * @org.apache.xbean.Property description="Specifies if the endpoint use schemavalidation for the incoming/outgoing message.
-     *  Default is <code>false</code>. 
+     *  Default is <code>false</code>. "
      */
 
     public void setSchemaValidationEnabled(boolean schemaValidationEnabled) {
         this.schemaValidationEnabled = schemaValidationEnabled;
-    } 
+    }
+    
+    /**
+     * Specifies a preconfigured CXF bus to use.
+     *
+     * @param providedBus   
+     * @org.apache.xbean.Property description="a preconfigured CXF Bus object to use; overrides busCfg"
+     * */
+     public void setProvidedBus(Bus providedBus) {
+         this.providedBus = providedBus;
+     }
+     
+     public Bus getProvidedBus() {
+         return this.providedBus;
+     }
+     
 }

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider.xml?rev=896758&r1=896757&r2=896758&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider.xml Thu Jan  7 05:48:51 2010
@@ -22,7 +22,13 @@
        xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
        xmlns:test="urn:test"
        xmlns:greeter="http://apache.org/hello_world_soap_http">
-  
+ 
+  <import resource="classpath:org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml"/> 
+  <import resource="classpath:META-INF/cxf/cxf.xml" />
+   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+   <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+   <import resource="classpath:META-INF/cxf/cxf-extension-jbi.xml" />
+    <import resource="classpath:META-INF/cxf/cxf-extension-jbi-binding.xml" />
   <sm:container id="jbi" embedded="true">
     
     <sm:endpoints>
@@ -32,8 +38,11 @@
                       endpoint="TimestampSignEncrypt"
                       service="greeter:SOAPServiceWSSecurity"
                       interfaceName="greeter:Greeter"
-                      busCfg="org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml"
+                      
                       >
+        <cxfbc:providedBus>
+          <ref bean="cxf"/>
+      </cxfbc:providedBus>
         <cxfbc:inInterceptors>
           <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
         </cxfbc:inInterceptors>

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml?rev=896758&r1=896757&r2=896758&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml Thu Jan  7 05:48:51 2010
@@ -36,7 +36,6 @@
             http://cxf.apache.org/schemas/configuration/http-jetty.xsd
             http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
-
   <http:destination name="{http://apache.org/hello_world_soap_http}TimestampSignEncrypt.http-destination"> 
   </http:destination>
 
@@ -67,6 +66,4 @@
    </httpj:engine>
   </httpj:engine-factory>
   
-  <!-- We need a bean named "cxf" -->
-  <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
 </beans>

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml?rev=896758&r1=896757&r2=896758&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/provider/WibbleClient.xml Thu Jan  7 05:48:51 2010
@@ -59,7 +59,5 @@
     </http:tlsClientParameters>
    </http:conduit>
   
-    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
-    </bean> 
 
 </beans>

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml?rev=896758&r1=896757&r2=896758&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/ws/security/xbean-https.xml Thu Jan  7 05:48:51 2010
@@ -21,7 +21,12 @@
        xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
        xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
        xmlns:greeter="http://apache.org/hello_world_soap_http">
-  
+ 
+  <import resource="classpath:org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml"/>
+  <import resource="classpath:META-INF/cxf/cxf.xml" /> 
+  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+  <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+  <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
   <sm:container id="jbi" embedded="true">
     
     <sm:endpoints>
@@ -47,8 +52,10 @@
                       targetService="greeter:SOAPServiceWSSecurity"
 		      targetInterface="greeter:Greeter"
                       locationURI="https://localhost:9001/SoapContext/SoapPort"
-                      busCfg="org/apache/servicemix/cxfbc/ws/security/provider/CherryServer.xml"
                       >
+        <cxfbc:providedBus>
+           <ref bean="cxf"/>
+        </cxfbc:providedBus>
         <cxfbc:inInterceptors>
           <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
         </cxfbc:inInterceptors>