cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1166398 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus: CXFBusImpl.java blueprint/BlueprintBus.java spring/BusDefinitionParser.java spring/SpringBus.java
Date Wed, 07 Sep 2011 20:56:01 GMT
Author: dkulp
Date: Wed Sep  7 20:56:01 2011
New Revision: 1166398

URL: http://svn.apache.org/viewvc?rev=1166398&view=rev
Log:
When running in OSGi, use the bundle name as part of the bus id for
purpose of management.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java?rev=1166398&r1=1166397&r2=1166398&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/CXFBusImpl.java Wed Sep  7 20:56:01
2011
@@ -53,7 +53,7 @@ public class CXFBusImpl extends Abstract
     }
     
     protected final Map<Class, Object> extensions;
-    private String id;
+    protected String id;
     private BusState state;      
     private Collection<AbstractFeature> features;
     private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java?rev=1166398&r1=1166397&r2=1166398&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java Wed Sep
 7 20:56:01 2011
@@ -53,5 +53,12 @@ public class BlueprintBus extends Extens
         setExtension(new BlueprintBeanLocator(getExtension(ConfiguredBeanLocator.class),
container, context),
                            ConfiguredBeanLocator.class);
     }
-    
+    public String getId() {
+        if (id == null) {
+            id = context.getBundle().getSymbolicName() + "-" 
+                + DEFAULT_BUS_ID + Integer.toString(this.hashCode());
+        }
+        return id;
+    }
+
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java?rev=1166398&r1=1166397&r2=1166398&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java Wed
Sep  7 20:56:01 2011
@@ -64,10 +64,6 @@ public class BusDefinitionParser extends
         if (!StringUtils.isEmpty(id)) {
             bean.addPropertyValue("id", id);
         }
-        //element.removeAttribute("bus");
-        //element.removeAttribute("name");
-        //element.removeAttribute("id");
-        
 
         bean.addConstructorArgValue(bus);
         bean.setLazyInit(false);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java?rev=1166398&r1=1166397&r2=1166398&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java Wed Sep  7 20:56:01
2011
@@ -100,5 +100,20 @@ public class SpringBus extends Extension
         ctx.close();
         super.destroyBeans();
     }
+    
+    public String getId() {
+        if (id == null) {
+            try {
+                Class<?> cls = Class.forName("org.osgi.framework.BundleContext");
+                Object o = getExtension(cls);
+                Object o2 = o.getClass().getMethod("getBundle").invoke(o);
+                String s = (String)o2.getClass().getMethod("getSymbolicName").invoke(o2);
+                id = s + "-" + DEFAULT_BUS_ID + Integer.toString(this.hashCode());
+            } catch (Throwable t) {
+                id = super.getId();
+            }
+        }
+        return id;
+    }
 
 }



Mime
View raw message