You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2013/12/18 13:22:37 UTC

[02/50] [abbrv] git commit: Cellar code cleanup

Cellar code cleanup

git-svn-id: https://svn.apache.org/repos/asf/karaf/cellar/trunk@1470942 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/4643c138
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/4643c138
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/4643c138

Branch: refs/heads/master
Commit: 4643c13875dbf580f6ee5bfc280daf71370a7b52
Parents: 8888367
Author: jbonofre <jb...@13f79535-47bb-0310-9956-ffa450edef68>
Authored: Tue Apr 23 13:19:33 2013 +0000
Committer: jbonofre <jb...@13f79535-47bb-0310-9956-ffa450edef68>
Committed: Tue Apr 23 13:19:33 2013 +0000

----------------------------------------------------------------------
 .../karaf/cellar/bundle/BundleEventHandler.java | 36 ++++----
 .../apache/karaf/cellar/bundle/BundleState.java |  3 +
 .../karaf/cellar/bundle/BundleSupport.java      | 94 +++++++++-----------
 .../karaf/cellar/bundle/BundleSynchronizer.java | 52 ++++++-----
 .../karaf/cellar/bundle/ClusterBundleEvent.java | 65 ++++++++++++++
 .../apache/karaf/cellar/bundle/Constants.java   |  3 +
 .../cellar/bundle/LocalBundleListener.java      | 39 ++++----
 .../karaf/cellar/bundle/RemoteBundleEvent.java  | 65 --------------
 .../bundle/shell/BundleCommandSupport.java      | 20 ++---
 .../bundle/shell/InstallBundleCommand.java      | 14 +--
 .../cellar/bundle/shell/ListBundleCommand.java  | 16 ++--
 .../cellar/bundle/shell/StartBundleCommand.java | 18 ++--
 .../cellar/bundle/shell/StopBundleCommand.java  | 20 ++---
 .../bundle/shell/UninstallBundleCommand.java    | 20 ++---
 .../resources/OSGI-INF/blueprint/blueprint.xml  |  3 +-
 .../internal/CellarBundleMBeanImpl.java         | 12 ++-
 16 files changed, 238 insertions(+), 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
index 2f0c6f6..e7f3443 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleEventHandler.java
@@ -20,7 +20,6 @@ import org.apache.karaf.cellar.core.control.SwitchStatus;
 import org.apache.karaf.cellar.core.event.EventHandler;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
 import org.osgi.service.cm.Configuration;
@@ -28,9 +27,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.List;
-import java.util.Map;
 
-public class BundleEventHandler extends BundleSupport implements EventHandler<RemoteBundleEvent> {
+/**
+ * The BundleEventHandler is responsible to process received cluster event for bundles.
+ */
+public class BundleEventHandler extends BundleSupport implements EventHandler<ClusterBundleEvent> {
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(BundleEventHandler.class);
 
@@ -39,11 +40,12 @@ public class BundleEventHandler extends BundleSupport implements EventHandler<Re
     private final Switch eventSwitch = new BasicSwitch(SWITCH_ID);
     
     /**
-     * Handles remote bundle events.
+     * Handle received bundle cluster events.
      *
-     * @param event
+     * @param event the received bundle cluster event.
      */
-    public void handle(RemoteBundleEvent event) {
+    @Override
+    public void handle(ClusterBundleEvent event) {
 
         // check if the handler switch is ON
         if (this.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
@@ -64,13 +66,13 @@ public class BundleEventHandler extends BundleSupport implements EventHandler<Re
         }
 
         try {
-            //Check if the pid is marked as local.
+            // check if the pid is marked as local.
             if (isAllowed(event.getSourceGroup(), Constants.CATEGORY, event.getLocation(), EventType.INBOUND)) {
-            	//check the features first
+            	// check the features first
             	List<Feature> matchingFeatures = retrieveFeature(event.getLocation());
             	for (Feature feature : matchingFeatures) {
 					if (!isAllowed(event.getSourceGroup(), "features", feature.getName(), EventType.INBOUND)) {
-						LOGGER.warn("CELLAR BUNDLE: bundle {} is contained in a feature marked as BLOCKED INBOUND", event.getLocation());
+						LOGGER.warn("CELLAR BUNDLE: bundle {} is contained in the feature {} marked as BLOCKED INBOUND for cluster group {}", event.getLocation(), feature.getName(), event.getSourceGroup());
 						return;
 					}
 				}
@@ -98,20 +100,15 @@ public class BundleEventHandler extends BundleSupport implements EventHandler<Re
         }
     }
 
-    /**
-     * Initialization Method.
-     */
     public void init() {
-
+        // nothing to do
     }
 
-    /**
-     * Destruction Method.
-     */
     public void destroy() {
-
+        // nothing to do
     }
 
+    @Override
     public Switch getSwitch() {
         // load the switch status from the config
         try {
@@ -130,8 +127,9 @@ public class BundleEventHandler extends BundleSupport implements EventHandler<Re
         return eventSwitch;
     }
 
-    public Class<RemoteBundleEvent> getType() {
-        return RemoteBundleEvent.class;
+    @Override
+    public Class<ClusterBundleEvent> getType() {
+        return ClusterBundleEvent.class;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
index 3d37118..64f287f 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleState.java
@@ -15,6 +15,9 @@ package org.apache.karaf.cellar.bundle;
 
 import java.io.Serializable;
 
+/**
+ * Serializable wrapper to store and transport bundle state.
+ */
 public class BundleState implements Serializable {
 
     private static final long serialVersionUID = 5933673686648413918L;

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
index befcd15..796a4f0 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSupport.java
@@ -28,17 +28,21 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
 
+/**
+ * Generic Cellar bundle support.
+ */
 public class BundleSupport extends CellarSupport {
 
     protected BundleContext bundleContext;
 	private FeaturesService featuresService;
 
     /**
-     * Reads a {@code Dictionary} object and creates a property object out of it.
+     * Read a {@code Dictionary} and create a {@code Properties}.
      *
-     * @param dictionary
-     * @return
+     * @param dictionary the {@code Dictionary} to read.
+     * @return the {@code Properties} corresponding to the {@code Dictionary}.
      */
+    /*
     public Properties dictionaryToProperties(Dictionary dictionary) {
         Properties properties = new Properties();
         if (dictionary != null && dictionary.keys() != null) {
@@ -53,21 +57,24 @@ public class BundleSupport extends CellarSupport {
         }
         return properties;
     }
-
+    */
 
     /**
-     * Installs a bundle using its location.
+     * Locally install a bundle.
+     *
+     * @param location the bundle location.
+     * @throws BundleException in case of installation failure.
      */
     public void installBundleFromLocation(String location) throws BundleException {
         getBundleContext().installBundle(location);
     }
 
     /**
-     * Uninstalls a bundle using its Symbolic name and version.
+     * Locally uninstall a bundle.
      *
-     * @param symbolicName
-     * @param version
-     * @throws BundleException
+     * @param symbolicName the bundle symbolic name.
+     * @param version the bundle version.
+     * @throws BundleException in case of un-installation failure.
      */
     public void uninstallBundle(String symbolicName, String version) throws BundleException {
         Bundle[] bundles = getBundleContext().getBundles();
@@ -81,11 +88,11 @@ public class BundleSupport extends CellarSupport {
     }
 
     /**
-     * Starts a bundle using its Symbolic name and version.
+     * Locally start a bundle.
      *
-     * @param symbolicName
-     * @param version
-     * @throws BundleException
+     * @param symbolicName the bundle symbolic name.
+     * @param version the bundle version.
+     * @throws BundleException in case of start failure.
      */
     public void startBundle(String symbolicName, String version) throws BundleException {
         Bundle[] bundles = getBundleContext().getBundles();
@@ -99,11 +106,11 @@ public class BundleSupport extends CellarSupport {
     }
 
     /**
-     * Stops a bundle using its Symbolic name and version.
+     * Locally stop a bundle.
      *
-     * @param symbolicName
-     * @param version
-     * @throws BundleException
+     * @param symbolicName the bundle symbolic name.
+     * @param version the bundle version.
+     * @throws BundleException in case of stop failure.
      */
     public void stopBundle(String symbolicName, String version) throws BundleException {
         Bundle[] bundles = getBundleContext().getBundles();
@@ -117,11 +124,11 @@ public class BundleSupport extends CellarSupport {
     }
 
     /**
-     * Updates a bundle using its Symbolic name and version.
+     * Locally update a bundle.
      *
-     * @param symbolicName
-     * @param version
-     * @throws BundleException
+     * @param symbolicName the bundle symbolic name.
+     * @param version the bundle version.
+     * @throws BundleException in case of update failure.
      */
     public void updateBundle(String symbolicName, String version) throws BundleException {
         Bundle[] bundles = getBundleContext().getBundles();
@@ -135,31 +142,12 @@ public class BundleSupport extends CellarSupport {
     }
 
     /**
-     * Returns the {@link BundleContext}.
-     *
-     * @return
-     */
-    public BundleContext getBundleContext() {
-        return this.bundleContext;
-    }
-
-    /**
-     * Sets the {@link BundleContext}.
+     * Get the list of features where the bundle is belonging.
      *
-     * @param bundleContext
+     * @param bundleLocation the bundle location.
+     * @return the list of feature where the bundle is present.
+     * @throws Exception in case of retrieval failure.
      */
-    public void setBundleContext(BundleContext bundleContext) {
-        this.bundleContext = bundleContext;
-    }
-
-    public ConfigurationAdmin getConfigurationAdmin() {
-        return configurationAdmin;
-    }
-
-    public void setConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
-        this.configurationAdmin = configurationAdmin;
-    }
-
 	protected List<Feature> retrieveFeature(String bundleLocation) throws Exception {
 		Feature[] features = featuresService.listFeatures();
 		List<Feature> matchingFeatures = new ArrayList<Feature>();
@@ -169,23 +157,25 @@ public class BundleSupport extends CellarSupport {
 				String location = bundleInfo.getLocation();
 				if (location.equalsIgnoreCase(bundleLocation)) {
 					matchingFeatures.add(feature);
-					LOGGER.debug("CELLAR BUNDLE: found a feature {} containing bundle: {}", feature.getName(), bundleLocation);
+					LOGGER.debug("CELLAR BUNDLE: found a feature {} containing bundle {}", feature.getName(), bundleLocation);
 				}
 			}
 		}
 		return matchingFeatures;
 	}
-	
-	/**
-	 * @return the featuresService
-	 */
+
+    public BundleContext getBundleContext() {
+        return this.bundleContext;
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
 	public FeaturesService getFeaturesService() {
 		return featuresService;
 	}
 
-	/**
-	 * @param featuresService the featuresService to set
-	 */
 	public void setFeaturesService(FeaturesService featureService) {
 		this.featuresService = featureService;
 	}

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
index a93602b..9957ee8 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
@@ -30,19 +30,19 @@ import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.Dictionary;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+/**
+ * The BundleSynchronizer is called when Cellar starts or a node join a cluster group.
+ * The purpose is synchronize bundles local state with the states in cluster groups.
+ */
 public class BundleSynchronizer extends BundleSupport implements Synchronizer {
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(BundleSynchronizer.class);
 
     private EventProducer eventProducer;
 
-    /**
-     * Registration method
-     */
     public void init() {
         Set<Group> groups = groupManager.listLocalGroups();
         if (groups != null && !groups.isEmpty()) {
@@ -50,30 +50,32 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
                 if (isSyncEnabled(group)) {
                     pull(group);
                     push(group);
-                } else LOGGER.warn("CELLAR BUNDLE: sync is disabled for group {}", group.getName());
+                } else LOGGER.warn("CELLAR BUNDLE: sync is disabled for cluster group {}", group.getName());
             }
         }
     }
 
-    /**
-     * Destruction method
-     */
     public void destroy() {
-
+        // nothing to do
     }
 
     /**
-     * Get the bundle to install from the distributed map
+     * Pull the bundles states from a cluster group.
+     *
+     * @param group the cluster group where to get the bundles states.
      */
+    @Override
     public void pull(Group group) {
         if (group != null) {
             String groupName = group.getName();
-            Map<String, BundleState> bundleDistributedMap = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
+            LOGGER.debug("CELLAR BUNDLE: pulling bundles from cluster group {}", groupName);
+            Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
 
             ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+
             try {
                 Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-                for (Map.Entry<String, BundleState> entry : bundleDistributedMap.entrySet()) {
+                for (Map.Entry<String, BundleState> entry : clusterBundles.entrySet()) {
                     String id = entry.getKey();
                     BundleState state = entry.getValue();
 
@@ -94,7 +96,7 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
                                 } catch (BundleException e) {
                                     LOGGER.error("CELLAR BUNDLE: failed to pull bundle {}", id, e);
                                 }
-                            } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED INBOUND", bundleLocation);
+                            } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED INBOUND for cluster group {}", bundleLocation, groupName);
                         }
                     }
                 }
@@ -105,8 +107,11 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
     }
 
     /**
-     * Publishes local bundle to the cluster.
+     * Push local bundles states to a cluster group.
+     *
+     * @param group the cluster group where to update the bundles states.
      */
+    @Override
     public void push(Group group) {
 
         // check if the producer is ON
@@ -117,7 +122,8 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
 
         if (group != null) {
             String groupName = group.getName();
-            Map<String, BundleState> distributedBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
+            LOGGER.debug("CELLAR BUNDLE: pushing bundles to cluster group {}", groupName);
+            Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
 
             ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
             try {
@@ -133,7 +139,7 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
                     int status = bundle.getState();
                     String id = symbolicName + "/" + version;
 
-                    //Check if the pid is marked as local.
+                    // check if the pid is marked as local.
                     if (isAllowed(group, Constants.CATEGORY, bundleLocation, EventType.OUTBOUND)) {
 
                         BundleState bundleState = new BundleState();
@@ -154,21 +160,21 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
 
                         bundleState.setStatus(status);
 
-                        BundleState existingState = distributedBundles.get(id);
+                        BundleState existingState = clusterBundles.get(id);
 
                         if (existingState == null ||
                                 !existingState.getLocation().equals(bundleState.getLocation()) ||
                                 existingState.getStatus() != bundleState.getStatus()) {
                             // update the distributed map
-                            distributedBundles.put(id, bundleState);
+                            clusterBundles.put(id, bundleState);
 
                             // broadcast the event
-                            RemoteBundleEvent event = new RemoteBundleEvent(symbolicName, version, bundleLocation, status);
+                            ClusterBundleEvent event = new ClusterBundleEvent(symbolicName, version, bundleLocation, status);
                             event.setSourceGroup(group);
                             eventProducer.produce(event);
                         }
 
-                    } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED OUTBOUND", bundleLocation);
+                    } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED OUTBOUND for cluster group {}", bundleLocation, groupName);
                 }
             } finally {
                 Thread.currentThread().setContextClassLoader(originalClassLoader);
@@ -176,6 +182,12 @@ public class BundleSynchronizer extends BundleSupport implements Synchronizer {
         }
     }
 
+    /**
+     * Check if the bundle sync flag is enabled for a cluster group.
+     *
+     * @param group the cluster group to check.
+     * @return true if the sync flag is enabled, false else.
+     */
     @Override
     public Boolean isSyncEnabled(Group group) {
         Boolean result = Boolean.FALSE;

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/ClusterBundleEvent.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/ClusterBundleEvent.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/ClusterBundleEvent.java
new file mode 100644
index 0000000..d551001
--- /dev/null
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/ClusterBundleEvent.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.karaf.cellar.bundle;
+
+import org.apache.karaf.cellar.core.event.Event;
+
+public class ClusterBundleEvent extends Event {
+
+    private String symbolicName;
+    private String version;
+    private String location;
+    private int type;
+
+    public ClusterBundleEvent(String symbolicName, String version, String location, int type) {
+        super(symbolicName + "/" + version);
+        this.symbolicName = symbolicName;
+        this.version = version;
+        this.location = location;
+        this.type = type;
+    }
+
+    public String getSymbolicName() {
+        return symbolicName;
+    }
+
+    public void setSymbolicName(String symbolicName) {
+        this.symbolicName = symbolicName;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
index 95113dc..643acfa 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/Constants.java
@@ -13,6 +13,9 @@
  */
 package org.apache.karaf.cellar.bundle;
 
+/**
+ * Cellar bundle constants.
+ */
 public class Constants {
 
     public static final String CATEGORY = "bundle";

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
index e8872c7..79deee4 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
@@ -15,13 +15,11 @@ package org.apache.karaf.cellar.bundle;
 
 import org.apache.karaf.cellar.core.Configurations;
 import org.apache.karaf.cellar.core.Group;
-import org.apache.karaf.cellar.core.Node;
 import org.apache.karaf.cellar.core.control.SwitchStatus;
 import org.apache.karaf.cellar.core.event.EventProducer;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.apache.karaf.features.Feature;
 import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
 import org.osgi.framework.SynchronousBundleListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -30,6 +28,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+/**
+ * LocalBundleListener is listening for local bundles changes.
+ * When a local bundle change occurs, this listener updates the cluster and broadcast a cluster bundle event.
+ */
 public class LocalBundleListener extends BundleSupport implements SynchronousBundleListener {
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(LocalBundleListener.class);
@@ -37,14 +39,15 @@ public class LocalBundleListener extends BundleSupport implements SynchronousBun
     private EventProducer eventProducer;
 
     /**
-     * Process {@link BundleEvent}s.
+     * Callback method called when a local bundle status change.
      *
-     * @param event
+     * @param event the local bundle event.
      */
+    @Override
     public void bundleChanged(BundleEvent event) {
 
         if (event.getBundle().getBundleId() == 0 && (event.getType() == BundleEvent.STOPPING || event.getType() == BundleEvent.STOPPED)) {
-            LOGGER.debug("CELLAR BUNDLE: remove LocalBundleListener");
+            LOGGER.debug("CELLAR BUNDLE: Karaf shutdown detected, removing Cellar LocalBundleListener");
             bundleContext.removeBundleListener(this);
             return;
         }
@@ -78,56 +81,50 @@ public class LocalBundleListener extends BundleSupport implements SynchronousBun
                         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
                         try {
-                            // update the cluster map
-                            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + group.getName());
+                            // update bundles in the cluster group
+                            Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + group.getName());
                             if (type == BundleEvent.UNINSTALLED) {
-                                bundles.remove(symbolicName + "/" + version);
+                                clusterBundles.remove(symbolicName + "/" + version);
                             } else {
-                                BundleState state = bundles.get(symbolicName + "/" + version);
+                                BundleState state = clusterBundles.get(symbolicName + "/" + version);
                                 if (state == null) {
                                     state = new BundleState();
                                 }
                                 state.setName(name);
                                 state.setStatus(type);
                                 state.setLocation(bundleLocation);
-                                bundles.put(symbolicName + "/" + version, state);
+                                clusterBundles.put(symbolicName + "/" + version, state);
                             }
 
                             // check the features first
                         	List<Feature> matchingFeatures = retrieveFeature(bundleLocation);
                         	for (Feature feature : matchingFeatures) {
             					if (!isAllowed(group, "features", feature.getName(), EventType.OUTBOUND)) {
-            						LOGGER.warn("CELLAR BUNDLE: bundle {} is contained in a feature marked as BLOCKED OUTBOUND", bundleLocation);
+            						LOGGER.warn("CELLAR BUNDLE: bundle {} is contained in the feature {} marked as BLOCKED OUTBOUND for cluster group {}", bundleLocation, feature.getName(), group.getName());
             						return;
             					}
             				}
                             
                             // broadcast the cluster event
-                            RemoteBundleEvent remoteBundleEvent = new RemoteBundleEvent(symbolicName, version, bundleLocation, type);
-                            remoteBundleEvent.setSourceGroup(group);
-                            eventProducer.produce(remoteBundleEvent);
+                            ClusterBundleEvent clusterBundleEvent = new ClusterBundleEvent(symbolicName, version, bundleLocation, type);
+                            clusterBundleEvent.setSourceGroup(group);
+                            eventProducer.produce(clusterBundleEvent);
                         } catch (Exception e) {
                         	LOGGER.error("CELLAR BUNDLE: failed to create bundle event", e);
 						} finally {
                             Thread.currentThread().setContextClassLoader(originalClassLoader);
                         }
 
-                    } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked as BLOCKED OUTBOUND", bundleLocation);
+                    } else LOGGER.warn("CELLAR BUNDLE: bundle {} is marked BLOCKED OUTBOUND in cluster group {}", bundleLocation, group.getName());
                 }
             }
         }
     }
 
-    /**
-     * Initialization Method.
-     */
     public void init() {
         getBundleContext().addBundleListener(this);
     }
 
-    /**
-     * Destruction Method.
-     */
     public void destroy() {
         bundleContext.removeBundleListener(this);
     }

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
deleted file mode 100644
index 290b24e..0000000
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/RemoteBundleEvent.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.karaf.cellar.bundle;
-
-import org.apache.karaf.cellar.core.event.Event;
-
-public class RemoteBundleEvent extends Event {
-
-    private String symbolicName;
-    private String version;
-    private String location;
-    private int type;
-
-    public RemoteBundleEvent(String symbolicName, String version, String location, int type) {
-        super(symbolicName + "/" + version);
-        this.symbolicName = symbolicName;
-        this.version = version;
-        this.location = location;
-        this.type = type;
-    }
-
-    public String getSymbolicName() {
-        return symbolicName;
-    }
-
-    public void setSymbolicName(String symbolicName) {
-        this.symbolicName = symbolicName;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    public String getLocation() {
-        return location;
-    }
-
-    public void setLocation(String location) {
-        this.location = location;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public void setType(int type) {
-        this.type = type;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
index b44fa32..97cc59b 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/BundleCommandSupport.java
@@ -23,23 +23,23 @@ import java.util.regex.Pattern;
 
 public abstract class BundleCommandSupport extends CellarCommandSupport {
 
-    @Argument(index = 0, name = "group", description = "The cluster group name.", required = true, multiValued = false)
+    @Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
     String groupName;
 
-    @Argument(index = 1, name = "id", description = "The bundle ID or name.", required = true, multiValued = false)
+    @Argument(index = 1, name = "id", description = "The bundle ID or name", required = true, multiValued = false)
     String name;
 
-    @Argument(index = 2, name = "version", description = "The bundle version.", required = false, multiValued = false)
+    @Argument(index = 2, name = "version", description = "The bundle version", required = false, multiValued = false)
     String version;
 
     protected abstract Object doExecute() throws Exception;
 
     /**
-     * Bundle selector.
+     * Bundle selector on the cluster.
      *
      * @return the bundle key is the distributed bundle map.
      */
-    protected String selector(Map<String, BundleState> distributedBundles) {
+    protected String selector(Map<String, BundleState> clusterBundles) {
         String key = null;
         if (version == null) {
             // looking for bundle using ID
@@ -47,7 +47,7 @@ public abstract class BundleCommandSupport extends CellarCommandSupport {
             try {
                 id = Integer.parseInt(name);
                 int index = 0;
-                for (String bundle : distributedBundles.keySet()) {
+                for (String bundle : clusterBundles.keySet()) {
                     if (index == id) {
                         key = bundle;
                         break;
@@ -63,8 +63,8 @@ public abstract class BundleCommandSupport extends CellarCommandSupport {
                 Pattern namePattern = Pattern.compile(name);
 
                 // looking for bundle using only the name
-                for (String bundle : distributedBundles.keySet()) {
-                    BundleState state = distributedBundles.get(bundle);
+                for (String bundle : clusterBundles.keySet()) {
+                    BundleState state = clusterBundles.get(bundle);
                     if (state.getName() != null) {
                         // bundle name is populated, check if it matches the regex
                         Matcher matcher = namePattern.matcher(state.getName());
@@ -98,9 +98,9 @@ public abstract class BundleCommandSupport extends CellarCommandSupport {
             // add regex support of the name
             Pattern namePattern = Pattern.compile(name);
 
-            for (String bundle : distributedBundles.keySet()) {
+            for (String bundle : clusterBundles.keySet()) {
                 String[] split = bundle.split("/");
-                BundleState state = distributedBundles.get(bundle);
+                BundleState state = clusterBundles.get(bundle);
                 if (split[1].equals(version)) {
                     if (state.getName() != null) {
                         // bundle name is populated, check if it matches the regex

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
index af4c1c9..903cfab 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
@@ -14,8 +14,8 @@
 package org.apache.karaf.cellar.bundle.shell;
 
 import org.apache.karaf.cellar.bundle.BundleState;
+import org.apache.karaf.cellar.bundle.ClusterBundleEvent;
 import org.apache.karaf.cellar.bundle.Constants;
-import org.apache.karaf.cellar.bundle.RemoteBundleEvent;
 import org.apache.karaf.cellar.core.CellarSupport;
 import org.apache.karaf.cellar.core.Configurations;
 import org.apache.karaf.cellar.core.Group;
@@ -34,7 +34,7 @@ import java.util.Map;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 
-@Command(scope = "cluster", name = "bundle-install", description = "Install a bundle assigned to a cluster group.")
+@Command(scope = "cluster", name = "bundle-install", description = "Install a bundle in a cluster group.")
 public class InstallBundleCommand extends CellarCommandSupport {
 
     @Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
@@ -87,8 +87,8 @@ public class InstallBundleCommand extends CellarCommandSupport {
                 Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
                 try {
-                    // populate the cluster map
-                    Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
+                    // 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(url);
@@ -97,17 +97,17 @@ public class InstallBundleCommand extends CellarCommandSupport {
                     } else {
                         state.setStatus(BundleEvent.INSTALLED);
                     }
-                    bundles.put(symbolicName + "/" + version, state);
+                    clusterBundles.put(symbolicName + "/" + version, state);
                 } finally {
                     Thread.currentThread().setContextClassLoader(originalClassLoader);
                 }
 
                 // broadcast the cluster event
-                RemoteBundleEvent event = new RemoteBundleEvent(symbolicName, version, url, BundleEvent.INSTALLED);
+                ClusterBundleEvent event = new ClusterBundleEvent(symbolicName, version, url, BundleEvent.INSTALLED);
                 event.setSourceGroup(group);
                 eventProducer.produce(event);
             } else {
-                System.err.println("Bundle location " + url + " is blocked outbound");
+                System.err.println("Bundle location " + url + " is blocked outbound for cluster group " + groupName);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
index b88c276..e836ccb 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ListBundleCommand.java
@@ -25,13 +25,13 @@ import org.osgi.framework.BundleEvent;
 
 import java.util.Map;
 
-@Command(scope = "cluster", name = "bundle-list", description = "List the bundles assigned to a cluster group.")
+@Command(scope = "cluster", name = "bundle-list", description = "List the bundles in a cluster group.")
 public class ListBundleCommand extends CellarCommandSupport {
 
     protected static final String HEADER_FORMAT = " %-4s   %-11s  %s";
     protected static final String OUTPUT_FORMAT = "[%-4s] [%-11s] %s";
 
-    @Argument(index = 0, name = "group", description = "The cluster group name.", required = true, multiValued = false)
+    @Argument(index = 0, name = "group", description = "The cluster group name", required = true, multiValued = false)
     String groupName;
 
     @Option(name = "-s", aliases = {}, description = "Shows the symbolic name", required = false, multiValued = false)
@@ -53,12 +53,12 @@ public class ListBundleCommand extends CellarCommandSupport {
         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
         try {
-            Map<String, BundleState> bundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
-            if (bundles != null && !bundles.isEmpty()) {
-                System.out.println(String.format("Bundles for cluster group " + groupName));
+            Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
+            if (clusterBundles != null && !clusterBundles.isEmpty()) {
+                System.out.println(String.format("Bundles in cluster group " + groupName));
                 System.out.println(String.format(HEADER_FORMAT, "ID", "State", "Name"));
                 int id = 0;
-                for (String bundle : bundles.keySet()) {
+                for (String bundle : clusterBundles.keySet()) {
                     String[] tokens = bundle.split("/");
                     String symbolicName = null;
                     String version = null;
@@ -69,7 +69,7 @@ public class ListBundleCommand extends CellarCommandSupport {
                         symbolicName = bundle;
                         version = "";
                     }
-                    BundleState state = bundles.get(bundle);
+                    BundleState state = clusterBundles.get(bundle);
                     String status;
                     switch (state.getStatus()) {
                         case BundleEvent.INSTALLED:
@@ -109,7 +109,7 @@ public class ListBundleCommand extends CellarCommandSupport {
                     id++;
                 }
             } else {
-                System.err.println("No bundles found for cluster group " + groupName);
+                System.err.println("No bundle found in cluster group " + groupName);
             }
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
index 5af6208..a695477 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
@@ -14,8 +14,8 @@
 package org.apache.karaf.cellar.bundle.shell;
 
 import org.apache.karaf.cellar.bundle.BundleState;
+import org.apache.karaf.cellar.bundle.ClusterBundleEvent;
 import org.apache.karaf.cellar.bundle.Constants;
-import org.apache.karaf.cellar.bundle.RemoteBundleEvent;
 import org.apache.karaf.cellar.core.CellarSupport;
 import org.apache.karaf.cellar.core.Configurations;
 import org.apache.karaf.cellar.core.Group;
@@ -27,7 +27,7 @@ import org.osgi.framework.BundleEvent;
 
 import java.util.Map;
 
-@Command(scope = "cluster", name = "bundle-start", description = "Start a bundle assigned to a cluster group.")
+@Command(scope = "cluster", name = "bundle-start", description = "Start a bundle in a cluster group.")
 public class StartBundleCommand extends BundleCommandSupport {
 
     private EventProducer eventProducer;
@@ -47,22 +47,22 @@ public class StartBundleCommand extends BundleCommandSupport {
             return null;
         }
 
-        // update the distributed map
+        // update the bundle in the cluster group
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
         String location;
         String key = null;
         try {
-            Map<String, BundleState> distributedBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
+            Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
 
-            key = selector(distributedBundles);
+            key = selector(clusterBundles);
 
             if (key == null) {
                 System.err.println("Bundle " + key + " not found in cluster group " + groupName);
             }
 
-            BundleState state = distributedBundles.get(key);
+            BundleState state = clusterBundles.get(key);
             if (state == null) {
                 System.err.println("Bundle " + key + " not found in cluster group " + groupName);
                 return null;
@@ -75,19 +75,19 @@ public class StartBundleCommand extends BundleCommandSupport {
             support.setGroupManager(this.groupManager);
             support.setConfigurationAdmin(this.configurationAdmin);
             if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) {
-                System.err.println("Bundle location " + location + " is blocked outbound");
+                System.err.println("Bundle location " + location + " is blocked outbound for cluster group " + groupName);
                 return null;
             }
 
             state.setStatus(BundleEvent.STARTED);
-            distributedBundles.put(key, state);
+            clusterBundles.put(key, state);
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
         }
 
         // broadcast the cluster event
         String[] split = key.split("/");
-        RemoteBundleEvent event = new RemoteBundleEvent(split[0], split[1], location, BundleEvent.STARTED);
+        ClusterBundleEvent event = new ClusterBundleEvent(split[0], split[1], location, BundleEvent.STARTED);
         event.setSourceGroup(group);
         eventProducer.produce(event);
 

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
index 2105d41..86d9c6f 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
@@ -14,22 +14,20 @@
 package org.apache.karaf.cellar.bundle.shell;
 
 import org.apache.karaf.cellar.bundle.BundleState;
+import org.apache.karaf.cellar.bundle.ClusterBundleEvent;
 import org.apache.karaf.cellar.bundle.Constants;
-import org.apache.karaf.cellar.bundle.RemoteBundleEvent;
 import org.apache.karaf.cellar.core.CellarSupport;
 import org.apache.karaf.cellar.core.Configurations;
 import org.apache.karaf.cellar.core.Group;
 import org.apache.karaf.cellar.core.control.SwitchStatus;
 import org.apache.karaf.cellar.core.event.EventProducer;
 import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
-import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.osgi.framework.BundleEvent;
 
 import java.util.Map;
 
-@Command(scope = "cluster", name = "bundle-stop", description = "Stop a bundle assigned to a cluster group.")
+@Command(scope = "cluster", name = "bundle-stop", description = "Stop a bundle in a cluster group.")
 public class StopBundleCommand extends BundleCommandSupport {
     private EventProducer eventProducer;
 
@@ -48,23 +46,23 @@ public class StopBundleCommand extends BundleCommandSupport {
             return null;
         }
 
-        // update the cluster map
+        // update the bundle in the cluster group
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
         String location;
         String key = null;
         try {
-            Map<String, BundleState> distributedBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
+            Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
 
-            key = selector(distributedBundles);
+            key = selector(clusterBundles);
 
             if (key == null) {
                 System.err.println("Bundle " + key + " not found in cluster group " + groupName);
                 return null;
             }
 
-            BundleState state = distributedBundles.get(key);
+            BundleState state = clusterBundles.get(key);
             if (state == null) {
                 System.err.println("Bundle " + key + " not found in cluster group " + groupName);
                 return null;
@@ -78,18 +76,18 @@ public class StopBundleCommand extends BundleCommandSupport {
             support.setGroupManager(this.groupManager);
             support.setConfigurationAdmin(this.configurationAdmin);
             if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) {
-                System.err.println("Bundle location " + location + " is blocked outbound");
+                System.err.println("Bundle location " + location + " is blocked outbound for cluster group " + groupName);
                 return null;
             }
 
-            distributedBundles.put(key, state);
+            clusterBundles.put(key, state);
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
         }
 
         // broadcast the cluster event
         String[] split = key.split("/");
-        RemoteBundleEvent event = new RemoteBundleEvent(split[0], split[1], location, BundleEvent.STOPPED);
+        ClusterBundleEvent event = new ClusterBundleEvent(split[0], split[1], location, BundleEvent.STOPPED);
         event.setSourceGroup(group);
         eventProducer.produce(event);
 

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
index 28ca68a..3f58c0f 100644
--- a/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
+++ b/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
@@ -14,22 +14,20 @@
 package org.apache.karaf.cellar.bundle.shell;
 
 import org.apache.karaf.cellar.bundle.BundleState;
+import org.apache.karaf.cellar.bundle.ClusterBundleEvent;
 import org.apache.karaf.cellar.bundle.Constants;
-import org.apache.karaf.cellar.bundle.RemoteBundleEvent;
 import org.apache.karaf.cellar.core.CellarSupport;
 import org.apache.karaf.cellar.core.Configurations;
 import org.apache.karaf.cellar.core.Group;
 import org.apache.karaf.cellar.core.control.SwitchStatus;
 import org.apache.karaf.cellar.core.event.EventProducer;
 import org.apache.karaf.cellar.core.event.EventType;
-import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
-import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.osgi.framework.BundleEvent;
 
 import java.util.Map;
 
-@Command(scope = "cluster", name = "bundle-uninstall", description = "Uninstall a bundle assigned to a cluster group.")
+@Command(scope = "cluster", name = "bundle-uninstall", description = "Uninstall a bundle from a cluster group.")
 public class UninstallBundleCommand extends BundleCommandSupport {
 
     private EventProducer eventProducer;
@@ -49,23 +47,23 @@ public class UninstallBundleCommand extends BundleCommandSupport {
             return null;
         }
 
-        // update the cluster map
+        // update the bundle in the cluster group
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
         String location;
         String key = null;
         try {
-            Map<String, BundleState> distributedBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
+            Map<String, BundleState> clusterBundles = clusterManager.getMap(Constants.BUNDLE_MAP + Configurations.SEPARATOR + groupName);
 
-            key = selector(distributedBundles);
+            key = selector(clusterBundles);
 
             if (key == null) {
                 System.err.println("Bundle " + key + " not found in cluster group " + groupName);
                 return null;
             }
 
-            BundleState state = distributedBundles.get(key);
+            BundleState state = clusterBundles.get(key);
             if (state == null) {
                 System.err.println("Bundle " + key + " not found in cluster group " + groupName);
                 return null;
@@ -78,18 +76,18 @@ public class UninstallBundleCommand extends BundleCommandSupport {
             support.setGroupManager(this.groupManager);
             support.setConfigurationAdmin(this.configurationAdmin);
             if (!support.isAllowed(group, Constants.CATEGORY, location, EventType.OUTBOUND)) {
-                System.err.println("Bundle location " + location + " is blocked outbound");
+                System.err.println("Bundle location " + location + " is blocked outbound for cluster group " + groupName);
                 return null;
             }
 
-            distributedBundles.remove(key);
+            clusterBundles.remove(key);
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
         }
 
         // broadcast the cluster event
         String[] split = key.split("/");
-        RemoteBundleEvent event = new RemoteBundleEvent(split[0], split[1], location, BundleEvent.UNINSTALLED);
+        ClusterBundleEvent event = new ClusterBundleEvent(split[0], split[1], location, BundleEvent.UNINSTALLED);
         event.setSourceGroup(group);
         eventProducer.produce(event);
 

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 646d53f..fbc6c97 100644
--- a/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -12,14 +12,13 @@
   ~  See the License for the specific language governing permissions and
   ~  limitations under the License.
   -->
-
 <blueprint default-availability="mandatory"
     xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
            http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
 
     <!-- Local Bundle Listener -->
-    <bean id="bundleListener" class="org.apache.karaf.cellar.bundle.LocalBundleListener" init-method="init"
+    <bean id="localBundleListener" class="org.apache.karaf.cellar.bundle.LocalBundleListener" init-method="init"
           destroy-method="destroy">
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/4643c138/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
----------------------------------------------------------------------
diff --git a/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java b/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
index d7959d4..cb73f72 100644
--- a/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
+++ b/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarBundleMBeanImpl.java
@@ -14,15 +14,13 @@
 package org.apache.karaf.cellar.management.internal;
 
 import org.apache.karaf.cellar.bundle.BundleState;
+import org.apache.karaf.cellar.bundle.ClusterBundleEvent;
 import org.apache.karaf.cellar.bundle.Constants;
-import org.apache.karaf.cellar.bundle.RemoteBundleEvent;
 import org.apache.karaf.cellar.core.*;
 import org.apache.karaf.cellar.core.control.SwitchStatus;
 import org.apache.karaf.cellar.core.event.EventProducer;
-import org.apache.karaf.cellar.core.event.EventTransportFactory;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.apache.karaf.cellar.management.CellarBundleMBean;
-import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleEvent;
 import org.osgi.service.cm.ConfigurationAdmin;
 
@@ -124,7 +122,7 @@ public class CellarBundleMBeanImpl extends StandardMBean implements CellarBundle
         }
 
         // broadcast the event
-        RemoteBundleEvent event = new RemoteBundleEvent(name, version, location, BundleEvent.INSTALLED);
+        ClusterBundleEvent event = new ClusterBundleEvent(name, version, location, BundleEvent.INSTALLED);
         event.setSourceGroup(group);
         eventProducer.produce(event);
     }
@@ -178,7 +176,7 @@ public class CellarBundleMBeanImpl extends StandardMBean implements CellarBundle
 
         // broadcast the event
         String[] split = key.split("/");
-        RemoteBundleEvent event = new RemoteBundleEvent(split[0], split[1], location, BundleEvent.UNINSTALLED);
+        ClusterBundleEvent event = new ClusterBundleEvent(split[0], split[1], location, BundleEvent.UNINSTALLED);
         event.setSourceGroup(group);
         eventProducer.produce(event);
     }
@@ -232,7 +230,7 @@ public class CellarBundleMBeanImpl extends StandardMBean implements CellarBundle
 
         // broadcast the event
         String[] split = key.split("/");
-        RemoteBundleEvent event = new RemoteBundleEvent(split[0], split[1], location, BundleEvent.STARTED);
+        ClusterBundleEvent event = new ClusterBundleEvent(split[0], split[1], location, BundleEvent.STARTED);
         event.setSourceGroup(group);
         eventProducer.produce(event);
     }
@@ -286,7 +284,7 @@ public class CellarBundleMBeanImpl extends StandardMBean implements CellarBundle
 
         // broadcast the event
         String[] split = key.split("/");
-        RemoteBundleEvent event = new RemoteBundleEvent(split[0], split[1], location, BundleEvent.STOPPED);
+        ClusterBundleEvent event = new ClusterBundleEvent(split[0], split[1], location, BundleEvent.STOPPED);
         event.setSourceGroup(group);
         eventProducer.produce(event);
     }