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 2012/04/30 15:17:30 UTC

svn commit: r1332184 - in /karaf/cellar/branches/cellar-2.2.x: bundle/src/main/java/org/apache/karaf/cellar/bundle/ bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/ bundle/src/main/resources/OSGI-INF/blueprint/ config/src/main/java/org/apache...

Author: jbonofre
Date: Mon Apr 30 13:17:29 2012
New Revision: 1332184

URL: http://svn.apache.org/viewvc?rev=1332184&view=rev
Log:
[KARAF-1426] Fix handler checks

Modified:
    karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
    karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
    karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
    karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
    karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
    karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
    karaf/cellar/branches/cellar-2.2.x/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java
    karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
    karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java
    karaf/cellar/branches/cellar-2.2.x/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    karaf/cellar/branches/cellar-2.2.x/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/LocalEventListener.java
    karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/RemoteEventHandler.java
    karaf/cellar/branches/cellar-2.2.x/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java
    karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java
    karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java
    karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java
    karaf/cellar/branches/cellar-2.2.x/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java
    karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java
    karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
    karaf/cellar/branches/cellar-2.2.x/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/BundleSynchronizer.java Mon Apr 30 13:17:29 2012
@@ -106,7 +106,7 @@ public class BundleSynchronizer extends 
 
         // check if the producer is ON
         if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
-            LOGGER.warn("CELLAR BUNDLE: cluster event producer is OFF for this node");
+            LOGGER.warn("CELLAR BUNDLE: cluster event producer is OFF");
             return;
         }
 

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/LocalBundleListener.java Mon Apr 30 13:17:29 2012
@@ -43,7 +43,7 @@ public class LocalBundleListener extends
 
         // check if the producer is ON
         if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
-            LOGGER.warn("CELLAR BUNDLE: node is not part of the cluster event cluster group");
+            LOGGER.warn("CELLAR BUNDLE: cluster event producer is OFF");
             return;
         }
 

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/InstallBundleCommand.java Mon Apr 30 13:17:29 2012
@@ -52,7 +52,7 @@ public class InstallBundleCommand extend
 
         // check if the producer is started
         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;
         }
 

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StartBundleCommand.java Mon Apr 30 13:17:29 2012
@@ -52,7 +52,7 @@ public class StartBundleCommand extends 
 
         // 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;
         }
 

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/StopBundleCommand.java Mon Apr 30 13:17:29 2012
@@ -52,7 +52,7 @@ public class StopBundleCommand extends C
 
         // 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;
         }
 

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/java/org/apache/karaf/cellar/bundle/shell/UninstallBundleCommand.java Mon Apr 30 13:17:29 2012
@@ -52,7 +52,7 @@ public class UninstallBundleCommand exte
 
         // 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;
         }
 

Modified: karaf/cellar/branches/cellar-2.2.x/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.2.x/bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Apr 30 13:17:29 2012
@@ -15,7 +15,7 @@
 
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
-    <!-- Cluster Configuration Listener -->
+    <!-- Local Bundle Listener -->
     <bean id="bundleListener" class="org.apache.karaf.cellar.bundle.LocalBundleListener" init-method="init" destroy-method="destroy">
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>
@@ -24,7 +24,7 @@
         <property name="eventProducer" ref="eventProducer"/>
     </bean>
 
-    <!-- Configuration Synchronizer -->
+    <!-- Bundle Synchronizer -->
     <bean id="synchronizer" class="org.apache.karaf.cellar.bundle.BundleSynchronizer"
           init-method="init" destroy-method="destroy" depends-on="eventHandler">
         <property name="configurationAdmin" ref="configurationAdmin"/>
@@ -33,7 +33,9 @@
         <property name="eventProducer" ref="eventProducer"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
+    <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
 
+    <!-- Cluster Event Handler -->
     <bean id="eventHandler" class="org.apache.karaf.cellar.bundle.BundleEventHandler"
           init-method="init" destroy-method="destroy">
         <property name="configurationAdmin" ref="configurationAdmin"/>
@@ -41,15 +43,13 @@
         <property name="groupManager" ref="groupManager"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
-
-    <!-- OSGi Services  & References -->
     <service ref="eventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
         <service-properties>
             <entry key="managed" value="true"/>
          </service-properties>
     </service>
-    <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
 
+    <!-- Cluster Core Services -->
     <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
     <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>

Modified: karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationEventHandler.java Mon Apr 30 13:17:29 2012
@@ -53,11 +53,18 @@ public class ConfigurationEventHandler e
         if (event == null || event.getSourceGroup() == null || node == null || node.equals(event.getSourceNode()))
             return;
 
+        // check if the handler is ON
         if (eventSwitch.getStatus().equals(SwitchStatus.OFF)) {
             LOGGER.warn("CELLAR CONFIG: {} switch is OFF, cluster event not handled", SWITCH_ID);
             return;
         }
 
+        // check if the group is local
+        if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) {
+            LOGGER.warn("CELLAR CONFIG: node is not part of the event cluster group");
+            return;
+        }
+
         Group group = event.getSourceGroup();
         String groupName = group.getName();
 
@@ -102,7 +109,6 @@ public class ConfigurationEventHandler e
 
     }
 
-
     public Switch getSwitch() {
         return eventSwitch;
     }

Modified: karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/ConfigurationSynchronizer.java Mon Apr 30 13:17:29 2012
@@ -16,6 +16,7 @@ package org.apache.karaf.cellar.config;
 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.control.SwitchStatus;
 import org.apache.karaf.cellar.core.event.EventProducer;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.osgi.framework.InvalidSyntaxException;
@@ -38,12 +39,13 @@ public class ConfigurationSynchronizer e
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(ConfigurationSynchronizer.class);
 
-    private List<EventProducer> producerList;
+    private EventProducer eventProducer;
 
     /**
      * Constructor
      */
     public ConfigurationSynchronizer() {
+
     }
 
     /**
@@ -69,7 +71,7 @@ public class ConfigurationSynchronizer e
     }
 
     /**
-     * Reads the configuration from the remote map.
+     * Gets the configuration from the distributed map.
      */
     public void pull(Group group) {
         if (group != null) {
@@ -104,9 +106,16 @@ public class ConfigurationSynchronizer e
     }
 
     /**
-     * Publishses local configuration to the cluster.
+     * Publish local configuration to the cluster.
      */
     public void push(Group group) {
+
+        // check if the producer is ON
+        if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR CONFIG: cluster event producer is OFF");
+            return;
+        }
+
         if (group != null) {
             String groupName = group.getName();
             Map<String, Properties> configurationTable = clusterManager.getMap(Constants.CONFIGURATION_MAP + Configurations.SEPARATOR + groupName);
@@ -119,7 +128,7 @@ public class ConfigurationSynchronizer e
                     configs = configurationAdmin.listConfigurations(null);
                     for (Configuration conf : configs) {
                         String pid = conf.getPid();
-                        //Check if the pid is marked as local.
+                        // check if the pid is marked as local.
                         if (isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) {
                             Properties source = dictionaryToProperties(preparePush(filterDictionary(conf.getProperties())));
                             Properties target = configurationTable.get(pid);
@@ -137,22 +146,13 @@ public class ConfigurationSynchronizer e
                                     configurationTable.put(pid, target);
                                     if (requiresUpdate) {
                                         RemoteConfigurationEvent event = new RemoteConfigurationEvent(conf.getPid());
-                                        if (producerList != null && !producerList.isEmpty()) {
-                                            for (EventProducer producer : producerList) {
-                                                producer.produce(event);
-                                            }
-                                        }
-
+                                        eventProducer.produce(event);
                                     }
                                 }
                             } else {
                                 RemoteConfigurationEvent event = new RemoteConfigurationEvent(conf.getPid());
                                 configurationTable.put(pid, source);
-                                if (producerList != null && !producerList.isEmpty()) {
-                                    for (EventProducer producer : producerList) {
-                                        producer.produce(event);
-                                    }
-                                }
+                                eventProducer.produce(event);
                             }
                             LOGGER.debug("CELLAR CONFIG: publishing PID {} to the distributed map", pid);
                         } else LOGGER.warn("CELLAR CONFIG: configuration with PID {} is marked as BLOCKED OUTBOUND", pid);
@@ -171,7 +171,6 @@ public class ConfigurationSynchronizer e
     public Boolean isSyncEnabled(Group group) {
         Boolean result = Boolean.FALSE;
         String groupName = group.getName();
-
         try {
             Configuration configuration = configurationAdmin.getConfiguration(Configurations.GROUP);
             Dictionary<String, String> properties = configuration.getProperties();
@@ -186,12 +185,12 @@ public class ConfigurationSynchronizer e
         return result;
     }
 
-    public List<EventProducer> getProducerList() {
-        return producerList;
+    public EventProducer getEventProducer() {
+        return eventProducer;
     }
 
-    public void setProducerList(List<EventProducer> producerList) {
-        this.producerList = producerList;
+    public void setEventProducer(EventProducer eventProducer) {
+        this.eventProducer = eventProducer;
     }
 
 }

Modified: karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/LocalConfigurationListener.java Mon Apr 30 13:17:29 2012
@@ -16,6 +16,7 @@ package org.apache.karaf.cellar.config;
 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.osgi.framework.InvalidSyntaxException;
@@ -26,7 +27,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -38,9 +38,7 @@ public class LocalConfigurationListener 
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(LocalConfigurationListener.class);
 
-    private List<EventProducer> producerList;
-
-    private Node node;
+    private EventProducer eventProducer;
 
     /**
      * Handle local configuration events.
@@ -49,23 +47,30 @@ public class LocalConfigurationListener 
      * @param event
      */
     public void configurationEvent(ConfigurationEvent event) {
+
+        // check if the producer is ON
+        if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR CONFIG: cluster event producer is OFF");
+            return;
+        }
+
         String pid = event.getPid();
 
         Set<Group> groups = groupManager.listLocalGroups();
 
         if (groups != null && !groups.isEmpty()) {
             for (Group group : groups) {
-                //Check if the pid is allowed for outbound.
+                // check if the pid is allowed for outbound.
                 if (isAllowed(group, Constants.CATEGORY, pid, EventType.OUTBOUND)) {
+
+                    // update the distributed map
+                    push(pid, group);
+
+                    // broadcast the cluster event
                     RemoteConfigurationEvent configurationEvent = new RemoteConfigurationEvent(pid);
                     configurationEvent.setSourceGroup(group);
-                    configurationEvent.setSourceNode(node);
-                    push(pid, group);
-                    if (producerList != null && !producerList.isEmpty()) {
-                        for (EventProducer producer : producerList) {
-                            producer.produce(configurationEvent);
-                        }
-                    }
+                    configurationEvent.setSourceNode(clusterManager.getNode());
+                    eventProducer.produce(configurationEvent);
                 } else LOGGER.warn("CELLAR CONFIG: configuration with PID {} is marked as BLOCKED OUTBOUND", pid);
             }
         }
@@ -76,10 +81,8 @@ public class LocalConfigurationListener 
      *
      * @param pid
      */
-
     protected void push(String pid, Group group) {
         String groupName = group.getName();
-
         Map<String, Properties> configurationTable = clusterManager.getMap(Constants.CONFIGURATION_MAP + Configurations.SEPARATOR + groupName);
         try {
             Configuration[] configurations = configurationAdmin.listConfigurations("(service.pid=" + pid + ")");
@@ -98,9 +101,7 @@ public class LocalConfigurationListener 
      * Initialization Method.
      */
     public void init() {
-        if (clusterManager != null) {
-            node = clusterManager.getNode();
-        }
+
     }
 
     /**
@@ -110,12 +111,12 @@ public class LocalConfigurationListener 
 
     }
 
-    public List<EventProducer> getProducerList() {
-        return producerList;
+    public EventProducer getEventProducer() {
+        return eventProducer;
     }
 
-    public void setProducerList(List<EventProducer> producerList) {
-        this.producerList = producerList;
+    public void setEventProducer(EventProducer eventProducer) {
+        this.eventProducer = eventProducer;
     }
 
 }

Modified: karaf/cellar/branches/cellar-2.2.x/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.2.x/config/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Apr 30 13:17:29 2012
@@ -15,14 +15,15 @@
   -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
-    <!-- Cluster Configuration Listener -->
+    <!-- Local Configuration Listener -->
     <bean id="configurationListener" class="org.apache.karaf.cellar.config.LocalConfigurationListener" init-method="init"
           destroy-method="destroy">
-        <property name="producerList" ref="groupEventProducers"/>
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
+        <property name="eventProducer" ref="eventProducer"/>
     </bean>
+    <service ref="configurationListener" interface="org.osgi.service.cm.ConfigurationListener"/>
 
     <!-- Configuration Synchronizer -->
     <bean id="synchronizer" class="org.apache.karaf.cellar.config.ConfigurationSynchronizer"
@@ -30,28 +31,27 @@
         <property name="configurationAdmin" ref="configurationAdmin"/>
         <property name="groupManager" ref="groupManager"/>
         <property name="clusterManager" ref="clusterManager"/>
-        <property name="producerList" ref="groupEventProducers"/>
+        <property name="eventProducer" ref="eventProducer"/>
     </bean>
+    <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
 
+    <!-- Cluster Event Handler -->
     <bean id="eventHandler" class="org.apache.karaf.cellar.config.ConfigurationEventHandler"
           init-method="init" destroy-method="destroy">
-        <property name="configurationAdmin" ref="configurationAdmin"/>
         <property name="clusterManager" ref="clusterManager"/>
+        <property name="groupManager" ref="groupManager"/>
+        <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
-
-    <!-- OSGi Services  & References -->
-    <service ref="configurationListener" interface="org.osgi.service.cm.ConfigurationListener"/>
-    <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
     <service ref="eventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
         <service-properties>
             <entry key="managed" value="true"/>
         </service-properties>
     </service>
 
+    <!-- Cluster Core Services -->
     <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
     <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-    <reference-list id="groupEventProducers" member-type="service-object"
-                    interface="org.apache.karaf.cellar.core.event.EventProducer" filter="(type=group)"/>
+    <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
 
 </blueprint>

Modified: karaf/cellar/branches/cellar-2.2.x/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.2.x/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Apr 30 13:17:29 2012
@@ -22,36 +22,36 @@
         <property name="bundleContext" ref="blueprintBundleContext"/>
         <property name="eventTransportFactory" ref="eventTransportFactory"/>
     </bean>
+    <service ref="importListener" interface="org.osgi.framework.hooks.service.ListenerHook"/>
 
     <!-- Export Service Listener -->
-    <bean id="exportistener" class="org.apache.karaf.cellar.dosgi.ExportServiceListener" init-method="init" destroy-method="destroy">
+    <bean id="exportListener" class="org.apache.karaf.cellar.dosgi.ExportServiceListener" init-method="init" destroy-method="destroy">
         <property name="clusterManager" ref="clusterManager"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
         <property name="eventTransportFactory" ref="eventTransportFactory"/>
     </bean>
 
-    <bean id="remoterServiceCallHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler">
+    <!-- Cluster Event Handler -->
+    <bean id="remoteServiceCallHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler">
         <property name="clusterManager" ref="clusterManager"/>
         <property name="eventTransportFactory" ref="eventTransportFactory"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
+    <service ref="remoteServiceCallHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
+        <service-properties>
+            <entry key="managed" value="true"/>
+        </service-properties>
+    </service>
 
-    <bean id="remoteServiceResultlHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceResultHandler">
+    <!-- Cluster Event Handler -->
+    <bean id="remoteServiceResultHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceResultHandler">
         <property name="commandStore" ref="commandStore"/>
     </bean>
+    <service ref="remoteServiceResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
-    <!-- Service References -->
+    <!-- Cluster Core Services -->
     <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <reference id="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
     <reference id="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/>
 
-    <!-- Services -->
-    <service ref="importListener" interface="org.osgi.framework.hooks.service.ListenerHook"/>
-    <service ref="remoterServiceCallHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
-        <service-properties>
-            <entry key="managed" value="true"/>
-        </service-properties>
-    </service>
-    <service ref="remoteServiceResultlHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
 </blueprint>

Modified: karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/LocalEventListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/LocalEventListener.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/LocalEventListener.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/LocalEventListener.java Mon Apr 30 13:17:29 2012
@@ -15,6 +15,7 @@ package org.apache.karaf.cellar.event;
 
 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.osgi.service.event.Event;
@@ -31,12 +32,17 @@ public class LocalEventListener extends 
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(LocalEventListener.class);
 
-    private List<EventProducer> producerList;
-
-    private Node node;
+    private EventProducer eventProducer;
 
     @Override
     public void handleEvent(Event event) {
+
+        // check if the producer is ON
+        if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR EVENT: cluster event producer is OFF");
+            return;
+        }
+
         try {
             if (event != null && event.getTopic() != null) {
                 Set<Group> groups = null;
@@ -60,18 +66,10 @@ public class LocalEventListener extends 
                         String topicName = event.getTopic();
                         Map<String, Serializable> properties = getEventProperties(event);
                         if (isAllowed(group, Constants.CATEGORY, topicName, EventType.OUTBOUND)) {
+                            // broascast the event
                             RemoteEvent remoteEvent = new RemoteEvent(topicName, properties);
                             remoteEvent.setSourceGroup(group);
-                            remoteEvent.setSourceNode(node);
-                            
-                            LOGGER.debug("CELLAR EVENT: broadcast event {}", topicName);
-
-                            // broadcast the event
-                            if (producerList != null && !producerList.isEmpty()) {
-                                for (EventProducer producer : producerList) {
-                                    producer.produce(remoteEvent);
-                                }
-                            }
+                            eventProducer.produce(remoteEvent);
                         } else LOGGER.warn("CELLAR EVENT: event {} is marked as BLOCKED OUTBOUND", topicName);
                     }
                 }
@@ -85,9 +83,7 @@ public class LocalEventListener extends 
      * Initialization method.
      */
     public void init() {
-        if (clusterManager != null) {
-            node = clusterManager.getNode();
-        }
+
     }
 
     /**
@@ -97,12 +93,12 @@ public class LocalEventListener extends 
 
     }
 
-    public List<EventProducer> getProducerList() {
-        return producerList;
+    public EventProducer getEventProducer() {
+        return eventProducer;
     }
 
-    public void setProducerList(List<EventProducer> producerList) {
-        this.producerList = producerList;
+    public void setEventProducer(EventProducer eventProducer) {
+        this.eventProducer = eventProducer;
     }
 
 }

Modified: karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/RemoteEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/RemoteEventHandler.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/RemoteEventHandler.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/event/src/main/java/org/apache/karaf/cellar/event/RemoteEventHandler.java Mon Apr 30 13:17:29 2012
@@ -16,6 +16,7 @@ package org.apache.karaf.cellar.event;
 import org.apache.karaf.cellar.core.Node;
 import org.apache.karaf.cellar.core.control.BasicSwitch;
 import org.apache.karaf.cellar.core.control.Switch;
+import org.apache.karaf.cellar.core.control.SwitchStatus;
 import org.apache.karaf.cellar.core.event.Event;
 import org.apache.karaf.cellar.core.event.EventHandler;
 import org.apache.karaf.cellar.core.event.EventType;
@@ -32,11 +33,21 @@ public class RemoteEventHandler extends 
     public static final String SWITCH_ID = "org.apache.karaf.cellar.event.handler";
     private final Switch eventSwitch = new BasicSwitch(SWITCH_ID);
 
-    private Node node;
-
     public void handle(RemoteEvent event) {
+
+        // check if the handler is ON
+        if (eventSwitch.getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR EVENT: {} is OFF, cluster event not handled", SWITCH_ID);
+            return;
+        }
+
+        // check if the group is a local one
+        if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) {
+            LOGGER.warn("CELLAR EVENT: node is not part of the event cluster group");
+            return;
+        }
+
         try {
-            // check if the pid is marked as local
             if (isAllowed(event.getSourceGroup(), Constants.CATEGORY, event.getTopicName(), EventType.INBOUND)) {
                 Map<String, Serializable> properties = event.getProperties();
                 properties.put(Constants.EVENT_PROCESSED_KEY, Constants.EVENT_PROCESSED_VALUE);
@@ -53,9 +64,7 @@ public class RemoteEventHandler extends 
      * Initialization method.
      */
     public void init() {
-        if (clusterManager != null) {
-            node = clusterManager.getNode();
-        }
+
     }
 
     /**

Modified: karaf/cellar/branches/cellar-2.2.x/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.2.x/event/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Apr 30 13:17:29 2012
@@ -15,22 +15,13 @@
   -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
-    <!-- Cluster Configuration Listener -->
+    <!-- Local Event Listener -->
     <bean id="localEventListener" class="org.apache.karaf.cellar.event.LocalEventListener" init-method="init" destroy-method="destroy">
-        <property name="producerList" ref="groupEventProducers"/>
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
+        <property name="eventProducer" ref="eventProducer"/>
     </bean>
-
-    <!-- Event Handler -->
-    <bean id="remoteEventHandler" class="org.apache.karaf.cellar.event.RemoteEventHandler" init-method="init" destroy-method="destroy">
-        <property name="configurationAdmin" ref="configurationAdmin"/>
-        <property name="clusterManager" ref="clusterManager"/>
-        <property name="eventAdmin" ref="eventAdmin"/>
-    </bean>
-
-    <!-- OSGi Service & References -->
     <service ref="localEventListener">
         <interfaces>
             <value>org.osgi.service.event.EventHandler</value>
@@ -44,18 +35,24 @@
         </service-properties>
     </service>
 
+    <!-- Cluster Event Handler -->
+    <bean id="remoteEventHandler" class="org.apache.karaf.cellar.event.RemoteEventHandler" init-method="init" destroy-method="destroy">
+        <property name="clusterManager" ref="clusterManager"/>
+        <property name="groupManager" ref="groupManager"/>
+        <property name="configurationAdmin" ref="configurationAdmin"/>
+        <property name="eventAdmin" ref="eventAdmin"/>
+    </bean>
     <service ref="remoteEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
         <service-properties>
             <entry key="managed" value="true"/>
         </service-properties>
     </service>
 
+    <!-- Cluster Core Services -->
     <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
     <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
     <reference id="eventAdmin" interface="org.osgi.service.event.EventAdmin" />
     <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
-    <reference-list id="groupEventProducers" member-type="service-object"
-        interface="org.apache.karaf.cellar.core.event.EventProducer" filter="(type=group)"/>
 
 </blueprint>
\ No newline at end of file

Modified: karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesEventHandler.java Mon Apr 30 13:17:29 2012
@@ -49,12 +49,19 @@ public class FeaturesEventHandler extend
      * @param event
      */
     public void handle(RemoteFeaturesEvent event) {
+
         // check if the handler switch is ON
         if (eventSwitch.getStatus().equals(SwitchStatus.OFF)) {
             LOGGER.warn("CELLAR FEATURES: {} switch is OFF, cluster event is not handled", SWITCH_ID);
             return;
         }
 
+        // check if the group is local
+        if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) {
+            LOGGER.warn("CELLAR FEATURES: node is not part of the event cluster group");
+            return;
+        }
+
         String name = event.getName();
         String version = event.getVersion();
         if (isAllowed(event.getSourceGroup(), Constants.FEATURES_CATEGORY, name, EventType.INBOUND) || event.getForce()) {

Modified: karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java Mon Apr 30 13:17:29 2012
@@ -41,8 +41,6 @@ public class FeaturesSynchronizer extend
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(FeaturesSynchronizer.class);
 
-    private List<EventProducer> producerList;
-
     /**
      * Initialization method
      */
@@ -71,7 +69,6 @@ public class FeaturesSynchronizer extend
      */
     public void pull(Group group) {
         if (group != null) {
-            LOGGER.info("CELLAR FEATURES: Pulling features from group {}.",group.getName());
             String groupName = group.getName();
             List<String> repositories = clusterManager.getList(Constants.REPOSITORIES + Configurations.SEPARATOR + groupName);
             Map<FeatureInfo, Boolean> features = clusterManager.getMap(Constants.FEATURES + Configurations.SEPARATOR + groupName);
@@ -93,7 +90,7 @@ public class FeaturesSynchronizer extend
                     }
                 }
 
-                //Retrieve remote feautre status.
+                // retrieve remote feature status.
                 if (features != null && !features.isEmpty()) {
                     for (FeatureInfo info : features.keySet()) {
                         String name = info.getName();
@@ -129,7 +126,7 @@ public class FeaturesSynchronizer extend
     }
 
     /**
-     * Pushes features to the cluster.
+     * Push features to the cluster.
      */
     public void push(Group group) {
         if (group != null) {
@@ -192,15 +189,6 @@ public class FeaturesSynchronizer extend
         return result;
     }
 
-    public List<EventProducer> getProducerList() {
-        return producerList;
-    }
-
-    public void setProducerList(List<EventProducer> producerList) {
-        this.producerList = producerList;
-    }
-
-
     public ClusterManager getCollectionManager() {
         return clusterManager;
     }

Modified: karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/LocalFeaturesListener.java Mon Apr 30 13:17:29 2012
@@ -15,6 +15,7 @@ package org.apache.karaf.cellar.features
 
 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;
@@ -33,7 +34,7 @@ public class LocalFeaturesListener exten
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(LocalFeaturesListener.class);
 
-    private List<EventProducer> producerList;
+    private EventProducer eventProducer;
 
     @Override
     public void init() {
@@ -51,6 +52,13 @@ public class LocalFeaturesListener exten
      * @param event
      */
     public void featureEvent(FeatureEvent event) {
+
+        // check if the producer is ON
+        if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR FEATURES: cluster event producer is OFF");
+            return;
+        }
+
         if (event != null) {
             Set<Group> groups = groupManager.listLocalGroups();
 
@@ -64,22 +72,17 @@ public class LocalFeaturesListener exten
                     if (isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND)) {
                         FeatureEvent.EventType type = event.getType();
 
-                        //Check the event type.
-                        //This is required because upon reception of the even the feature service considers the feature uninstalled.
+                        // update the distributed map
                         if (FeatureEvent.EventType.FeatureInstalled.equals(event.getType())) {
                             pushFeature(event.getFeature(), group, true);
                         } else {
                             pushFeature(event.getFeature(), group, false);
                         }
 
+                        // broadcast the cluster event
                         RemoteFeaturesEvent featureEvent = new RemoteFeaturesEvent(name, version, type);
                         featureEvent.setSourceGroup(group);
-                        //TODO: Choose group producer.
-                        if (producerList != null && !producerList.isEmpty()) {
-                            for (EventProducer producer : producerList) {
-                                producer.produce(featureEvent);
-                            }
-                        }
+                        eventProducer.produce(featureEvent);
                     } else LOGGER.warn("CELLAR FEATURES: feature {} is marked as BLOCKED OUTBOUND", name);
                 }
             }
@@ -92,6 +95,13 @@ public class LocalFeaturesListener exten
      * @param event
      */
     public void repositoryEvent(RepositoryEvent event) {
+
+        // check if the producer is ON
+        if (eventProducer.getSwitch().getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR FEATURES: cluster event producer is OFF");
+            return;
+        }
+
         if (event != null && event.getRepository() != null) {
             Set<Group> groups = groupManager.listLocalGroups();
 
@@ -101,27 +111,26 @@ public class LocalFeaturesListener exten
                     repositoryEvent.setSourceGroup(group);
                     RepositoryEvent.EventType type = event.getType();
 
+                    // update the distributed map
                     if(RepositoryEvent.EventType.RepositoryAdded.equals(type)){
                         pushRepository(event.getRepository(), group);
                     } else {
                         removeRepository(event.getRepository(),group);
                     }
-                    if (producerList != null && !producerList.isEmpty()) {
-                        for (EventProducer producer : producerList) {
-                            producer.produce(repositoryEvent);
-                        }
-                    }
+
+                    // broadcast the cluster event
+                    eventProducer.produce(repositoryEvent);
                 }
             }
         }
     }
 
-    public List<EventProducer> getProducerList() {
-        return producerList;
+    public EventProducer getEventProducer() {
+        return eventProducer;
     }
 
-    public void setProducerList(List<EventProducer> producerList) {
-        this.producerList = producerList;
+    public void setEventProducer(EventProducer eventProducer) {
+        this.eventProducer = eventProducer;
     }
 
 }

Modified: karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/features/src/main/java/org/apache/karaf/cellar/features/RepositoryEventHandler.java Mon Apr 30 13:17:29 2012
@@ -45,11 +45,19 @@ public class RepositoryEventHandler exte
     }
 
     public void handle(RemoteRepositoryEvent event) {
+
+        // check if the handler is ON
         if (eventSwitch.getStatus().equals(SwitchStatus.OFF)) {
             LOGGER.warn("CELLAR FEATURES: {} switch is OFF, cluster event is not handled", SWITCH_ID);
             return;
         }
 
+        // check if the group is local
+        if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) {
+            LOGGER.warn("CELLAR FEATURES: node is not part of the event cluster group");
+            return;
+        }
+
         String uri = event.getId();
         RepositoryEvent.EventType type = event.getType();
         try {

Modified: karaf/cellar/branches/cellar-2.2.x/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.2.x/features/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Apr 30 13:17:29 2012
@@ -17,56 +17,53 @@
     <!-- Cluster Configuration Listener -->
     <bean id="featuresListener" class="org.apache.karaf.cellar.features.LocalFeaturesListener" init-method="init"
           destroy-method="destroy">
-        <property name="featuresService" ref="featuresService"/>
-        <property name="producerList" ref="groupEventProducers"/>
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>
+        <property name="eventProducer" ref="eventProducer"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
+        <property name="featuresService" ref="featuresService"/>
     </bean>
+    <service ref="featuresListener" interface="org.apache.karaf.features.FeaturesListener"/>
 
     <!-- Features/Repositories Synchronizer -->
     <bean id="synchronizer" class="org.apache.karaf.cellar.features.FeaturesSynchronizer"
           init-method="init" destroy-method="destroy">
-        <property name="featuresService" ref="featuresService"/>
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>
-        <property name="producerList" ref="groupEventProducers"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
+        <property name="featuresService" ref="featuresService"/>
     </bean>
+    <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
 
     <!-- Features Handler -->
     <bean id="featuresHandler" class="org.apache.karaf.cellar.features.FeaturesEventHandler"
           init-method="init" destroy-method="destroy">
-        <property name="featuresService" ref="featuresService"/>
         <property name="clusterManager" ref="clusterManager"/>
+        <property name="groupManager" ref="groupManager"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
-    </bean>
-
-    <!-- Repository Handler -->
-    <bean id="repositoryHandler" class="org.apache.karaf.cellar.features.RepositoryEventHandler"
-          init-method="init" destroy-method="destroy">
         <property name="featuresService" ref="featuresService"/>
-        <property name="clusterManager" ref="clusterManager"/>
-        <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
-
-    <!-- OSGi Services  & References -->
-    <service ref="featuresListener" interface="org.apache.karaf.features.FeaturesListener"/>
-    <service ref="synchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
     <service ref="featuresHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
         <service-properties>
             <entry key="managed" value="true"/>
         </service-properties>
     </service>
 
+    <!-- Repository Handler -->
+    <bean id="repositoryHandler" class="org.apache.karaf.cellar.features.RepositoryEventHandler"
+          init-method="init" destroy-method="destroy">
+        <property name="clusterManager" ref="clusterManager"/>
+        <property name="groupManager" ref="groupManager"/>
+        <property name="configurationAdmin" ref="configurationAdmin"/>
+        <property name="featuresService" ref="featuresService"/>
+    </bean>
     <service ref="repositoryHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
+
+    <!-- Cluster Core Services -->
     <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
-    <reference id="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
     <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
     <reference id="featuresService" interface="org.apache.karaf.features.FeaturesService"/>
     <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-    <reference-list id="groupEventProducers" member-type="service-object"
-                    interface="org.apache.karaf.cellar.core.event.EventProducer" filter="(type=group)"/>
 
 </blueprint>

Modified: karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrBundleEventHandler.java Mon Apr 30 13:17:29 2012
@@ -18,6 +18,7 @@ import org.apache.felix.bundlerepository
 import org.apache.felix.bundlerepository.Resource;
 import org.apache.karaf.cellar.core.control.BasicSwitch;
 import org.apache.karaf.cellar.core.control.Switch;
+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.osgi.framework.Bundle;
@@ -108,6 +109,19 @@ public class ObrBundleEventHandler exten
      */
     @Override
     public void handle(ObrBundleEvent event) {
+
+        // check if the handler is ON
+        if (eventSwitch.getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR OBR: {} switch is OFF, cluster event not handled", SWITCH_ID);
+            return;
+        }
+
+        // check if the group is local
+        if (!groupManager.isLocalGroup(event.getSourceGroup().getName())) {
+            LOGGER.warn("CELLAR OBR: node is not part of the event cluster group");
+            return;
+        }
+
         String bundleId = event.getBundleId();
         try {
             if (isAllowed(event.getSourceGroup(), Constants.BUNDLES_CONFIG_CATEGORY, bundleId, EventType.INBOUND)) {

Modified: karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlEventHandler.java Mon Apr 30 13:17:29 2012
@@ -15,6 +15,7 @@ package org.apache.karaf.cellar.obr;
 
 import org.apache.karaf.cellar.core.control.BasicSwitch;
 import org.apache.karaf.cellar.core.control.Switch;
+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.slf4j.Logger;
@@ -48,6 +49,19 @@ public class ObrUrlEventHandler extends 
      */
     @Override
     public void handle(ObrUrlEvent obrUrlEvent) {
+
+        // check if the handler is ON
+        if (eventSwitch.getStatus().equals(SwitchStatus.OFF)) {
+            LOGGER.warn("CELLAR OBR: {} switch is OFF, cluster event not handled", SWITCH_ID);
+            return;
+        }
+
+        // check if the group is local
+        if (!groupManager.isLocalGroup(obrUrlEvent.getSourceGroup().getName())) {
+            LOGGER.warn("CELLAR OBR: node is not part of the event cluster group");
+            return;
+        }
+
         String url = obrUrlEvent.getUrl();
         String groupName = obrUrlEvent.getSourceGroup().getName();
         try {

Modified: karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/obr/src/main/java/org/apache/karaf/cellar/obr/ObrUrlSynchronizer.java Mon Apr 30 13:17:29 2012
@@ -35,8 +35,6 @@ public class ObrUrlSynchronizer extends 
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(ObrUrlSynchronizer.class);
 
-    private List<EventProducer> producerList;
-
     public void init() {
         super.init();
         Set<Group> groups = groupManager.listLocalGroups();
@@ -130,12 +128,4 @@ public class ObrUrlSynchronizer extends 
         return result;
     }
 
-    public List<EventProducer> getProducerList() {
-        return producerList;
-    }
-
-    public void setProducerList(List<EventProducer> producerList) {
-        this.producerList = producerList;
-    }
-
 }

Modified: karaf/cellar/branches/cellar-2.2.x/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1332184&r1=1332183&r2=1332184&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.2.x/obr/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Apr 30 13:17:29 2012
@@ -22,6 +22,11 @@
         <property name="groupManager" ref="groupManager"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
+    <service ref="obrBundleEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
+        <service-properties>
+            <entry key="managed" value="true"/>
+        </service-properties>
+    </service>
 
     <!-- OBR URL Synchronizer -->
     <bean id="obrUrlSynchronizer" class="org.apache.karaf.cellar.obr.ObrUrlSynchronizer"
@@ -29,9 +34,9 @@
         <property name="obrService" ref="repositoryAdmin"/>
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>
-        <property name="producerList" ref="groupEventProducers"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
+    <service ref="obrUrlSynchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
 
     <!-- OBR URL Event Handler -->
     <bean id="obrUrlEventHandler" class="org.apache.karaf.cellar.obr.ObrUrlEventHandler"
@@ -41,30 +46,17 @@
         <property name="groupManager" ref="groupManager"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
-
-    <!-- OBR Bundle Event Handler OSGi service -->
-    <service ref="obrBundleEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
-        <service-properties>
-            <entry key="managed" value="true"/>
-        </service-properties>
-    </service>
-
-    <!-- OBR OSGi service -->
-    <service ref="obrUrlSynchronizer" interface="org.apache.karaf.cellar.core.Synchronizer"/>
     <service ref="obrUrlEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
         <service-properties>
             <entry key="managed" value="true"/>
         </service-properties>
     </service>
 
-    <!-- service references -->
+    <!-- Cluster Core Services -->
     <reference id="repositoryAdmin" interface="org.apache.felix.bundlerepository.RepositoryAdmin"/>
     <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
     <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-    <reference id="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
     <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
-    <reference-list id="groupEventProducers" member-type="service-object"
-                    interface="org.apache.karaf.cellar.core.event.EventProducer" filter="(type=group)"/>
 
 </blueprint>
\ No newline at end of file