cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1531037 - /cxf/branches/2.6.x-fixes/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
Date Thu, 10 Oct 2013 16:04:54 GMT
Author: dkulp
Date: Thu Oct 10 16:04:54 2013
New Revision: 1531037

URL: http://svn.apache.org/r1531037
Log:
Merged revisions 1531027 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

........
  r1531027 | dkulp | 2013-10-10 11:35:09 -0400 (Thu, 10 Oct 2013) | 11 lines

  Merged revisions 1531026 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1531026 | dkulp | 2013-10-10 11:31:28 -0400 (Thu, 10 Oct 2013) | 3 lines

    [CXF-5329] Make sure the wsn bus gets registered as a service
    Patch from Sebastian Ruhl applied

  ........

........

Modified:
    cxf/branches/2.6.x-fixes/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java

Modified: cxf/branches/2.6.x-fixes/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java?rev=1531037&r1=1531036&r2=1531037&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
(original)
+++ cxf/branches/2.6.x-fixes/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/services/OSGiJaxwsEndpointManager.java
Thu Oct 10 16:04:54 2013
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.wsn.services;
 
+import java.util.Dictionary;
+import java.util.Properties;
 import javax.management.MBeanServer;
 import javax.xml.ws.Endpoint;
 
@@ -26,9 +28,16 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.blueprint.BlueprintBus;
 import org.apache.cxf.wsn.EndpointRegistrationException;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
+import static org.apache.cxf.bus.osgi.OSGIBusListener.CONTEXT_NAME_PROPERTY;
+import static org.apache.cxf.bus.osgi.OSGIBusListener.CONTEXT_SYMBOLIC_NAME_PROPERTY;
+import static org.apache.cxf.bus.osgi.OSGIBusListener.CONTEXT_VERSION_PROPERTY;
+
 /**
  * 
  */
@@ -99,7 +108,19 @@ public class OSGiJaxwsEndpointManager ex
         bp.setBlueprintContainer(container);
         bp.setId("WS-Notification");
         bp.initialize();
+        if (null != bundleContext) {
+            Properties props = new Properties();
+            props.put(CONTEXT_SYMBOLIC_NAME_PROPERTY, bundleContext.getBundle().getSymbolicName());
+            props.put(CONTEXT_VERSION_PROPERTY, getBundleVersion(bundleContext.getBundle()));
+            props.put(CONTEXT_NAME_PROPERTY, bp.getId());
+            bundleContext.registerService(Bus.class.getName(), bp, props);
+        }
         cxfBus = bp;
     }
+    private Version getBundleVersion(Bundle bundle) {
+        Dictionary<?, ?> headers = bundle.getHeaders();
+        String version = (String) headers.get(Constants.BUNDLE_VERSION);
+        return (version != null) ? Version.parseVersion(version) : Version.emptyVersion;
+    }
     
 }



Mime
View raw message