karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1484060 - in /karaf/cellar/branches/cellar-2.3.x: bundle/src/main/java/org/apache/karaf/cellar/bundle/ bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ management/src/main/java/org/apache/karaf/cellar/management/internal/
Date Sat, 18 May 2013 06:00:55 GMT
Author: jbonofre
Date: Sat May 18 06:00:55 2013
New Revision: 1484060

URL: http://svn.apache.org/r1484060
Log:
[KARAF-2272] Populate the bundle name in the cluster

Modified:
    karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
    karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
    karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
    karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
    karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
    karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java

Modified: karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java?rev=1484060&r1=1484059&r2=1484060&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
Sat May 18 06:00:55 2013
@@ -142,6 +142,15 @@ public class BundleSynchronizer extends 
                     if (isAllowed(group, Constants.CATEGORY, bundleLocation, EventType.OUTBOUND))
{
 
                         BundleState bundleState = new BundleState();
+                        // get the bundle name or location.
+                        String name = (String) bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME);
+                        // if there is no name, then default to symbolic name.
+                        name = (name == null) ? bundle.getSymbolicName() : name;
+                        // if there is no symbolic name, resort to location.
+                        name = (name == null) ? bundle.getLocation() : name;
+                        bundleState.setName(name);
+                        bundleState.setName(bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME));
+
                         bundleState.setLocation(bundleLocation);
 
                         if (status == Bundle.ACTIVE)

Modified: karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java?rev=1484060&r1=1484059&r2=1484060&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
Sat May 18 06:00:55 2013
@@ -70,7 +70,12 @@ public class LocalBundleListener extends
             if (groups != null && !groups.isEmpty()) {
                 for (Group group : groups) {
 
+                    // get the bundle name or location.
                     String name = (String) event.getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME);
+                    // if there is no name, then default to symbolic name.
+                    name = (name == null) ? event.getBundle().getSymbolicName() : name;
+                    // if there is no symbolic name, resort to location.
+                    name = (name == null) ? event.getBundle().getLocation() : name;
                     String symbolicName = event.getBundle().getSymbolicName();
                     String version = event.getBundle().getVersion().toString();
                     String bundleLocation = event.getBundle().getLocation();

Modified: karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java?rev=1484060&r1=1484059&r2=1484060&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
Sat May 18 06:00:55 2013
@@ -80,6 +80,9 @@ public class InstallBundleCommand extend
                 if (name == null) {
                     name = symbolicName;
                 }
+                if (name == null) {
+                    name = url;
+                }
                 String version = manifest.getMainAttributes().getValue("Bundle-Version");
                 jarInputStream.close();
 

Modified: karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java?rev=1484060&r1=1484059&r2=1484060&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
Sat May 18 06:00:55 2013
@@ -70,6 +70,7 @@ public class ListBundleCommand extends C
                         version = "";
                     }
                     BundleState state = clusterBundles.get(bundle);
+
                     String status;
                     switch (state.getStatus()) {
                         case BundleEvent.INSTALLED:

Modified: karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java?rev=1484060&r1=1484059&r2=1484060&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
Sat May 18 06:00:55 2013
@@ -106,6 +106,12 @@ public class CellarBundleMBeanImpl exten
         JarInputStream jarInputStream = new JarInputStream(new URL(location).openStream());
         Manifest manifest = jarInputStream.getManifest();
         String name = manifest.getMainAttributes().getValue("Bundle-SymbolicName");
+        if (name == null) {
+            name = manifest.getMainAttributes().getValue("Bundle-SymbolicName");
+        }
+        if (name == null) {
+            name = location;
+        }
         String version = manifest.getMainAttributes().getValue("Bundle-Version");
         jarInputStream.close();
 
@@ -115,6 +121,7 @@ public class CellarBundleMBeanImpl exten
             // update the cluster group
             Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP
+ Configurations.SEPARATOR + groupName);
             BundleState state = new BundleState();
+            state.setName(name);
             state.setLocation(location);
             state.setStatus(BundleEvent.INSTALLED);
             clusterBundles.put(name + "/" + version, state);

Modified: karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java?rev=1484060&r1=1484059&r2=1484060&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
Sat May 18 06:00:55 2013
@@ -146,6 +146,7 @@ public class CellarFeaturesMBeanImpl ext
             clusterFeatures.put(feature, true);
             try {
                 // update the bundles in the cluster group
+                // TODO does it make really sense
                 List<BundleInfo> bundles = featuresService.getFeature(feature.getName(),
version).getBundles();
                 Map<String, BundleState> clusterBundles = clusterManager.getMap(org.apache.karaf.cellar.bundle.Constants.BUNDLE_MAP
+ Configurations.SEPARATOR + groupName);
                 for (BundleInfo bundle : bundles) {



Mime
View raw message