cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1298567 - in /cxf/trunk/services/wsn: wsn-api/src/main/java/org/apache/cxf/wsn/util/ wsn-core/ wsn-core/src/main/java/org/apache/cxf/wsn/ wsn-core/src/main/java/org/apache/cxf/wsn/services/ wsn-core/src/main/resources/OSGI-INF/blueprint/ w...
Date Thu, 08 Mar 2012 20:40:13 GMT
Author: dkulp
Date: Thu Mar  8 20:40:12 2012
New Revision: 1298567

URL: http://svn.apache.org/viewvc?rev=1298567&view=rev
Log:
When WS-N is used with CXF in OSGi, wire in the jmx management and make sure it uses
a bundle specific bus instead of the global Bus.  Restore testing with
the RI which apparently has been broken for a while.

Modified:
    cxf/trunk/services/wsn/wsn-api/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java
    cxf/trunk/services/wsn/wsn-core/pom.xml
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointManager.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsEndpointManager.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
    cxf/trunk/services/wsn/wsn-core/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml
    cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java
    cxf/trunk/services/wsn/wsn-osgi/pom.xml
    cxf/trunk/services/wsn/wsn-osgi/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml

Modified: cxf/trunk/services/wsn/wsn-api/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-api/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-api/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java (original)
+++ cxf/trunk/services/wsn/wsn-api/src/main/java/org/apache/cxf/wsn/util/WSNHelper.java Thu
Mar  8 20:40:12 2012
@@ -32,7 +32,14 @@ import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.wsn.wsdl.WSNWSDLLocator;
 
 public abstract class WSNHelper {
-
+    private static boolean setClassLoader = true;
+    public static boolean setClassLoader() {
+        return setClassLoader;
+    }
+    public static void setClassLoader(boolean cl) {
+        setClassLoader = cl;
+    }
+    
     public static <T> T getPort(EndpointReference ref, Class<T> serviceInterface)
{
         if (!(ref instanceof W3CEndpointReference)) {
             throw new IllegalArgumentException("Unsupported endpoint reference: " 
@@ -46,7 +53,9 @@ public abstract class WSNHelper {
     public static <T> T getPort(String address, Class<T> serviceInterface) {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         try {
-            Thread.currentThread().setContextClassLoader(WSNHelper.class.getClassLoader());
+            if (setClassLoader) {
+                Thread.currentThread().setContextClassLoader(WSNHelper.class.getClassLoader());
+            }
             
             Service service = Service.create(WSNWSDLLocator.getWSDLUrl(),
                                              new QName("http://cxf.apache.org/wsn/jaxws",

@@ -60,7 +69,9 @@ public abstract class WSNHelper {
     public static W3CEndpointReference createWSA(String address) {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         try {
-            Thread.currentThread().setContextClassLoader(WSNHelper.class.getClassLoader());
+            if (setClassLoader) {
+                Thread.currentThread().setContextClassLoader(WSNHelper.class.getClassLoader());
+            }
             
             return new W3CEndpointReferenceBuilder().address(address).build();
         } finally {

Modified: cxf/trunk/services/wsn/wsn-core/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/pom.xml?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/pom.xml (original)
+++ cxf/trunk/services/wsn/wsn-core/pom.xml Thu Mar  8 20:40:12 2012
@@ -38,6 +38,15 @@
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-jms_1.1_spec</artifactId>
             <version>1.1.1</version>
+        </dependency> 
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>org.apache.aries.blueprint.core</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.activemq</groupId>
@@ -50,6 +59,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.cxf.services.wsn</groupId>
             <artifactId>cxf-services-wsn-api</artifactId>
             <version>${project.version}</version>

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
Thu Mar  8 20:40:12 2012
@@ -29,6 +29,7 @@ import javax.jws.WebMethod;
 import javax.jws.WebParam;
 import javax.jws.WebResult;
 import javax.jws.WebService;
+import javax.management.ObjectName;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.wsn.util.IdGenerator;
@@ -53,6 +54,14 @@ public abstract class AbstractCreatePull
         idGenerator = new IdGenerator();
         pullPoints = new ConcurrentHashMap<String, AbstractPullPoint>();
     }
+    @Override
+    public ObjectName getMBeanName() {
+        try {
+            return new ObjectName("org.apache.cxf.service.wsn:type=CreatePullPoint");
+        } catch (Exception e) {
+            return null;
+        }
+    }
 
     public void init() throws Exception {
         register();

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractEndpoint.java
Thu Mar  8 20:40:12 2012
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.wsn;
 
+import javax.management.ObjectName;
+import javax.xml.ws.Endpoint;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 
 public abstract class AbstractEndpoint implements EndpointMBean {
@@ -28,12 +30,16 @@ public abstract class AbstractEndpoint i
 
     protected EndpointManager manager;
 
-    protected Object endpoint;
+    protected Endpoint endpoint;
 
     public AbstractEndpoint(String name) {
         this.name = name;
     }
 
+    public ObjectName getMBeanName() {
+        return null;
+    }
+    
     public String getName() {
         return name;
     }
@@ -52,7 +58,7 @@ public abstract class AbstractEndpoint i
 
     public void unregister() throws EndpointRegistrationException {
         if (endpoint != null) {
-            manager.unregister(endpoint);
+            manager.unregister(endpoint, this);
         }
     }
 

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractNotificationBroker.java
Thu Mar  8 20:40:12 2012
@@ -31,6 +31,7 @@ import javax.jws.WebMethod;
 import javax.jws.WebParam;
 import javax.jws.WebResult;
 import javax.jws.WebService;
+import javax.management.ObjectName;
 import javax.xml.namespace.QName;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 
@@ -100,6 +101,15 @@ public abstract class AbstractNotificati
         subscriptions = new ConcurrentHashMap<String, AbstractSubscription>();
         publishers = new ConcurrentHashMap<String, AbstractPublisher>();
     }
+    
+    @Override
+    public ObjectName getMBeanName() {
+        try {
+            return new ObjectName("org.apache.cxf.service.wsn:type=WSNotificationBroker");
+        } catch (Exception e) {
+            return null;
+        }
+    }
 
     public void init() throws Exception {
         register();

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointManager.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointManager.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/EndpointManager.java
Thu Mar  8 20:40:12 2012
@@ -18,13 +18,14 @@
  */
 package org.apache.cxf.wsn;
 
+import javax.xml.ws.Endpoint;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 
 public interface EndpointManager {
 
-    Object register(String address, Object service) throws EndpointRegistrationException;
+    Endpoint register(String address, Object service) throws EndpointRegistrationException;
 
-    void unregister(Object endpoint) throws EndpointRegistrationException;
+    void unregister(Endpoint endpoint, Object service) throws EndpointRegistrationException;
 
-    W3CEndpointReference getEpr(Object endpoint);
+    W3CEndpointReference getEpr(Endpoint endpoint);
 }

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsCreatePullPoint.java
Thu Mar  8 20:40:12 2012
@@ -24,6 +24,7 @@ import javax.jws.WebService;
 import javax.xml.ws.BindingType;
 
 import org.apache.cxf.wsn.AbstractPullPoint;
+import org.apache.cxf.wsn.EndpointManager;
 import org.apache.cxf.wsn.jms.JmsCreatePullPoint;
 
 @WebService(endpointInterface = "org.oasis_open.docs.wsn.bw_2.CreatePullPoint",
@@ -35,13 +36,21 @@ public class JaxwsCreatePullPoint extend
     implements JaxwsCreatePullPointMBean {
 
     public JaxwsCreatePullPoint(String name) {
-        super(name);
-        manager = new JaxwsEndpointManager();
+        this(name, null, null);
     }
-
     public JaxwsCreatePullPoint(String name, ConnectionFactory connectionFactory) {
+        this(name, connectionFactory, null);
+    }
+
+    public JaxwsCreatePullPoint(String name, 
+                                ConnectionFactory connectionFactory,
+                                EndpointManager epManager) {
         super(name, connectionFactory);
-        manager = new JaxwsEndpointManager();
+        if (epManager == null) {
+            manager = new JaxwsEndpointManager();
+        } else {
+            manager = epManager;
+        }
     }
 
     @Override

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsEndpointManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsEndpointManager.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsEndpointManager.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsEndpointManager.java
Thu Mar  8 20:40:12 2012
@@ -18,31 +18,77 @@
  */
 package org.apache.cxf.wsn.services;
 
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
 import javax.xml.ws.Endpoint;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.spi.Provider;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 
+import org.apache.cxf.wsn.AbstractEndpoint;
 import org.apache.cxf.wsn.EndpointManager;
 import org.apache.cxf.wsn.EndpointRegistrationException;
+import org.apache.cxf.wsn.util.WSNHelper;
 
 public class JaxwsEndpointManager implements EndpointManager {
+    protected MBeanServer mbeanServer;
+    
 
-    public Object register(String address, Object service) throws EndpointRegistrationException
{
+
+    public void setMBeanServer(MBeanServer s) {
+        mbeanServer = s;
+    }
+    
+    
+    public Endpoint register(String address, Object service) throws EndpointRegistrationException
{
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         try {
-            Thread.currentThread().setContextClassLoader(JaxwsEndpointManager.class.getClassLoader());
-            Endpoint endpoint = Endpoint.create(service);
+            if (WSNHelper.setClassLoader()) {
+                Thread.currentThread().setContextClassLoader(JaxwsEndpointManager.class.getClassLoader());
+            }
+            String bindingId = SOAPBinding.SOAP11HTTP_BINDING;
+            if (isCXF()) {
+                bindingId = SOAPBinding.SOAP12HTTP_BINDING;
+            }
+            Endpoint endpoint = Endpoint.create(bindingId, service);
             endpoint.publish(address);
+            
+            try {
+                if (mbeanServer != null 
+                    && service instanceof AbstractEndpoint) {
+                    ObjectName on = ((AbstractEndpoint)service).getMBeanName();
+                    if (on != null) {
+                        mbeanServer.registerMBean(service, on);
+                    }
+                }
+            } catch (Exception ex) {
+                //ignore for now
+            }
             return endpoint;
         } finally {
             Thread.currentThread().setContextClassLoader(cl);
         }
     }
 
-    public void unregister(Object endpoint) throws EndpointRegistrationException {
-        ((Endpoint) endpoint).stop();
+    private boolean isCXF() {
+        return Provider.provider().getClass().getName().contains(".cxf");
+    }
+    public void unregister(Endpoint endpoint, Object service) throws EndpointRegistrationException
{
+        try {
+            if (mbeanServer != null 
+                && service instanceof AbstractEndpoint) {
+                ObjectName on = ((AbstractEndpoint)service).getMBeanName();
+                if (on != null) {
+                    mbeanServer.unregisterMBean(on);
+                }
+            }
+        } catch (Exception ex) {
+            //ignore for now
+        }
+        endpoint.stop();
     }
 
-    public W3CEndpointReference getEpr(Object endpoint) {
-        return ((Endpoint) endpoint).getEndpointReference(W3CEndpointReference.class);
+    public W3CEndpointReference getEpr(Endpoint endpoint) {
+        return endpoint.getEndpointReference(W3CEndpointReference.class);
     }
 }

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/JaxwsNotificationBroker.java
Thu Mar  8 20:40:12 2012
@@ -22,6 +22,7 @@ import javax.jms.ConnectionFactory;
 import javax.jws.WebService;
 import javax.xml.ws.BindingType;
 
+import org.apache.cxf.wsn.EndpointManager;
 import org.apache.cxf.wsn.jms.JmsNotificationBroker;
 import org.apache.cxf.wsn.jms.JmsPublisher;
 import org.apache.cxf.wsn.jms.JmsSubscription;
@@ -35,13 +36,20 @@ public class JaxwsNotificationBroker ext
     implements JaxwsNotificationBrokerMBean {
 
     public JaxwsNotificationBroker(String name) {
-        super(name);
-        manager = new JaxwsEndpointManager();
+        this(name, null);
     }
-
     public JaxwsNotificationBroker(String name, ConnectionFactory connectionFactory) {
+        this(name, connectionFactory, null);
+    }
+    public JaxwsNotificationBroker(String name,
+                                   ConnectionFactory connectionFactory,
+                                   EndpointManager epManager) {
         super(name, connectionFactory);
-        manager = new JaxwsEndpointManager();
+        if (epManager == null) {
+            manager = new JaxwsEndpointManager();
+        } else {
+            manager = epManager;
+        }
     }
 
     @Override

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
(original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/Service.java
Thu Mar  8 20:40:12 2012
@@ -22,7 +22,6 @@ package org.apache.cxf.wsn.services;
 import java.lang.management.ManagementFactory;
 
 import javax.management.MBeanServer;
-import javax.management.ObjectName;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.cxf.wsn.AbstractCreatePullPoint;
@@ -75,14 +74,9 @@ public class Service {
             
             MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
             
-            ObjectName nbServerName = 
-                new ObjectName("org.apache.cxf.service.mbeans:type=WSNotificationBroker");
+            mbs.registerMBean(notificationBrokerServer, notificationBrokerServer.getMBeanName());
             
-            ObjectName cpServerName = new ObjectName("org.apache.cxf.service.mbeans:type=CreatePullPoint");
-            
-            mbs.registerMBean(notificationBrokerServer, nbServerName);
-            
-            mbs.registerMBean(createPullPointServer, cpServerName);
+            mbs.registerMBean(createPullPointServer, createPullPointServer.getMBeanName());
        
         }
     }

Modified: cxf/trunk/services/wsn/wsn-core/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml Thu
Mar  8 20:40:12 2012
@@ -33,11 +33,19 @@
     <bean id="activemq" class="org.apache.activemq.ActiveMQConnectionFactory">
         <argument value="${cxf.wsn.activemq}" />
     </bean>
+    
+    <bean id="JaxwsEndpointManager" 
+    	class="org.apache.cxf.wsn.services.OSGiJaxwsEndpointManager"
+    	destroy-method="destroy">
+        <property name="bundleContext" ref="blueprintBundleContext"/>
+        <property name="blueprintContainer" ref="blueprintContainer"/>
+    </bean>
 
     <!-- NotificationBroker -->
     <bean id="notificationBroker" class="org.apache.cxf.wsn.services.JaxwsNotificationBroker"
init-method="init" destroy-method="destroy">
         <argument value="NotificationBroker" />
         <argument ref="activemq" />
+        <argument ref="JaxwsEndpointManager"/>
         <property name="address" value="${cxf.wsn.rootUrl}${cxf.wsn.context}/NotificationBroker"
/>
     </bean>
     <service ref="notificationBroker" interface="org.oasis_open.docs.wsn.brw_2.NotificationBroker">
@@ -50,6 +58,7 @@
     <bean id="createPullPoint" class="org.apache.cxf.wsn.services.JaxwsCreatePullPoint"
init-method="init" destroy-method="destroy">
         <argument value="org.apache.cxf.wsn.client.CreatePullPoint" />
         <argument ref="activemq" />
+        <argument ref="JaxwsEndpointManager"/>
         <property name="address" value="${cxf.wsn.rootUrl}${cxf.wsn.context}/CreatePullPoint"
/>
     </bean>
     <service ref="createPullPoint" interface="org.oasis_open.docs.wsn.bw_2.CreatePullPoint">

Modified: cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/test/java/org/apache/cxf/wsn/WsnBrokerTest.java Thu
Mar  8 20:40:12 2012
@@ -26,6 +26,8 @@ import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -56,6 +58,7 @@ public abstract class WsnBrokerTest exte
     private JaxwsCreatePullPoint createPullPointServer;
     private NotificationBroker notificationBroker;
     private CreatePullPoint createPullPoint;
+    private ClassLoader loader;
 
     private int port1 = 8182;
     private int port2;
@@ -65,9 +68,11 @@ public abstract class WsnBrokerTest exte
 
     @Override
     public void setUp() throws Exception {
+        loader = Thread.currentThread().getContextClassLoader();
         String impl = getProviderImpl();
         Thread.currentThread()
             .setContextClassLoader(new FakeClassLoader(impl));
+        WSNHelper.setClassLoader(false);
     
         System.setProperty("javax.xml.ws.spi.Provider", impl);
 
@@ -105,6 +110,8 @@ public abstract class WsnBrokerTest exte
             createPullPointServer.destroy();
         }
         System.clearProperty("javax.xml.ws.spi.Provider");
+        Thread.currentThread()
+            .setContextClassLoader(loader);
     }
 
     public void testBroker() throws Exception {
@@ -250,6 +257,13 @@ public abstract class WsnBrokerTest exte
                 return super.getResourceAsStream(name);
             }
         }
+        @Override
+        public Enumeration<URL> getResources(String name) throws IOException {
+            if ("META-INF/services/javax.xml.ws.spi.Provider".equals(name)) {
+                return Collections.emptyEnumeration();
+            }
+            return super.getResources(name);
+        }
     }
 
 }

Modified: cxf/trunk/services/wsn/wsn-osgi/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-osgi/pom.xml?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-osgi/pom.xml (original)
+++ cxf/trunk/services/wsn/wsn-osgi/pom.xml Thu Mar  8 20:40:12 2012
@@ -59,7 +59,7 @@
                             org.apache.activemq.activemq-core
                         </Require-Bundle>
                         <Import-Package>
-                            !org.apache.cxf.*,
+                            org.apache.cxf.*;resolution:=optional,
                             !org.apache.activemq*,
                             !org.apache.log4j.*,
                             !org.slf4j.*,
@@ -70,7 +70,7 @@
                         </Import-Package>
                         <Export-Package>
                             org.oasis_open.docs.wsn.*;version=1.3;-noimport:=true,
-                            org.oasis_open.docs.wsrf.*;version=1.2,
+                            org.oasis_open.docs.wsrf.*;version=1.2;-noimport:=true,
                             org.apache.cxf.wsn.client;version=${project.version}
                         </Export-Package>
                         <Private-Package>

Modified: cxf/trunk/services/wsn/wsn-osgi/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-osgi/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml?rev=1298567&r1=1298566&r2=1298567&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-osgi/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml (original)
+++ cxf/trunk/services/wsn/wsn-osgi/src/main/resources/OSGI-INF/blueprint/cxf-wsn.xml Thu
Mar  8 20:40:12 2012
@@ -33,11 +33,19 @@
     <bean id="activemq" class="org.apache.activemq.ActiveMQConnectionFactory">
         <argument value="${cxf.wsn.activemq}" />
     </bean>
+    
+    <bean id="JaxwsEndpointManager" 
+    	class="org.apache.cxf.wsn.services.OSGiJaxwsEndpointManager"
+    	destroy-method="destroy">
+        <property name="bundleContext" ref="blueprintBundleContext"/>
+        <property name="blueprintContainer" ref="blueprintContainer"/>
+    </bean>
 
     <!-- NotificationBroker -->
     <bean id="notificationBroker" class="org.apache.cxf.wsn.services.JaxwsNotificationBroker"
init-method="init" destroy-method="destroy">
         <argument value="NotificationBroker" />
         <argument ref="activemq" />
+        <argument ref="JaxwsEndpointManager"/>
         <property name="address" value="${cxf.wsn.rootUrl}${cxf.wsn.context}/NotificationBroker"
/>
     </bean>
     <service ref="notificationBroker" interface="org.oasis_open.docs.wsn.brw_2.NotificationBroker">
@@ -50,6 +58,7 @@
     <bean id="createPullPoint" class="org.apache.cxf.wsn.services.JaxwsCreatePullPoint"
init-method="init" destroy-method="destroy">
         <argument value="org.apache.cxf.wsn.client.CreatePullPoint" />
         <argument ref="activemq" />
+        <argument ref="JaxwsEndpointManager"/>
         <property name="address" value="${cxf.wsn.rootUrl}${cxf.wsn.context}/CreatePullPoint"
/>
     </bean>
     <service ref="createPullPoint" interface="org.oasis_open.docs.wsn.bw_2.CreatePullPoint">



Mime
View raw message