Code cleanup.

git-svn-id: 
https://svn.apache.org/repos/asf/karaf/cellar/branches/cellar-2.3.x@1476910 
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/2271d417
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/2271d417
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/2271d417

Branch: refs/heads/cellar-2.3.x
Commit: 2271d417d797c99d852c73bf27dd726db4c267bc
Parents: acd3904
Author: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68>
Authored: Mon Apr 29 07:17:50 2013 +0000
Committer: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68>
Committed: Mon Apr 29 07:17:50 2013 +0000

----------------------------------------------------------------------
 .../karaf/cellar/obr/ClusterObrBundleEvent.java | 40 ++++++++++++++++
 .../karaf/cellar/obr/ClusterObrUrlEvent.java    | 40 ++++++++++++++++
 .../org/apache/karaf/cellar/obr/Constants.java  |  2 +-
 .../apache/karaf/cellar/obr/ObrBundleEvent.java | 40 ----------------
 .../karaf/cellar/obr/ObrBundleEventHandler.java | 22 +++++----
 .../apache/karaf/cellar/obr/ObrBundleInfo.java  |  2 +-
 .../org/apache/karaf/cellar/obr/ObrSupport.java | 10 ++--
 .../apache/karaf/cellar/obr/ObrUrlEvent.java    | 41 ----------------
 .../karaf/cellar/obr/ObrUrlEventHandler.java    | 34 +++++++-------
 .../karaf/cellar/obr/ObrUrlSynchronizer.java    | 28 +++++------
 .../cellar/obr/management/CellarOBRMBean.java   | 40 +++++++++++++++-
 .../management/internal/CellarOBRMBeanImpl.java | 49 +++++++++++---------
 .../cellar/obr/shell/ObrAddUrlCommand.java      | 31 +++++++------
 .../cellar/obr/shell/ObrCommandSupport.java     | 13 ++++++
 .../cellar/obr/shell/ObrDeployCommand.java      | 22 ++++-----
 .../karaf/cellar/obr/shell/ObrListCommand.java  | 12 ++---
 .../cellar/obr/shell/ObrListUrlCommand.java     | 14 +++---
 .../cellar/obr/shell/ObrRemoveUrlCommand.java   | 29 ++++++------
 18 files changed, 264 insertions(+), 205 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrBundleEvent.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrBundleEvent.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrBundleEvent.java
new file mode 100644
index 0000000..4222ed5
--- /dev/null
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrBundleEvent.java
@@ -0,0 +1,40 @@
+/*
+ * 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.obr;
+
+import org.apache.karaf.cellar.core.event.Event;
+
+/**
+ * Cluster OBR bundle event.
+ */
+public class ClusterObrBundleEvent extends Event {
+
+    private String bundleId;
+    private int type;
+
+    public ClusterObrBundleEvent(String bundleId, int type) {
+        super(bundleId);
+        this.bundleId = bundleId;
+        this.type = type;
+    }
+
+    public String getBundleId() {
+        return this.bundleId;
+    }
+
+    public int getType() {
+        return this.type;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrUrlEvent.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrUrlEvent.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrUrlEvent.java
new file mode 100644
index 0000000..62a2dfd
--- /dev/null
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/ClusterObrUrlEvent.java
@@ -0,0 +1,40 @@
+/*
+ * 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.obr;
+
+import org.apache.karaf.cellar.core.event.Event;
+
+/**
+ * Cluster OBR URL event.
+ */
+public class ClusterObrUrlEvent extends Event {
+
+    private String url;
+    private int type;
+
+    public ClusterObrUrlEvent(String url, int type) {
+        super(url);
+        this.url = url;
+        this.type = type;
+    }
+
+    public String getUrl() {
+        return this.url;
+    }
+
+    public int getType() {
+        return this.type;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/Constants.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/Constants.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/Constants.java
index f7cd251..bbd8bdb 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/Constants.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/Constants.java
@@ -14,7 +14,7 @@
 package org.apache.karaf.cellar.obr;
 
 /**
- * Cellar OBR constants
+ * Cellar OBR configuration constants.
  */
 public class Constants {
 

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEvent.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEvent.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEvent.java
deleted file mode 100644
index 85cbc24..0000000
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEvent.java
+++ /dev/null
@@ -1,40 +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.obr;
-
-import org.apache.karaf.cellar.core.event.Event;
-
-/**
- * OBR Bundle cluster event.
- */
-public class ObrBundleEvent extends Event {
-
-    private String bundleId;
-    private int type;
-
-    public ObrBundleEvent(String bundleId, int type) {
-        super(bundleId);
-        this.bundleId = bundleId;
-        this.type = type;
-    }
-
-    public String getBundleId() {
-        return this.bundleId;
-    }
-
-    public int getType() {
-        return this.type;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java
index 3caf5b9..34e69f3 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java
@@ -30,9 +30,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * OBR bundles event handler.
+ * Handler for cluster OBR bundle event.
  */
-public class ObrBundleEventHandler extends ObrSupport implements 
EventHandler<ObrBundleEvent> {
+public class ObrBundleEventHandler extends ObrSupport implements 
EventHandler<ClusterObrBundleEvent> {
 
     private static final transient Logger LOGGER = 
LoggerFactory.getLogger(ObrBundleEventHandler.class);
 
@@ -105,22 +105,22 @@ public class ObrBundleEventHandler extends ObrSupport 
implements EventHandler<Ob
     }
 
     /**
-     * Handle an OBR bundle event.
+     * Handle a received cluster OBR bundle event.
      *
-     * @param event the OBR bundle event.
+     * @param event the cluster OBR bundle event received.
      */
     @Override
-    public void handle(ObrBundleEvent event) {
+    public void handle(ClusterObrBundleEvent event) {
 
         // check if the handler is ON
         if (this.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
-            LOGGER.warn("CELLAR OBR: {} switch is OFF, cluster event not 
handled", SWITCH_ID);
+            LOGGER.warn("CELLAR OBR: {} switch is OFF", SWITCH_ID);
             return;
         }
 
         // check if the group is local
         if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) {
-            LOGGER.debug("CELLAR OBR: node is not part of the event cluster 
group");
+            LOGGER.debug("CELLAR OBR: node is not part of the event cluster 
group {}", event.getSourceGroup().getName());
             return;
         }
 
@@ -152,16 +152,18 @@ public class ObrBundleEventHandler extends ObrSupport 
implements EventHandler<Ob
                         }
                     } else LOGGER.warn("CELLAR OBR: could not resolve 
targets");
                 }
-            } else LOGGER.warn("CELLAR OBR: bundle {} is marked as BLOCKED 
INBOUND", bundleId);
+            } else LOGGER.warn("CELLAR OBR: bundle {} is marked BLOCKED 
INBOUND for cluster group {}", bundleId, event.getSourceGroup().getName());
         } catch (Exception e) {
             LOGGER.error("CELLAR OBR: failed to handle bundle event {}", 
bundleId, e);
         }
     }
 
-    public Class<ObrBundleEvent> getType() {
-        return ObrBundleEvent.class;
+    @Override
+    public Class<ClusterObrBundleEvent> getType() {
+        return ClusterObrBundleEvent.class;
     }
 
+    @Override
     public Switch getSwitch() {
         // load the switch status from the config
         try {

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleInfo.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleInfo.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleInfo.java
index 3f9b8ea..47f9a13 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleInfo.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleInfo.java
@@ -16,7 +16,7 @@ package org.apache.karaf.cellar.obr;
 import java.io.Serializable;
 
 /**
- * Simple serializable wrapper for OBR bundle.
+ * Serializable wrapper for OBR bundle store in cluster groups.
  */
 public class ObrBundleInfo implements Serializable {
 

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ObrSupport.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrSupport.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrSupport.java
index 6dd7c76..6cb5853 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrSupport.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrSupport.java
@@ -18,16 +18,20 @@ import org.apache.karaf.cellar.core.CellarSupport;
 import org.osgi.framework.BundleContext;
 
 /**
- * Cellar OBR support.
+ * Generic Cellar OBR support, providing util methods.
  */
 public class ObrSupport extends CellarSupport {
 
     protected BundleContext bundleContext;
     protected RepositoryAdmin obrService;
 
-    public void init() { }
+    public void init() {
+        // nothing to do
+    }
 
-    public void destroy() { }
+    public void destroy() {
+        // nothing to do
+    }
 
     public BundleContext getBundleContext() {
         return this.bundleContext;

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEvent.java
----------------------------------------------------------------------
diff --git a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEvent.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEvent.java
deleted file mode 100644
index 4bb59ec..0000000
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEvent.java
+++ /dev/null
@@ -1,41 +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.obr;
-
-import org.apache.karaf.cellar.core.event.Event;
-import org.apache.karaf.cellar.core.event.EventType;
-
-/**
- * OBR URL Event.
- */
-public class ObrUrlEvent extends Event {
-
-    private String url;
-    private int type;
-
-    public ObrUrlEvent(String url, int type) {
-        super(url);
-        this.url = url;
-        this.type = type;
-    }
-
-    public String getUrl() {
-        return this.url;
-    }
-
-    public int getType() {
-        return this.type;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java
index 31775db..1cb9947 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java
@@ -24,9 +24,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * OBR URL Event handler.
+ * Handler for cluster OBR URL event.
  */
-public class ObrUrlEventHandler extends ObrSupport implements 
EventHandler<ObrUrlEvent> {
+public class ObrUrlEventHandler extends ObrSupport implements 
EventHandler<ClusterObrUrlEvent> {
 
     private static final transient Logger LOGGER = 
LoggerFactory.getLogger(ObrUrlEventHandler.class);
 
@@ -45,51 +45,53 @@ public class ObrUrlEventHandler extends ObrSupport 
implements EventHandler<ObrUr
     }
 
     /**
-     * Process an OBR URL event.
+     * Handle a received cluster OBR URL event.
      *
-     * @param obrUrlEvent the OBR URL Event.
+     * @param clusterObrUrlEvent the cluster OBR URL event received.
      */
     @Override
-    public void handle(ObrUrlEvent obrUrlEvent) {
+    public void handle(ClusterObrUrlEvent clusterObrUrlEvent) {
 
         // check if the handler is ON
         if (this.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
-            LOGGER.warn("CELLAR OBR: {} switch is OFF, cluster event not 
handled", SWITCH_ID);
+            LOGGER.warn("CELLAR OBR: {} switch is OFF", SWITCH_ID);
             return;
         }
 
         // check if the group is local
-        if 
(!groupManager.isLocalGroup(obrUrlEvent.getSourceGroup().getName())) {
-            LOGGER.debug("CELLAR OBR: node is not part of the event cluster 
group");
+        if 
(!groupManager.isLocalGroup(clusterObrUrlEvent.getSourceGroup().getName())) {
+            LOGGER.debug("CELLAR OBR: node is not part of the event cluster 
group {}", clusterObrUrlEvent.getSourceGroup().getName());
             return;
         }
 
-        String url = obrUrlEvent.getUrl();
-        String groupName = obrUrlEvent.getSourceGroup().getName();
+        String url = clusterObrUrlEvent.getUrl();
+        String groupName = clusterObrUrlEvent.getSourceGroup().getName();
         try {
-            if (isAllowed(obrUrlEvent.getSourceGroup(), 
Constants.URLS_CONFIG_CATEGORY, url, EventType.INBOUND) || 
obrUrlEvent.getForce()) {
+            if (isAllowed(clusterObrUrlEvent.getSourceGroup(), 
Constants.URLS_CONFIG_CATEGORY, url, EventType.INBOUND) || 
clusterObrUrlEvent.getForce()) {
                 LOGGER.debug("CELLAR OBR: received OBR URL {}", url);
-                if (obrUrlEvent.getType() == Constants.URL_ADD_EVENT_TYPE) {
+                if (clusterObrUrlEvent.getType() == 
Constants.URL_ADD_EVENT_TYPE) {
                     LOGGER.debug("CELLAR OBR: add OBR URL {}", url);
                     obrService.addRepository(url);
                 }
-                if (obrUrlEvent.getType() == Constants.URL_REMOVE_EVENT_TYPE) {
+                if (clusterObrUrlEvent.getType() == 
Constants.URL_REMOVE_EVENT_TYPE) {
                     LOGGER.debug("CELLAR OBR: remove OBR URL {}", url);
                     boolean removed = obrService.removeRepository(url);
                     if (!removed) {
                         LOGGER.warn("CELLAR OBR: the repository URL hasn't 
been removed from the OBR service");
                     }
                 }
-            } else LOGGER.warn("CELLAR OBR: repository URL {} is marked as 
BLOCKED INBOUND", url);
+            } else LOGGER.warn("CELLAR OBR: repository URL {} is marked 
BLOCKED INBOUND for cluster group {}", url, groupName);
         } catch (Exception e) {
             LOGGER.error("CELLAR OBR: failed to register URL {}", url, e);
         }
     }
 
-    public Class<ObrUrlEvent> getType() {
-        return ObrUrlEvent.class;
+    @Override
+    public Class<ClusterObrUrlEvent> getType() {
+        return ClusterObrUrlEvent.class;
     }
 
+    @Override
     public Switch getSwitch() {
         // load the switch status from the config
         try {

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
index 05b6c84..bbc2467 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
@@ -18,7 +18,6 @@ import org.apache.felix.bundlerepository.Resource;
 import org.apache.karaf.cellar.core.Configurations;
 import org.apache.karaf.cellar.core.Group;
 import org.apache.karaf.cellar.core.Synchronizer;
-import org.apache.karaf.cellar.core.event.EventProducer;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.osgi.service.cm.Configuration;
 import org.slf4j.Logger;
@@ -26,16 +25,16 @@ import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.Dictionary;
-import java.util.List;
 import java.util.Set;
 
 /**
- * Bootstrap synchronizer for the OBR URLs.
+ * OBR URL synchronizer.
  */
 public class ObrUrlSynchronizer extends ObrSupport implements Synchronizer {
 
     private static final transient Logger LOGGER = 
LoggerFactory.getLogger(ObrUrlSynchronizer.class);
 
+    @Override
     public void init() {
         super.init();
         Set<Group> groups = groupManager.listLocalGroups();
@@ -49,24 +48,26 @@ public class ObrUrlSynchronizer extends ObrSupport 
implements Synchronizer {
         }
     }
 
+    @Override
     public void destroy() {
         super.destroy();
     }
 
     /**
-     * Pull the OBR URL from the cluster.
+     * Pull the OBR URLs from a cluster group to update the local state.
      *
      * @param group the cluster group.
      */
+    @Override
     public void pull(Group group) {
         if (group != null) {
             String groupName = group.getName();
-            Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+            Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
             ClassLoader originalClassLoader = 
Thread.currentThread().getContextClassLoader();
             try {
                 
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-                if (urls != null && !urls.isEmpty()) {
-                    for (String url : urls) {
+                if (clusterUrls != null && !clusterUrls.isEmpty()) {
+                    for (String url : clusterUrls) {
                         try {
                             obrService.addRepository(url);
                             LOGGER.debug("CELLAR OBR: add OBR repository URL 
{}", url);
@@ -82,14 +83,15 @@ public class ObrUrlSynchronizer extends ObrSupport 
implements Synchronizer {
     }
 
     /**
-     * Push the local OBR URLs to the cluster
+     * Push the local OBR URLs to a cluster group.
      *
      * @param group the cluster group.
      */
+    @Override
     public void push(Group group) {
         if (group != null) {
             String groupName = group.getName();
-            Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+            Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
 
             ClassLoader originalClassLoader = 
Thread.currentThread().getContextClassLoader();
             try {
@@ -97,13 +99,13 @@ public class ObrUrlSynchronizer extends ObrSupport 
implements Synchronizer {
                 Repository[] repositories = obrService.listRepositories();
                 for (Repository repository : repositories) {
                     if (isAllowed(group, Constants.URLS_CONFIG_CATEGORY, 
repository.getURI().toString(), EventType.OUTBOUND)) {
-                        urls.add(repository.getURI().toString());
-                        // push the bundles in the OBR distributed set
-                        Set<ObrBundleInfo> bundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+                        clusterUrls.add(repository.getURI().toString());
+                        // update the OBR bundles in the cluster group
+                        Set<ObrBundleInfo> clusterBundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
                         Resource[] resources = repository.getResources();
                         for (Resource resource : resources) {
                             ObrBundleInfo info = new 
ObrBundleInfo(resource.getPresentationName(), resource.getSymbolicName(), 
resource.getVersion().toString());
-                            bundles.add(info);
+                            clusterBundles.add(info);
                             // TODO fire event to the other nodes ?
                         }
                     } else {

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/management/CellarOBRMBean.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/management/CellarOBRMBean.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/management/CellarOBRMBean.java
index a8e322a..915e99c 100644
--- 
a/obr/src/main/java/org/apache/karaf/cellar/obr/management/CellarOBRMBean.java
+++ 
b/obr/src/main/java/org/apache/karaf/cellar/obr/management/CellarOBRMBean.java
@@ -17,15 +17,53 @@ import javax.management.openmbean.TabularData;
 import java.util.List;
 
 /**
- * MBean interface describing the operations and attributes on OBR service..
+ * Describe the operations and attributes of the Cellar OBR MBean.
  */
 public interface CellarOBRMBean {
 
+    /**
+     * List the OBR URLs in a cluster group.
+     *
+     * @param groupName the cluster group name.
+     * @return the list of OBR URLs.
+     * @throws Exception in case of retrieval failure.
+     */
     List<String> listUrls(String groupName) throws Exception;
+
+    /**
+     * List the OBR bundles in a cluster group.
+     *
+     * @param groupName the cluster group name.
+     * @return the list of OBR bundles.
+     * @throws Exception in case of retrieval failure.
+     */
     TabularData listBundles(String groupName) throws Exception;
 
+    /**
+     * Add an OBR URL in a cluster group.
+     *
+     * @param groupName the cluster group name.
+     * @param url the OBR URL.
+     * @throws Exception in case of add failure.
+     */
     void addUrl(String groupName, String url) throws Exception;
+
+    /**
+     * Remove an OBR URL from a cluster group.
+     *
+     * @param groupName the cluster group name.
+     * @param url the OBR URL.
+     * @throws Exception in case of remove failure.
+     */
     void removeUrl(String groupName, String url) throws Exception;
+
+    /**
+     * Deploy an OBR bundle in a cluster group.
+     *
+     * @param groupName the cluster group name.
+     * @param bundleId the bundle ID.
+     * @throws Exception in case of deploy failure.
+     */
     void deploy(String groupName, String bundleId) throws Exception;
 
 }

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/management/internal/CellarOBRMBeanImpl.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/management/internal/CellarOBRMBeanImpl.java
 
b/obr/src/main/java/org/apache/karaf/cellar/obr/management/internal/CellarOBRMBeanImpl.java
index c06e91f..8b0175b 100644
--- 
a/obr/src/main/java/org/apache/karaf/cellar/obr/management/internal/CellarOBRMBeanImpl.java
+++ 
b/obr/src/main/java/org/apache/karaf/cellar/obr/management/internal/CellarOBRMBeanImpl.java
@@ -20,10 +20,10 @@ 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.EventType;
+import org.apache.karaf.cellar.obr.ClusterObrBundleEvent;
+import org.apache.karaf.cellar.obr.ClusterObrUrlEvent;
 import org.apache.karaf.cellar.obr.Constants;
-import org.apache.karaf.cellar.obr.ObrBundleEvent;
 import org.apache.karaf.cellar.obr.ObrBundleInfo;
-import org.apache.karaf.cellar.obr.ObrUrlEvent;
 import org.apache.karaf.cellar.obr.management.CellarOBRMBean;
 import org.osgi.service.cm.ConfigurationAdmin;
 
@@ -49,6 +49,7 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
         super(CellarOBRMBean.class);
     }
 
+    @Override
     public List<String> listUrls(String groupName) throws Exception {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -57,13 +58,14 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
         }
 
         List<String> result = new ArrayList<String>();
-        Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
-        for (String url : urls) {
+        Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        for (String url : clusterUrls) {
             result.add(url);
         }
         return result;
     }
 
+    @Override
     public TabularData listBundles(String groupName) throws Exception {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -82,8 +84,8 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
         ClassLoader originalClassLoader = 
Thread.currentThread().getContextClassLoader();
         try {
             
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-            Set<ObrBundleInfo> bundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
-            for (ObrBundleInfo info : bundles) {
+            Set<ObrBundleInfo> clusterBundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+            for (ObrBundleInfo info : clusterBundles) {
                 CompositeData data = new CompositeDataSupport(compositeType,
                         new String[]{ "name", "symbolic", "version" },
                         new Object[]{ info.getPresentationName(), 
info.getSymbolicName(), info.getVersion() });
@@ -96,6 +98,7 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
         return table;
     }
 
+    @Override
     public void addUrl(String groupName, String url) throws Exception {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -114,13 +117,13 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
         support.setGroupManager(this.groupManager);
         support.setConfigurationAdmin(this.configurationAdmin);
         if (!support.isAllowed(group, Constants.URLS_CONFIG_CATEGORY, url, 
EventType.OUTBOUND)) {
-            throw new IllegalArgumentException("OBR URL " + url + " is blocked 
outbound");
+            throw new IllegalArgumentException("OBR URL " + url + " is blocked 
outbound for cluster group " + groupName);
         }
 
-        // push the OBR URL in the distributed set
-        Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
-        urls.add(url);
-        // push the bundles in the OBR distributed set
+        // update the OBR URLs in the cluster group
+        Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        clusterUrls.add(url);
+        // update the OBR bundles in the cluster group
         Set<ObrBundleInfo> bundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
         synchronized (obrService) {
             Repository repository = obrService.addRepository(url);
@@ -132,13 +135,14 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
             obrService.removeRepository(url);
         }
 
-        // create an cluster event and produce it
-        ObrUrlEvent event = new ObrUrlEvent(url, Constants.URL_ADD_EVENT_TYPE);
+        // broadcast a cluster event
+        ClusterObrUrlEvent event = new ClusterObrUrlEvent(url, 
Constants.URL_ADD_EVENT_TYPE);
         event.setForce(true);
         event.setSourceGroup(group);
         eventProducer.produce(event);
     }
 
+    @Override
     public void removeUrl(String groupName, String url) throws Exception {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -157,13 +161,13 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
         support.setGroupManager(this.groupManager);
         support.setConfigurationAdmin(this.configurationAdmin);
         if (!support.isAllowed(group, Constants.URLS_CONFIG_CATEGORY, url, 
EventType.OUTBOUND)) {
-            throw new IllegalArgumentException("OBR URL " + url + " is blocked 
outbound");
+            throw new IllegalArgumentException("OBR URL " + url + " is blocked 
outbound for cluster group " + groupName);
         }
 
-        // remove URL from the distributed map
-        Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
-        urls.remove(url);
-        // remove bundles from the distributed map
+        // update the OBR URLs in the cluster group
+        Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        clusterUrls.remove(url);
+        // update the OBR bundles in the cluster group
         Set<ObrBundleInfo> bundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
         synchronized (obrService) {
             Repository repository = obrService.addRepository(url);
@@ -175,12 +179,13 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
             obrService.removeRepository(url);
         }
 
-        // create an event and produce it
-        ObrUrlEvent event = new ObrUrlEvent(url, 
Constants.URL_REMOVE_EVENT_TYPE);
+        // broadcast the cluster event
+        ClusterObrUrlEvent event = new ClusterObrUrlEvent(url, 
Constants.URL_REMOVE_EVENT_TYPE);
         event.setSourceGroup(group);
         eventProducer.produce(event);
     }
 
+    @Override
     public void deploy(String groupName, String bundleId) throws Exception {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -199,12 +204,12 @@ public class CellarOBRMBeanImpl extends StandardMBean 
implements CellarOBRMBean
         support.setGroupManager(this.groupManager);
         support.setConfigurationAdmin(this.configurationAdmin);
         if (!support.isAllowed(group, Constants.BUNDLES_CONFIG_CATEGORY, 
bundleId, EventType.OUTBOUND)) {
-            throw new IllegalArgumentException("OBR bundle " + bundleId + " is 
blocked outbound");
+            throw new IllegalArgumentException("OBR bundle " + bundleId + " is 
blocked outbound for cluster group " + groupName);
         }
 
         // create an event and produce it
         int type = 0;
-        ObrBundleEvent event = new ObrBundleEvent(bundleId, type);
+        ClusterObrBundleEvent event = new ClusterObrBundleEvent(bundleId, 
type);
         event.setForce(true);
         event.setSourceGroup(group);
         eventProducer.produce(event);

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
index aa81d31..9ce2b97 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrAddUrlCommand.java
@@ -22,60 +22,61 @@ 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.obr.ClusterObrUrlEvent;
 import org.apache.karaf.cellar.obr.Constants;
 import org.apache.karaf.cellar.obr.ObrBundleInfo;
-import org.apache.karaf.cellar.obr.ObrUrlEvent;
 
 import java.util.Set;
 
-@Command(scope = "cluster", name = "obr-add-url", description = "Register a 
repository URL in the distributed OBR service.")
+@Command(scope = "cluster", name = "obr-add-url", description = "Add an OBR 
URL in a cluster group")
 public class ObrAddUrlCommand extends ObrCommandSupport {
 
-    @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 = "url", description = "The repository URL to 
register in the OBR service.", required = true, multiValued = false)
+    @Argument(index = 1, name = "url", description = "The repository URL to 
register in the OBR service", required = true, multiValued = false)
     String url;
 
     private EventProducer eventProducer;
 
+    @Override
     public Object doExecute() throws Exception {
         // check if the cluster group exists
         Group group = groupManager.findGroupByName(groupName);
         if (group == null) {
-            System.err.println("Cluster group " + groupName + " doesn't 
exist.");
+            System.err.println("Cluster group " + groupName + " doesn't 
exist");
             return null;
         }
 
         // check if the producer is ON
         if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
-            System.err.println("Cluster event producer is OFF for this node");
+            System.err.println("Cluster event producer is OFF");
             return null;
         }
 
         // check if the URL is allowed
         if (!isAllowed(group, Constants.URLS_CONFIG_CATEGORY, url, 
EventType.OUTBOUND)) {
-            System.err.println("OBR URL " + url + " is blocked outbound");
+            System.err.println("OBR URL " + url + " is blocked outbound for 
cluster group " + groupName);
             return null;
         }
 
-        // push the OBR URL in the distributed set
-        Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
-        urls.add(url);
-        // push the bundles in the OBR distributed set
-        Set<ObrBundleInfo> bundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        // update the OBR URLs in the cluster group
+        Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        clusterUrls.add(url);
+        // update the OBR bundles in the cluster group
+        Set<ObrBundleInfo> clusterBundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
         synchronized (obrService) {
             Repository repository = obrService.addRepository(url);
             Resource[] resources = repository.getResources();
             for (Resource resource : resources) {
                 ObrBundleInfo info = new 
ObrBundleInfo(resource.getPresentationName(), resource.getSymbolicName(), 
resource.getVersion().toString());
-                bundles.add(info);
+                clusterBundles.add(info);
             }
             obrService.removeRepository(url);
         }
 
-        // create an cluster event and produce it
-        ObrUrlEvent event = new ObrUrlEvent(url, Constants.URL_ADD_EVENT_TYPE);
+        // broadcast a cluster event
+        ClusterObrUrlEvent event = new ClusterObrUrlEvent(url, 
Constants.URL_ADD_EVENT_TYPE);
         event.setForce(true);
         event.setSourceGroup(group);
         eventProducer.produce(event);

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
index 42e310d..ac254c7 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrCommandSupport.java
@@ -19,6 +19,9 @@ import org.apache.karaf.cellar.core.Group;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.apache.karaf.cellar.core.shell.CellarCommandSupport;
 
+/**
+ * Generic cluster shell OBR command.
+ */
 public abstract class ObrCommandSupport extends CellarCommandSupport {
 
     protected RepositoryAdmin obrService;
@@ -31,6 +34,15 @@ public abstract class ObrCommandSupport extends 
CellarCommandSupport {
         this.obrService = obrService;
     }
 
+    /**
+     * Check if the cluster OBR event is allowed.
+     *
+     * @param group the cluster group name.
+     * @param category the OBR event category name.
+     * @param id the event ID.
+     * @param type the event type (inbound, outbound).
+     * @return true if the OBR event is allowed, false else.
+     */
     public boolean isAllowed(Group group, String category, String id, 
EventType type) {
         CellarSupport support = new CellarSupport();
         support.setClusterManager(this.clusterManager);
@@ -39,6 +51,7 @@ public abstract class ObrCommandSupport extends 
CellarCommandSupport {
         return support.isAllowed(group, category, id, type);
     }
 
+    @Override
     public abstract Object doExecute() throws Exception;
 
 }

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
index a84d895..8c054b3 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrDeployCommand.java
@@ -16,27 +16,23 @@ package org.apache.karaf.cellar.obr.shell;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Command;
 import org.apache.felix.gogo.commands.Option;
-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.cellar.obr.ClusterObrBundleEvent;
 import org.apache.karaf.cellar.obr.Constants;
-import org.apache.karaf.cellar.obr.ObrBundleEvent;
 
-import java.util.Set;
-
-@Command(scope = "cluster", name = "obr-deploy", description = "Deploy a 
bundle from the OBR assigned to a cluster group.")
+@Command(scope = "cluster", name = "obr-deploy", description = "Deploy an OBR 
bundle in a cluster group")
 public class ObrDeployCommand extends ObrCommandSupport {
 
-    @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="bundleId", description = "The bundle ID 
(symbolicname,version in the OBR) to deploy.", required = true, multiValued = 
false)
+    @Argument(index = 1, name="bundleId", description = "The bundle ID 
(symbolicname,version in the OBR) to deploy", required = true, multiValued = 
false)
     String bundleId;
 
-    @Option(name = "-s", aliases = { "--start" }, description = "Start the 
deployed bundles.", required = false, multiValued = false)
+    @Option(name = "-s", aliases = { "--start" }, description = "Start the 
deployed bundles", required = false, multiValued = false)
     boolean start = false;
 
     private EventProducer eventProducer;
@@ -52,20 +48,20 @@ public class ObrDeployCommand extends ObrCommandSupport {
 
         // check if the producer is ON
         if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
-            System.err.println("Cluster event producer is OFF for this node");
+            System.err.println("Cluster event producer is OFF");
             return null;
         }
 
         // check if the bundle is allowed
         if (!isAllowed(group, Constants.BUNDLES_CONFIG_CATEGORY, bundleId, 
EventType.OUTBOUND)) {
-            System.err.println("OBR bundle " + bundleId + " is blocked 
outbound");
+            System.err.println("OBR bundle " + bundleId + " is blocked 
outbound for cluster group " + groupName);
             return null;
         }
 
-        // create an event and produce it
+        // broadcast a cluster event
         int type = 0;
         if (start) type = Constants.BUNDLE_START_EVENT_TYPE;
-        ObrBundleEvent event = new ObrBundleEvent(bundleId, type);
+        ClusterObrBundleEvent event = new ClusterObrBundleEvent(bundleId, 
type);
         event.setForce(true);
         event.setSourceGroup(group);
         eventProducer.produce(event);

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
index f29faad..e1a0da6 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListCommand.java
@@ -23,15 +23,13 @@ import org.apache.karaf.cellar.obr.ObrBundleInfo;
 
 import java.util.Set;
 
-/**
- * cluster:obr-list command.
- */
-@Command(scope = "cluster", name = "obr-list", description = "List available 
bundles in the OBR of all nodes assigned to a cluster group")
+@Command(scope = "cluster", name = "obr-list", description = "List the OBR 
bundles in a cluster group")
 public class ObrListCommand extends CellarCommandSupport {
 
     @Argument(index = 0, name = "group", description = "The cluster group 
name", required = true, multiValued = false)
     String groupName;
 
+    @Override
     public Object doExecute() {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -44,11 +42,11 @@ public class ObrListCommand extends CellarCommandSupport {
         try {
             
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
-            Set<ObrBundleInfo> bundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+            Set<ObrBundleInfo> clusterBundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
             int maxPName = 4;
             int maxSName = 13;
             int maxVersion = 7;
-            for (ObrBundleInfo bundle : bundles) {
+            for (ObrBundleInfo bundle : clusterBundles) {
                 maxPName = Math.max(maxPName, 
emptyIfNull(bundle.getPresentationName()).length());
                 maxSName = Math.max(maxSName, 
emptyIfNull(bundle.getSymbolicName()).length());
                 maxVersion = Math.max(maxVersion, 
emptyIfNull(bundle.getVersion()).length());
@@ -56,7 +54,7 @@ public class ObrListCommand extends CellarCommandSupport {
             String formatHeader = "  %-" + maxPName + "s  %-" + maxSName + "s  
 %-" + maxVersion + "s";
             String formatLine = "[%-" + maxPName + "s] [%-" + maxSName + "s] 
[%-" + maxVersion + "s]";
             System.out.println(String.format(formatHeader, "NAME", "SYMBOLIC 
NAME", "VERSION"));
-            for (ObrBundleInfo bundle : bundles) {
+            for (ObrBundleInfo bundle : clusterBundles) {
                 System.out.println(String.format(formatLine, 
emptyIfNull(bundle.getPresentationName()), 
emptyIfNull(bundle.getSymbolicName()), emptyIfNull(bundle.getVersion())));
             }
         } finally {

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
index 21a1557..c97f1ec 100644
--- a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
+++ b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrListUrlCommand.java
@@ -22,15 +22,13 @@ import org.apache.karaf.cellar.obr.Constants;
 
 import java.util.Set;
 
-/**
- * cluster:obr-list command
- */
-@Command(scope = "cluster", name = "obr-list-url", description = "List 
repository URLs defined in the distributed OBR service assigned to a given 
group")
+@Command(scope = "cluster", name = "obr-list-url", description = "List the OBR 
URLs in a cluster group")
 public class ObrListUrlCommand extends CellarCommandSupport {
 
     @Argument(index = 0, name = "group", description = "The cluster group 
name", required = true, multiValued = false)
     String groupName;
 
+    @Override
     public Object doExecute() throws Exception {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -38,10 +36,10 @@ public class ObrListUrlCommand extends CellarCommandSupport 
{
             System.err.println("Cluster group " + groupName + " doesn't 
exist");
             return null;
         }
-        // get the URLs from the distribution set
-        Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
-        if (urls != null) {
-            for (String url : urls) {
+        // get the OBR URLs in the cluster group
+        Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        if (clusterUrls != null) {
+            for (String url : clusterUrls) {
                 System.out.println(url);
             }
         }

http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/2271d417/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
----------------------------------------------------------------------
diff --git 
a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java 
b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
index dda64ec..03fe30c 100644
--- 
a/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
+++ 
b/obr/src/main/java/org/apache/karaf/cellar/obr/shell/ObrRemoveUrlCommand.java
@@ -22,23 +22,24 @@ 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.obr.ClusterObrUrlEvent;
 import org.apache.karaf.cellar.obr.Constants;
 import org.apache.karaf.cellar.obr.ObrBundleInfo;
-import org.apache.karaf.cellar.obr.ObrUrlEvent;
 
 import java.util.Set;
 
-@Command(scope = "cluster", name = "obr-remove-url", description = "Remove a 
repository URL from the distributed OBR service assigned to a cluster group.")
+@Command(scope = "cluster", name = "obr-remove-url", description = "Remove an 
OBR URL from a cluster group")
 public class ObrRemoveUrlCommand extends ObrCommandSupport {
 
-    @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 = "url", description = "The repository URL to 
add in the OBR service.", required = true, multiValued = false)
+    @Argument(index = 1, name = "url", description = "The OBR URL", required = 
true, multiValued = false)
     String url;
 
     private EventProducer eventProducer;
 
+    @Override
     public Object doExecute() throws Exception {
         // check if the group exists
         Group group = groupManager.findGroupByName(groupName);
@@ -49,33 +50,33 @@ public class ObrRemoveUrlCommand extends ObrCommandSupport {
 
         // check if the producer is ON
         if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
-            System.err.println("Cluster event producer is OFF for this node");
+            System.err.println("Cluster event producer is OFF");
             return null;
         }
 
         // check if the URL is allowed
         if (!isAllowed(group, Constants.URLS_CONFIG_CATEGORY, url, 
EventType.OUTBOUND)) {
-            System.err.println("OBR URL " + url + " is blocked outbound");
+            System.err.println("OBR URL " + url + " is blocked outbound for 
cluster group " + groupName);
             return null;
         }
 
-        // remove URL from the distributed map
-        Set<String> urls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
-        urls.remove(url);
-        // remove bundles from the distributed map
-        Set<ObrBundleInfo> bundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        // update the OBR URLs in the cluster group
+        Set<String> clusterUrls = 
clusterManager.getSet(Constants.URLS_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
+        clusterUrls.remove(url);
+        // update the OBR bundles in cluster group
+        Set<ObrBundleInfo> clusterBundles = 
clusterManager.getSet(Constants.BUNDLES_DISTRIBUTED_SET_NAME + 
Configurations.SEPARATOR + groupName);
         synchronized (obrService) {
             Repository repository = obrService.addRepository(url);
             Resource[] resources = repository.getResources();
             for (Resource resource : resources) {
                 ObrBundleInfo info = new 
ObrBundleInfo(resource.getPresentationName(), resource.getSymbolicName(), 
resource.getVersion().toString());
-                bundles.remove(info);
+                clusterBundles.remove(info);
             }
             obrService.removeRepository(url);
         }
 
-        // create an event and produce it
-        ObrUrlEvent event = new ObrUrlEvent(url, 
Constants.URL_REMOVE_EVENT_TYPE);
+        // broadcast a cluster event
+        ClusterObrUrlEvent event = new ClusterObrUrlEvent(url, 
Constants.URL_REMOVE_EVENT_TYPE);
         event.setSourceGroup(group);
         eventProducer.produce(event);
 

Reply via email to