karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1484065 - in /karaf/cellar/branches/cellar-2.2.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:44:07 GMT
Author: jbonofre
Date: Sat May 18 06:44:07 2013
New Revision: 1484065

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

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

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java?rev=1484065&r1=1484064&r2=1484065&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
Sat May 18 06:44:07 2013
@@ -137,6 +137,13 @@ 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.setLocation(bundleLocation);
 
                         if (status == Bundle.ACTIVE)

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java?rev=1484065&r1=1484064&r2=1484065&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
Sat May 18 06:44:07 2013
@@ -67,7 +67,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.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java?rev=1484065&r1=1484064&r2=1484065&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
Sat May 18 06:44:07 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.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java?rev=1484065&r1=1484064&r2=1484065&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
Sat May 18 06:44:07 2013
@@ -70,6 +70,7 @@ public class ListBundleCommand extends C
                         version = "";
                     }
                     BundleState state = bundles.get(bundle);
+
                     String status;
                     switch (state.getStatus()) {
                         case BundleEvent.INSTALLED:

Modified: karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java?rev=1484065&r1=1484064&r2=1484065&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
Sat May 18 06:44:07 2013
@@ -107,6 +107,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();
 
@@ -116,6 +122,7 @@ public class CellarBundleMBeanImpl exten
             // populate the cluster map
             Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP
+ Configurations.SEPARATOR + groupName);
             BundleState state = new BundleState();
+            state.setName(name);
             state.setLocation(location);
             state.setStatus(BundleEvent.INSTALLED);
             bundles.put(name + "/" + version, state);

Modified: karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java?rev=1484065&r1=1484064&r2=1484065&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
Sat May 18 06:44:07 2013
@@ -146,6 +146,7 @@ public class CellarFeaturesMBeanImpl ext
             // update the bundle distributed map
             try {
                 // update the distributed bundles map
+                // TODO does it make sense ?
                 List<BundleInfo> bundles = featuresService.getFeature(feature.getName(),
version).getBundles();
                 Map<String, BundleState> bundlesMap = clusterManager.getMap(org.apache.karaf.cellar.bundle.Constants.BUNDLE_MAP
+ Configurations.SEPARATOR + groupName);
                 for (BundleInfo bundle : bundles) {



Mime
View raw message