karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1475763 - in /karaf/cellar/branches/cellar-2.3.x/hazelcast/src: main/java/org/apache/karaf/cellar/hazelcast/ main/java/org/apache/karaf/cellar/hazelcast/factory/ main/java/org/apache/karaf/cellar/hazelcast/merge/ main/resources/OSGI-INF/bl...
Date Thu, 25 Apr 2013 13:36:12 GMT
Author: jbonofre
Date: Thu Apr 25 13:36:12 2013
New Revision: 1475763

URL: http://svn.apache.org/r1475763
Log:
Code cleanup.

Modified:
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarExtender.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarMembershipListener.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/Constants.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastBundleListener.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastClusterManager.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastInstanceAware.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastNode.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueConsumer.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueProducer.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicProducer.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastConfigurationManager.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/merge/CellarMergePolicy.java
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    karaf/cellar/branches/cellar-2.3.x/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarExtender.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarExtender.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarExtender.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarExtender.java Thu Apr 25 13:36:12 2013
@@ -16,6 +16,9 @@ package org.apache.karaf.cellar.hazelcas
 import org.apache.karaf.cellar.core.utils.CombinedClassLoader;
 import org.osgi.framework.BundleContext;
 
+/**
+ * Cellar extender.
+ */
 public class CellarExtender  {
 
     private HazelcastBundleListener hazelcastBundleListener;
@@ -44,4 +47,5 @@ public class CellarExtender  {
     public void setCombinedClassLoader(CombinedClassLoader combinedClassLoader) {
         this.combinedClassLoader = combinedClassLoader;
     }
+
 }

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarMembershipListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarMembershipListener.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarMembershipListener.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/CellarMembershipListener.java Thu Apr 25 13:36:12 2013
@@ -41,6 +41,7 @@ public class CellarMembershipListener ex
         instance.getCluster().addMembershipListener(this);
     }
 
+    @Override
     public void memberAdded(MembershipEvent membershipEvent) {
         Member member = membershipEvent.getMember();
         try {
@@ -66,6 +67,7 @@ public class CellarMembershipListener ex
         }
     }
 
+    @Override
     public void memberRemoved(MembershipEvent membershipEvent) {
         // nothing to do
     }

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/Constants.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/Constants.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/Constants.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/Constants.java Thu Apr 25 13:36:12 2013
@@ -14,7 +14,7 @@
 package org.apache.karaf.cellar.hazelcast;
 
 /**
- * Hazelcast constants.
+ * Hazelcast configuration constants.
  */
 public class Constants {
 

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastBundleListener.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastBundleListener.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastBundleListener.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastBundleListener.java Thu Apr 25 13:36:12 2013
@@ -18,18 +18,19 @@ import org.osgi.framework.*;
 
 import java.util.Dictionary;
 
+/**
+ * Hazelcast bundle listener.
+ */
 public class HazelcastBundleListener implements SynchronousBundleListener {
 
     private BundleContext bundleContext;
     private CombinedClassLoader combinedClassLoader;
 
-
     public HazelcastBundleListener(BundleContext bundleContext, CombinedClassLoader combinedClassLoader) {
         this.bundleContext = bundleContext;
         this.combinedClassLoader = combinedClassLoader;
     }
 
-
     public void scanExistingBundles() {
         Bundle[] bundles = bundleContext.getBundles();
         for (Bundle bundle : bundles) {

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastClusterManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastClusterManager.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastClusterManager.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastClusterManager.java Thu Apr 25 13:36:12 2013
@@ -29,7 +29,7 @@ import java.util.Map;
 import java.util.Set;
 
 /**
- * Hazelcast cluster manager.
+ * A cluster manager implementation powered by Hazelcast.
  */
 public class HazelcastClusterManager extends HazelcastInstanceAware implements ClusterManager {
 
@@ -41,39 +41,44 @@ public class HazelcastClusterManager ext
     private CombinedClassLoader combinedClassLoader;
 
     /**
-     * Returns a named distributed map.
+     * Get a Map in Hazelcast.
      *
-     * @param mapName
-     * @return
+     * @param mapName the Map name.
+     * @return the Map.
      */
+    @Override
     public Map getMap(String mapName) {
         return instance.getMap(mapName);
     }
 
     /**
-     * Returns a named distributed list.
+     * Get a List in Hazelcast.
      *
-     * @param listName
-     * @return
+     * @param listName the List name.
+     * @return the List.
      */
+    @Override
     public List getList(String listName) {
         return instance.getList(listName);
     }
 
     /**
-     * Returns a named distributed set.
-     * @param setName
-     * @return
+     * Get a Set in Hazelcast.
+     *
+     * @param setName the Set name.
+     * @return the Set.
      */
+    @Override
     public Set getSet(String setName) {
         return instance.getSet(setName);
-    }    
+    }
 
     /**
-     * Returns the list of Hazelcast Nodes.
+     * Get the list of nodes in Hazelcast.
      *
-     * @return
+     * @return a Set containing the nodes.
      */
+    @Override
     public Set<Node> listNodes() {
         Set<Node> nodes = new HashSet<Node>();
 
@@ -90,14 +95,13 @@ public class HazelcastClusterManager ext
         return nodes;
     }
 
-
-
     /**
-     * Returns the {@code Node}s with the corresponding ids.
+     * Get the nodes with given IDs in Hazelcast.
      *
-     * @param ids
-     * @return
+     * @param ids the collection of node IDs.
+     * @return a Set containing the nodes.
      */
+    @Override
     public Set<Node> listNodes(Collection<String> ids) {
         Set<Node> nodes = new HashSet<Node>();
         if (ids != null && !ids.isEmpty()) {
@@ -118,11 +122,12 @@ public class HazelcastClusterManager ext
     }
 
     /**
-     * Returns the {@code Node} with the corresponding id.
+     * Get a node identified by an ID.
      *
-     * @param id
-     * @return
+     * @param id the node ID.
+     * @return the node.
      */
+    @Override
     public Node findNodeById(String id) {
         if (id != null) {
             Cluster cluster = instance.getCluster();
@@ -141,15 +146,23 @@ public class HazelcastClusterManager ext
         return null;
     }
 
+    /**
+     * Get the nodes in a cluster group.
+     *
+     * @param group the cluster group.
+     * @return a Set containing the nodes in the cluster group.
+     */
+    @Override
     public Set<Node> listNodesByGroup(Group group) {
         return group.getNodes();
     }
 
     /**
-     * Generate an id.
+     * Generate an unique ID.
      *
-     * @return
+     * @return the unique ID.
      */
+    @Override
     public synchronized String generateId() {
         if (idgenerator == null) {
             idgenerator = instance.getIdGenerator(GENERATOR_ID);
@@ -157,16 +170,19 @@ public class HazelcastClusterManager ext
         return String.valueOf(idgenerator.newId());
     }
 
+    @Override
     public void start() {
-
+        // nothing to do
     }
 
+    @Override
     public void stop() {
         if (instance != null && instance.getLifecycleService().isRunning()) {
             instance.getLifecycleService().shutdown();
         }
     }
 
+    @Override
     public void restart() {
         if (instance != null && instance.getLifecycleService().isRunning()) {
             instance.getLifecycleService().restart();

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastEventTransportFactory.java Thu Apr 25 13:36:12 2013
@@ -21,9 +21,9 @@ import org.apache.karaf.cellar.core.even
 import org.apache.karaf.cellar.core.event.EventTransportFactory;
 import org.apache.karaf.cellar.core.utils.CombinedClassLoader;
 
-import java.util.HashMap;
-import java.util.Map;
-
+/**
+ * A cluster event transport factory powered by Hazelcast.
+ */
 public class HazelcastEventTransportFactory extends HazelcastInstanceAware implements EventTransportFactory {
 
     private Dispatcher dispatcher;
@@ -32,42 +32,42 @@ public class HazelcastEventTransportFact
     @Override
     public EventProducer getEventProducer(String name, Boolean pubsub) {
         if (pubsub) {
-                ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
-                TopicProducer producer = new TopicProducer();
-                producer.setInstance(instance);
-                producer.setTopic(topic);
-                producer.setNode(getNode());
-                producer.init();
-                return producer;
+            ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
+            TopicProducer producer = new TopicProducer();
+            producer.setInstance(instance);
+            producer.setTopic(topic);
+            producer.setNode(getNode());
+            producer.init();
+            return producer;
         } else {
-                IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
-                QueueProducer producer = new QueueProducer();
-                producer.setQueue(queue);
-                producer.setNode(getNode());
-                producer.init();
-                return producer;
+            IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
+            QueueProducer producer = new QueueProducer();
+            producer.setQueue(queue);
+            producer.setNode(getNode());
+            producer.init();
+            return producer;
         }
     }
 
     @Override
     public EventConsumer getEventConsumer(String name, Boolean pubsub) {
         if (pubsub) {
-                ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
-                TopicConsumer consumer = new TopicConsumer();
-                consumer.setTopic(topic);
-                consumer.setInstance(instance);
-                consumer.setNode(getNode());
-                consumer.setDispatcher(dispatcher);
-                consumer.init();
-                return consumer;
+            ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
+            TopicConsumer consumer = new TopicConsumer();
+            consumer.setTopic(topic);
+            consumer.setInstance(instance);
+            consumer.setNode(getNode());
+            consumer.setDispatcher(dispatcher);
+            consumer.init();
+            return consumer;
         } else {
-                IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
-                QueueConsumer consumer = new QueueConsumer(combinedClassLoader);
-                consumer.setQueue(queue);
-                consumer.setNode(getNode());
-                consumer.setDispatcher(dispatcher);
-                consumer.init();
-                return consumer;
+            IQueue queue = instance.getQueue(Constants.QUEUE + Constants.SEPARATOR + name);
+            QueueConsumer consumer = new QueueConsumer(combinedClassLoader);
+            consumer.setQueue(queue);
+            consumer.setNode(getNode());
+            consumer.setDispatcher(dispatcher);
+            consumer.init();
+            return consumer;
         }
     }
 

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastGroupManager.java Thu Apr 25 13:36:12 2013
@@ -42,7 +42,8 @@ import org.osgi.service.cm.Configuration
 import org.slf4j.Logger;
 
 /**
- * Hazelcast group manager.
+ * A group manager implementation powered by Hazelcast.
+ * <p/>
  * The role of this class is to provide means of creating groups, setting nodes to groups etc.
  * Keep in sync the distributed group configuration with the locally persisted.
  */
@@ -89,7 +90,7 @@ public class HazelcastGroupManager imple
                 }
             }
         } catch (IOException e) {
-            LOGGER.warn("CELLAR HAZELCAST: can't create group from configuration admin", e);
+            LOGGER.warn("CELLAR HAZELCAST: failed to create cluster group from configuration", e);
         }
         try {
             // add group membership from configuration
@@ -108,7 +109,7 @@ public class HazelcastGroupManager imple
                 }
             }
         } catch (IOException e) {
-            LOGGER.error("CELLAR HAZELCAST: can't set group membership for the current node", e);
+            LOGGER.error("CELLAR HAZELCAST: failed to set cluster membership for the local node", e);
         }
     }
 
@@ -153,6 +154,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Group createGroup(String groupName) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -168,7 +170,7 @@ public class HazelcastGroupManager imple
                     // store the group list to configuration admin
                     persist(listGroups());
                 } catch (Exception e) {
-                    LOGGER.warn("CELLAR HAZELCAST: can't store group list", e);
+                    LOGGER.warn("CELLAR HAZELCAST: failed to store cluster groups list", e);
                 }
             }
             return group;
@@ -177,6 +179,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public void deleteGroup(String groupName) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -187,7 +190,7 @@ public class HazelcastGroupManager imple
                     // store the group list to configuration admin
                     persist(listGroups());
                 } catch (Exception e) {
-                    LOGGER.warn("CELLAR HAZELCAST: can't store group list", e);
+                    LOGGER.warn("CELLAR HAZELCAST: failed to store cluster groups list", e);
                 }
             }
         } finally {
@@ -213,6 +216,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Set<Group> listLocalGroups() {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -223,6 +227,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public boolean isLocalGroup(String groupName) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -239,6 +244,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Set<Group> listAllGroups() {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -249,6 +255,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Group findGroupByName(String groupName) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -259,6 +266,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Map<String, Group> listGroups() {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -269,6 +277,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Set<Group> listGroups(Node node) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -290,6 +299,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Set<String> listGroupNames() {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -300,6 +310,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public Set<String> listGroupNames(Node node) {
         Set<String> names = new HashSet<String>();
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
@@ -320,6 +331,7 @@ public class HazelcastGroupManager imple
         return names;
     }
 
+    @Override
     public void registerGroup(Group group) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -327,7 +339,7 @@ public class HazelcastGroupManager imple
             String groupName = group.getName();
             createGroup(groupName);
 
-            LOGGER.info("Registering group {}.", groupName);
+            LOGGER.info("CELLAR HAZELCAST: registering cluster group {}", groupName);
             Properties serviceProperties = new Properties();
             serviceProperties.put("type", "group");
             serviceProperties.put("name", groupName);
@@ -376,7 +388,7 @@ public class HazelcastGroupManager imple
                 properties.put(Configurations.GROUPS_KEY, groups);
                 configuration.update(properties);
             } catch (IOException e) {
-                LOGGER.error("Error reading group configuration {}", group);
+                LOGGER.error("CELLAR HAZELCAST: failed to read cluster group configuration", e);
             }
 
             // launch the synchronization on the group
@@ -393,13 +405,14 @@ public class HazelcastGroupManager imple
                     }
                 }
             } catch (InvalidSyntaxException e) {
-                LOGGER.error("Error looking up for synchronizers.", e);
+                LOGGER.error("CELLAR HAZELCAST: failed to look for synchronizers", e);
             }
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
         }
     }
 
+    @Override
     public void registerGroup(String groupName) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -414,6 +427,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public void unRegisterGroup(String groupName) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -424,6 +438,7 @@ public class HazelcastGroupManager imple
         }
     }
 
+    @Override
     public void unRegisterGroup(Group group) {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
         try {
@@ -433,7 +448,7 @@ public class HazelcastGroupManager imple
             group.getNodes().remove(getNode());
             listGroups().put(groupName, group);
 
-            // unregister group consumers
+            // un-register cluster group consumers
             if (consumerRegistrations != null && !consumerRegistrations.isEmpty()) {
                 ServiceRegistration consumerRegistration = consumerRegistrations.get(groupName);
                 if (consumerRegistration != null) {
@@ -442,7 +457,7 @@ public class HazelcastGroupManager imple
                 }
             }
 
-            // unregister group producers
+            // un-register cluster group producers
             if (producerRegistrations != null && !producerRegistrations.isEmpty()) {
                 ServiceRegistration producerRegistration = producerRegistrations.get(groupName);
                 if (producerRegistration != null) {
@@ -451,7 +466,7 @@ public class HazelcastGroupManager imple
                 }
             }
 
-            // remove Consumers & Producers
+            // remove consumers & producers
             groupProducers.remove(groupName);
             EventConsumer consumer = groupConsumer.remove(groupName);
             if (consumer != null) {
@@ -473,7 +488,7 @@ public class HazelcastGroupManager imple
                 properties.put(Configurations.GROUPS_KEY, groups);
                 configuration.update(properties);
             } catch (IOException e) {
-                LOGGER.error("Error reading group configuration {}", group);
+                LOGGER.error("CELLAR HAZELCAST: failed to read cluster group configuration", e);
             }
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
@@ -481,12 +496,12 @@ public class HazelcastGroupManager imple
     }
 
     /**
-     * Copies the configuration of a {@link Group}.
-     * <b>1.</b> Updates configuration admin from Hazelcast using source config.
-     * <b>2.</b> Creates target configuration both on Hazelcast and configuration admin.
+     * Copy the configuration of a cluster {@link Group}.
+     * <b>1.</b> Update configuration admin from Hazelcast using source config.
+     * <b>2.</b> Create target configuration both on Hazelcast and configuration admin.
      *
-     * @param sourceGroupName
-     * @param targetGroupName
+     * @param sourceGroupName the source cluster group.
+     * @param targetGroupName the target cluster group.
      */
     public void copyGroupConfiguration(String sourceGroupName, String targetGroupName) {
         try {
@@ -499,10 +514,10 @@ public class HazelcastGroupManager imple
                     configAdminProperties = new Properties();
                 }
                 // get configuration from Hazelcast
-                Map<String, String> sourceGropConfig = instance.getMap(GROUPS_CONFIG);
+                Map<String, String> sourceGroupConfig = instance.getMap(GROUPS_CONFIG);
 
                 // update local configuration from cluster.
-                for (Map.Entry<String, String> parentEntry : sourceGropConfig.entrySet()) {
+                for (Map.Entry<String, String> parentEntry : sourceGroupConfig.entrySet()) {
                     configAdminProperties.put(parentEntry.getKey(), parentEntry.getValue());
                 }
 
@@ -515,7 +530,7 @@ public class HazelcastGroupManager imple
                     if (key.startsWith(sourceGroupName)) {
                         String newKey = key.replace(sourceGroupName, targetGroupName);
                         updatedProperties.put(newKey, value);
-                        sourceGropConfig.put(key, value);
+                        sourceGroupConfig.put(key, value);
                     }
                     updatedProperties.put(key, value);
                 }
@@ -524,15 +539,15 @@ public class HazelcastGroupManager imple
             }
 
         } catch (IOException e) {
-            LOGGER.error("Error reading group configuration.", e);
+            LOGGER.error("CELLAR HAZELCAST: failed to read cluster group configuration", e);
         }
     }
 
     /**
-     * Utility method which converts a set to a String.
+     * Util method to convert a Set to a String.
      *
-     * @param set
-     * @return
+     * @param set the Set to convert.
+     * @return the resulting String.
      */
     protected String convertSetToString(Set<String> set) {
         StringBuffer result = new StringBuffer();
@@ -548,14 +563,14 @@ public class HazelcastGroupManager imple
     }
 
     /**
-     * Utility method which converts String to Set.
+     * Util method to convert a String to a Set.
      *
-     * @param string
-     * @return
+     * @param string the String to convert.
+     * @return the resulting Set.
      */
     protected Set<String> convertStringToSet(String string) {
-    	if (string == null)
-    		return Collections.EMPTY_SET;
+        if (string == null)
+            return Collections.EMPTY_SET;
 
         Set<String> result = new HashSet<String>();
         String[] groupNames = string.split(",");
@@ -570,7 +585,7 @@ public class HazelcastGroupManager imple
         return result;
     }
 
-
+    @Override
     public void configurationEvent(ConfigurationEvent configurationEvent) {
         String pid = configurationEvent.getPid();
         if (pid.equals(GROUPS)) {
@@ -588,7 +603,7 @@ public class HazelcastGroupManager imple
                     }
                 }
             } catch (Exception e) {
-                LOGGER.warn("Failed to update group configuration");
+                LOGGER.warn("CELLAR HAZELCAST: failed to update group configuration", e);
             }
         }
     }
@@ -598,6 +613,7 @@ public class HazelcastGroupManager imple
      *
      * @param entryEvent entry event
      */
+    @Override
     public void entryAdded(EntryEvent entryEvent) {
         entryUpdated(entryEvent);
     }
@@ -607,6 +623,7 @@ public class HazelcastGroupManager imple
      *
      * @param entryEvent entry event
      */
+    @Override
     public void entryRemoved(EntryEvent entryEvent) {
         entryUpdated(entryEvent);
     }
@@ -616,6 +633,7 @@ public class HazelcastGroupManager imple
      *
      * @param entryEvent entry event
      */
+    @Override
     public void entryUpdated(EntryEvent entryEvent) {
         try {
             Configuration conf = configurationAdmin.getConfiguration(GROUPS);
@@ -627,7 +645,7 @@ public class HazelcastGroupManager imple
                 conf.update(props);
             }
         } catch (Exception ex) {
-            LOGGER.warn("Error while updating local group configuration", ex);
+            LOGGER.warn("CELLAR HAZELCAST: failed to update local group configuration", ex);
         }
     }
 
@@ -636,11 +654,11 @@ public class HazelcastGroupManager imple
      *
      * @param entryEvent entry event
      */
+    @Override
     public void entryEvicted(EntryEvent entryEvent) {
         entryUpdated(entryEvent);
     }
 
-
     public HazelcastInstance getInstance() {
         return instance;
     }

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastInstanceAware.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastInstanceAware.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastInstanceAware.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastInstanceAware.java Thu Apr 25 13:36:12 2013
@@ -1,3 +1,16 @@
+/*
+ * 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.hazelcast;
 
 import com.hazelcast.core.Cluster;
@@ -5,6 +18,9 @@ import com.hazelcast.core.HazelcastInsta
 import com.hazelcast.core.Member;
 import org.apache.karaf.cellar.core.Node;
 
+/**
+ * Hazelcast instance aware generic.
+ */
 public class HazelcastInstanceAware {
 
     protected HazelcastInstance instance;
@@ -17,10 +33,10 @@ public class HazelcastInstanceAware {
         this.instance = null;
     }
 
-        /**
-     * Returns the node on which the command was run.
+    /**
+     * Get the local node.
      *
-     * @return
+     * @return the local node.
      */
     public Node getNode() {
         Cluster cluster = instance.getCluster();

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastNode.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastNode.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastNode.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/HazelcastNode.java Thu Apr 25 13:36:12 2013
@@ -16,7 +16,7 @@ package org.apache.karaf.cellar.hazelcas
 import org.apache.karaf.cellar.core.Node;
 
 /**
- * Hazelcast cluster node.
+ * Node implementation powered by Hazelcast.
  */
 public class HazelcastNode implements Node {
 
@@ -25,12 +25,6 @@ public class HazelcastNode implements No
     private String host;
     private int port;
 
-    /**
-     * Constructor
-     *
-     * @param host
-     * @param port
-     */
     public HazelcastNode(String host, int port) {
         StringBuilder builder = new StringBuilder();
         this.host = host;
@@ -38,10 +32,12 @@ public class HazelcastNode implements No
         this.id = builder.append(host).append(":").append(port).toString();
     }
 
+    @Override
     public String getId() {
         return id;
     }
 
+    @Override
     public String getHost() {
         return host;
     }
@@ -50,6 +46,7 @@ public class HazelcastNode implements No
         this.host = host;
     }
 
+    @Override
     public int getPort() {
         return port;
     }

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueConsumer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueConsumer.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueConsumer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueConsumer.java Thu Apr 25 13:36:12 2013
@@ -36,7 +36,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 /**
- * Consumes messages from the distributed {@code ITopic} and calls the {@code EventDispatcher}.
+ * Consumes messages from the Hazelcast {@code IQueue} and calls the {@code EventDispatcher}.
  */
 public class QueueConsumer<E extends Event> implements EventConsumer<E>, ItemListener<E>, Runnable {
 
@@ -57,15 +57,13 @@ public class QueueConsumer<E extends Eve
     private ConfigurationAdmin configurationAdmin;
 
     public QueueConsumer() {
+        // nothing to do
     }
 
     public QueueConsumer(CombinedClassLoader combinedClassLoader) {
         this.combinedClassLoader = combinedClassLoader;
     }
 
-    /**
-     * Initialization method.
-     */
     public void init() {
         if (queue != null) {
             queue.addItemListener(this, true);
@@ -76,9 +74,6 @@ public class QueueConsumer<E extends Eve
         executorService.execute(this);
     }
 
-    /**
-     * Destruction method.
-     */
     public void destroy() {
         isConsuming = false;
         if (queue != null) {
@@ -106,17 +101,18 @@ public class QueueConsumer<E extends Eve
                 }
             }
         } catch (Exception ex) {
-            LOGGER.error("CELLAR HAZELCAST: error while consuming from queue", ex);
+            LOGGER.error("CELLAR HAZELCAST: failed to consume from queue", ex);
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
         }
     }
 
     /**
-     * Consumes an event form the topic.
+     * Consume a cluster event from the queue.
      *
-     * @param event
+     * @param event the cluster event.
      */
+    @Override
     public void consume(E event) {
         if (event != null && (this.getSwitch().getStatus().equals(SwitchStatus.ON) || event.getForce())) {
             dispatcher.dispatch(event);
@@ -144,12 +140,12 @@ public class QueueConsumer<E extends Eve
 
     @Override
     public void itemAdded(ItemEvent<E> event) {
-
+        // nothing to do
     }
 
     @Override
     public void itemRemoved(ItemEvent<E> event) {
-
+        // nothing to do
     }
 
     public Dispatcher getDispatcher() {
@@ -176,6 +172,7 @@ public class QueueConsumer<E extends Eve
         this.queue = queue;
     }
 
+    @Override
     public Switch getSwitch() {
         // load the switch status from the config
         try {

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueProducer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueProducer.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueProducer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/QueueProducer.java Thu Apr 25 13:36:12 2013
@@ -43,7 +43,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Produces {@code Event}s into the distributed {@code ITopic}.
+ * Produces cluster {@code Event}s into the Hazelcast {@code IQueue}.
  */
 public class QueueProducer<E extends Event> implements EventProducer<E> {
 
@@ -58,26 +58,22 @@ public class QueueProducer<E extends Eve
     private Node node;
     private ConfigurationAdmin configurationAdmin;
 
-    /**
-     * Initialization method.
-     */
     public void init() {
         if (queue == null) {
             queue = instance.getQueue(Constants.QUEUE);
         }
     }
 
-    /**
-     * Destruction method.
-     */
     public void destroy() {
+        // nothing to do
     }
 
     /**
-     * Propagates an event into the distributed {@code ITopic}.
+     * Propagate a cluster event into the Hazelcast {@code IQueue}.
      *
-     * @param event
+     * @param event the cluster event to produce.
      */
+    @Override
     public void produce(E event) {
         if (this.getSwitch().getStatus().equals(SwitchStatus.ON) || event.getForce() || event instanceof Result) {
             event.setSourceNode(node);
@@ -93,6 +89,7 @@ public class QueueProducer<E extends Eve
         }
     }
 
+    @Override
     public Switch getSwitch() {
         // load the switch status from the config
         try {

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java Thu Apr 25 13:36:12 2013
@@ -31,7 +31,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Consumes messages from the distributed {@code ITopic} and calls the {@code EventDispatcher}.
+ * Consumes messages from the Hazelcast {@code ITopic} and calls the {@code EventDispatcher}.
  */
 public class TopicConsumer<E extends Event> implements EventConsumer<E>, MessageListener<E> {
 
@@ -49,9 +49,6 @@ public class TopicConsumer<E extends Eve
 
     private boolean isConsuming;
 
-    /**
-     * Initialization method.
-     */
     public void init() {
         if (topic == null) {
             topic = instance.getTopic(Constants.TOPIC);
@@ -59,20 +56,18 @@ public class TopicConsumer<E extends Eve
         start();
     }
 
-    /**
-     * Destruction method.
-     */
     public void destroy() {
         stop();
     }
 
     /**
-     * Consumes an event form the topic.
+     * Consume a cluster event form the topic.
      *
-     * @param event
+     * @param event the cluster event.
      */
+    @Override
     public void consume(E event) {
-        //Check if event has a specified destination.
+        // check if event has a specified destination.
         if ((event.getDestination() == null || event.getDestination().contains(node)) && (this.getSwitch().getStatus().equals(SwitchStatus.ON) || event.getForce())) {
             dispatcher.dispatch(event);
         } else {
@@ -107,6 +102,7 @@ public class TopicConsumer<E extends Eve
         return isConsuming;
     }
 
+    @Override
     public void onMessage(Message<E> message) {
         consume(message.getMessageObject());
     }
@@ -135,6 +131,7 @@ public class TopicConsumer<E extends Eve
         this.topic = topic;
     }
 
+    @Override
     public Switch getSwitch() {
         // load the switch status from the config
         try {

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicProducer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicProducer.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicProducer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicProducer.java Thu Apr 25 13:36:12 2013
@@ -29,7 +29,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Produces {@code Event}s into the distributed {@code ITopic}.
+ * Produces cluster {@code Event}s into the Hazelcast {@code ITopic}.
  */
 public class TopicProducer<E extends Event> implements EventProducer<E> {
 
@@ -44,26 +44,22 @@ public class TopicProducer<E extends Eve
     private Node node;
     private ConfigurationAdmin configurationAdmin;
 
-    /**
-     * Initialization method.
-     */
     public void init() {
         if (topic == null) {
             topic = instance.getTopic(Constants.TOPIC);
         }
     }
 
-    /**
-     * Destruction method.
-     */
     public void destroy() {
+        // nothing to do
     }
 
     /**
-     * Propagates an event into the distributed {@code ITopic}.
+     * Propagates a cluster event into the distributed {@code ITopic}.
      *
-     * @param event
+     * @param event the cluster event.
      */
+    @Override
     public void produce(E event) {
         if (this.getSwitch().getStatus().equals(SwitchStatus.ON) || event.getForce() || event instanceof Result) {
             event.setSourceNode(node);
@@ -75,6 +71,7 @@ public class TopicProducer<E extends Eve
         }
     }
 
+    @Override
     public Switch getSwitch() {
         // load the switch status from the config
         try {

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastConfigurationManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastConfigurationManager.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastConfigurationManager.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastConfigurationManager.java Thu Apr 25 13:36:12 2013
@@ -13,17 +13,12 @@
  */
 package org.apache.karaf.cellar.hazelcast.factory;
 
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 import com.hazelcast.config.Config;
-import com.hazelcast.config.GroupConfig;
-import com.hazelcast.config.MulticastConfig;
 import com.hazelcast.config.TcpIpConfig;
 import com.hazelcast.config.XmlConfigBuilder;
-import com.hazelcast.core.HazelcastInstance;
 import org.apache.karaf.cellar.core.discovery.Discovery;
 import org.apache.karaf.cellar.core.utils.CellarUtils;
 import org.slf4j.Logger;
@@ -38,9 +33,9 @@ public class HazelcastConfigurationManag
     private Set<String> discoveredMemberSet = new LinkedHashSet<String>();
 
      /**
-     * Builds a Hazelcast {@link com.hazelcast.config.Config}
+     * Build a Hazelcast {@link com.hazelcast.config.Config}.
      *
-     * @return
+     * @return the Hazelcast config.
      */
     public Config getHazelcastConfig() {
         System.setProperty("hazelcast.config", xmlConfigLocation);
@@ -64,7 +59,7 @@ public class HazelcastConfigurationManag
             if (properties.containsKey(Discovery.DISCOVERED_MEMBERS_PROPERTY_NAME)) {
                 Set<String> newDiscoveredMemberSet = CellarUtils.createSetFromString((String) properties.get(Discovery.DISCOVERED_MEMBERS_PROPERTY_NAME));
                 if (!CellarUtils.collectionEquals(discoveredMemberSet, newDiscoveredMemberSet)) {
-                    LOGGER.info("Hazelcast discoveredMemberSet has been changed from {} to {}", discoveredMemberSet, newDiscoveredMemberSet);
+                    LOGGER.info("CELLAR HAZELCAST: Hazelcast discoveredMemberSet has been changed from {} to {}", discoveredMemberSet, newDiscoveredMemberSet);
                     discoveredMemberSet = newDiscoveredMemberSet;
                     updated = Boolean.TRUE;
                 }
@@ -73,9 +68,6 @@ public class HazelcastConfigurationManag
         return updated;
     }
 
-	/**
-	 * @return the discoveredMemberSet
-	 */
 	public Set<String> getDiscoveredMemberSet() {
 		return discoveredMemberSet;
 	}

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java Thu Apr 25 13:36:12 2013
@@ -29,7 +29,7 @@ import com.hazelcast.core.Hazelcast;
 import com.hazelcast.core.HazelcastInstance;
 
 /**
- * A factory for a Hazelcast Instance, which integration with OSGi Service Registry and Config Admin.
+ * A factory for Hazelcast instance, integrating with OSGi ServiceRegistry and ConfigAdmin.
  */
 public class HazelcastServiceFactory  {
 
@@ -43,7 +43,6 @@ public class HazelcastServiceFactory  {
     private CountDownLatch instanceLatch = new CountDownLatch(1);
     private HazelcastInstance instance;
 
-
     public void init() {
         if (combinedClassLoader != null) {
             combinedClassLoader.addBundle(bundleContext.getBundle());
@@ -83,9 +82,9 @@ public class HazelcastServiceFactory  {
     }
 
     /**
-     * Returs a Hazelcast instance from service registry.
+     * Get the Hazelcast instance.
      *
-     * @return
+     * @return the Hazelcast instance.
      */
     public HazelcastInstance getInstance() throws InterruptedException {
         if (instance == null) {
@@ -97,9 +96,9 @@ public class HazelcastServiceFactory  {
     }
 
     /**
-     * Builds a {@link HazelcastInstance}
+     * Build a {@link HazelcastInstance}.
      *
-     * @return
+     * @return the Hazelcast instance.
      */
     private HazelcastInstance buildInstance() {
         if(combinedClassLoader != null) {

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/merge/CellarMergePolicy.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/merge/CellarMergePolicy.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/merge/CellarMergePolicy.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/merge/CellarMergePolicy.java Thu Apr 25 13:36:12 2013
@@ -1,3 +1,16 @@
+/*
+ * 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.hazelcast.merge;
 
 import java.util.LinkedHashSet;
@@ -6,27 +19,31 @@ import java.util.List;
 import java.util.Set;
 import com.hazelcast.core.MapEntry;
 import com.hazelcast.merge.MergePolicy;
-import org.apache.karaf.cellar.core.Group;
 import org.apache.karaf.cellar.core.MultiNode;
 import org.apache.karaf.cellar.core.utils.CellarUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * A Cellar custom Hazelcast merge policy.
+ */
 public class CellarMergePolicy  implements MergePolicy {
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(CellarMergePolicy.class);
+
     /**
-     * Returns the value of the entry after the merge
+     * Return the value of the entry after the merge
      * of entries with the same key. Returning value can be
      * You should consider the case where existingEntry is null.
      *
-     * @param mapName       name of the map
-     * @param mergingEntry  entry merging into the destination cluster
+     * @param mapName name of the map
+     * @param mergingEntry entry merging into the destination cluster
      * @param existingEntry existing entry in the destination cluster
      * @return final value of the entry. If returns null then no change on the entry.
      */
+    @Override
     public Object merge(String mapName, MapEntry mergingEntry, MapEntry existingEntry) {
-        LOGGER.info("Cellar merge policy triggered merging entry {}, existing entry {}",mergingEntry,existingEntry);
+        LOGGER.info("CELLAR HAZELCAST: merge policy triggered merging entry {}, existing entry {}",mergingEntry,existingEntry);
         Object mergingDataValue = mergingEntry != null ? mergingEntry.getValue() : null;
         Object existingDataValue = existingEntry != null ? existingEntry.getValue() : null;
 
@@ -38,7 +55,7 @@ public class CellarMergePolicy  implemen
             return existingDataValue;
         }
 
-        //Merge MultiNodes by merging their members.
+        // merge multi-nodes by merging their members.
         else if(MultiNode.class.isAssignableFrom(mergingDataValue.getClass())
                 && MultiNode.class.isAssignableFrom(existingDataValue.getClass())) {
 
@@ -69,23 +86,22 @@ public class CellarMergePolicy  implemen
     }
 
     /**
-     * Merges Sets.
-     * @param mergingSet
-     * @param existingSet
-     * @param <T>
-     * @return
+     * Merge Sets.
+     * @param mergingSet the first Set to merge.
+     * @param existingSet the second Set to merge.
+     * @return a Set resulting of the merge of the two others.
      */
     public <T> Set<T> merge(Set<T> mergingSet, Set<T> existingSet) {
        Set<T> result = new LinkedHashSet<T>();
 
-       //Copy new Set.
+       // copy new Set
        if(mergingSet != null && !mergingSet.isEmpty()) {
            for(T obj:mergingSet) {
                result.add(obj);
            }
        }
 
-       //Copy existing Set.
+       // copy existing Set
        if(existingSet != null && !existingSet.isEmpty()) {
            for(T obj:existingSet) {
                result.add(obj);
@@ -95,25 +111,24 @@ public class CellarMergePolicy  implemen
        return result;
     }
 
-
     /**
-     * Merges Lists.
-     * @param mergingList
-     * @param existingList
-     * @param <T>
-     * @return
+     * Merge Lists.
+     *
+     * @param mergingList the first List to merge.
+     * @param existingList the second List to merge.
+     * @return a List resulting of the merge of the two others.
      */
     public <T> List<T> merge(List<T> mergingList, List<T> existingList) {
        List<T> result = new LinkedList<T>();
 
-       //Copy existing List.
+       // copy existing List
        if(existingList != null && !existingList.isEmpty()) {
            for(T obj:existingList) {
                result.add(obj);
            }
        }
 
-       //Copy new List.
+       // copy new List
        if(mergingList != null && !mergingList.isEmpty()) {
            for(T obj:mergingList) {
                result.add(obj);
@@ -124,10 +139,11 @@ public class CellarMergePolicy  implemen
     }
 
     /**
-     * Merges Strings.
-     * @param mergingString
-     * @param existingString
-     * @return
+     * Merge Strings.
+     *
+     * @param mergingString the first String to merge.
+     * @param existingString the second String to merge.
+     * @return a String resulting of the merge of the two others.
      */
     public String merge(String mergingString, String existingString) {
        String result = existingString;
@@ -139,4 +155,5 @@ public class CellarMergePolicy  implemen
        }
        return result;
     }
+
 }

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/main/resources/OSGI-INF/blueprint/blueprint.xml Thu Apr 25 13:36:12 2013
@@ -16,10 +16,12 @@
            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
            xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
 
-    <!-- Hazelcast hazelcast -->
+    <!-- Hazelcast Instance -->
     <bean id="hazelcast" class="com.hazelcast.core.Hazelcast" factory-ref="instanceFactory"
           factory-method="getInstance" destroy-method="shutdown"/>
+    <service ref="hazelcast" interface="com.hazelcast.core.HazelcastInstance"/>
 
+    <!-- Hazelcast Instance Factory -->
     <bean id="instanceFactory" class="org.apache.karaf.cellar.hazelcast.factory.HazelcastServiceFactory"
           init-method="init" destroy-method="destroy">
         <property name="combinedClassLoader" ref="combinedClassLoader"/>
@@ -35,6 +37,7 @@
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
 
+    <!-- Membership Listener -->
     <bean id="membershipListener" class="org.apache.karaf.cellar.hazelcast.CellarMembershipListener">
         <argument index="0" ref="hazelcast"/>
         <property name="synchronizers" ref="synchronizers"/>
@@ -47,6 +50,7 @@
         <property name="configurationAdmin" ref="configurationAdmin"/>
         <property name="combinedClassLoader" ref="combinedClassLoader"/>
     </bean>
+    <service ref="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
 
     <!-- Group Manager -->
     <bean id="groupManager" class="org.apache.karaf.cellar.hazelcast.HazelcastGroupManager" init-method="init"
@@ -57,31 +61,41 @@
         <property name="combinedClassLoader" ref="combinedClassLoader"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
+    <service ref="groupManager">
+        <interfaces>
+            <value>org.apache.karaf.cellar.core.GroupManager</value>
+            <value>org.osgi.service.cm.ConfigurationListener</value>
+        </interfaces>
+    </service>
 
+    <!-- Event Transport Factory -->
     <bean id="eventTransportFactory" class="org.apache.karaf.cellar.hazelcast.HazelcastEventTransportFactory">
         <property name="dispatcher" ref="dispatcher"/>
         <property name="instance" ref="hazelcast"/>
         <property name="combinedClassLoader" ref="combinedClassLoader"/>
     </bean>
+    <service ref="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
 
+    <!-- Cellar Extender -->
     <bean id="cellarExtender" class="org.apache.karaf.cellar.hazelcast.CellarExtender" init-method="init"
           destroy-method="destroy">
         <property name="combinedClassLoader" ref="combinedClassLoader"/>
         <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
 
+    <!-- Bundle Combined ClassLoader -->
     <bean id="combinedClassLoader" class="org.apache.karaf.cellar.core.utils.CombinedClassLoader" init-method="init"
           destroy-method="destroy"/>
 
-    <!-- Hazelcast Cluster and Node -->
+    <!-- Local Node -->
     <bean id="node" factory-ref="clusterManager" factory-method="getNode"/>
 
-    <!-- The distributed topic -->
+    <!-- Cluster Event Topic -->
     <bean id="eventTopic" factory-ref="hazelcast" factory-method="getTopic">
         <argument value="org.apache.karaf.cellar.event.topic"/>
     </bean>
 
-    <!-- Consumer -->
+    <!-- Cluster Event Consumer -->
     <bean id="consumer" class="org.apache.karaf.cellar.hazelcast.TopicConsumer" init-method="init"
           destroy-method="destroy">
         <property name="instance" ref="hazelcast"/>
@@ -90,108 +104,95 @@
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
 
-    <!-- Producer -->
+    <!-- Cluster Event Producer -->
     <bean id="producer" class="org.apache.karaf.cellar.hazelcast.TopicProducer" init-method="init">
         <property name="instance" ref="hazelcast"/>
         <property name="node" ref="node"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
+    <service ref="producer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
 
+    <!-- Execution Context -->
     <bean id="executionContext" class="org.apache.karaf.cellar.core.command.ClusteredExecutionContext">
         <property name="producer" ref="producer"/>
         <property name="commandStore" ref="commandStore"/>
     </bean>
+    <service ref="executionContext" interface="org.apache.karaf.cellar.core.command.ExecutionContext"/>
 
-    <!-- Producer Switch Handler -->
+    <!-- Handler For Cluster Prodducer Switch Command Event -->
     <bean id="producerSwitchCommandHandler" class="org.apache.karaf.cellar.core.control.ProducerSwitchCommandHandler">
         <property name="producer" ref="producer"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
+    <service ref="producerSwitchCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
+    <!-- Handler For Cluster Producer Switch Result Event -->
     <bean id="producerSwitchResultHandler" class="org.apache.karaf.cellar.core.control.ProducerSwitchResultHandler">
         <property name="commandStore" ref="commandStore"/>
     </bean>
+    <service ref="producerSwitchResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
-    <!-- Consumer Switch Event Handler -->
+    <!-- Handler For Cluster Consumer Switch Command Event -->
     <bean id="consumerSwitchCommandHandler" class="org.apache.karaf.cellar.core.control.ConsumerSwitchCommandHandler">
         <property name="producer" ref="producer"/>
         <property name="consumer" ref="consumer"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
+    <service ref="consumerSwitchCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
+    <!-- Handler For Cluster Consumer Switch Result Event -->
     <bean id="consumerSwitchResultHandler" class="org.apache.karaf.cellar.core.control.ConsumerSwitchResultHandler">
         <property name="commandStore" ref="commandStore"/>
     </bean>
+    <service ref="consumerSwitchResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
-    <!-- Managed Handlers Command Handlers -->
+    <!-- Handler For Cluster Manager Handlers Command Event -->
     <bean id="manageHandlersCommandHandler" class="org.apache.karaf.cellar.core.control.ManageHandlersCommandHandler">
         <property name="producer" ref="producer"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
+    <service ref="manageHandlersCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
+    <!-- Handler For Cluster Manage Handlers Result Event -->
     <bean id="manageHandlersResultHandler" class="org.apache.karaf.cellar.core.control.ManageHandlersResultHandler">
         <property name="commandStore" ref="commandStore"/>
     </bean>
+    <service ref="manageHandlersResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
-    <!-- Managed Group Command Handlers -->
+    <!-- Handler For Manager Group Command Event -->
     <bean id="manageGroupCommandHandler" class="org.apache.karaf.cellar.core.control.ManageGroupCommandHandler">
         <property name="producer" ref="producer"/>
         <property name="clusterManager" ref="clusterManager"/>
         <property name="groupManager" ref="groupManager"/>
     </bean>
+    <service ref="manageGroupCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
+    <!-- Handler For Manage Group Result Event -->
     <bean id="manageGroupResultHandler" class="org.apache.karaf.cellar.core.control.ManageGroupResultHandler">
         <property name="commandStore" ref="commandStore"/>
     </bean>
+    <service ref="manageGroupResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
 
     <!-- Command Store -->
     <bean id="commandStore" class="org.apache.karaf.cellar.core.command.BasicCommandStore"/>
+    <service ref="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/>
 
+    <!-- Cluster Event Dispatcher -->
     <bean id="dispatcher" class="org.apache.karaf.cellar.core.event.EventHandlerRegistryDispatcher" init-method="init">
         <property name="handlerRegistry" ref="registry"/>
     </bean>
 
-    <!-- Hazelcast Instance Service-->
-    <service ref="hazelcast" interface="com.hazelcast.core.HazelcastInstance"/>
-
-    <service ref="producer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
-
-    <service ref="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
-    <service ref="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
-    <service ref="executionContext" interface="org.apache.karaf.cellar.core.command.ExecutionContext"/>
-    <service ref="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/>
-
-    <service ref="groupManager">
-        <interfaces>
-            <value>org.apache.karaf.cellar.core.GroupManager</value>
-            <value>org.osgi.service.cm.ConfigurationListener</value>
-        </interfaces>
-    </service>
-
-    <!-- Event Handler Service -->
-    <service ref="consumerSwitchCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <service ref="consumerSwitchResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <service ref="producerSwitchCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <service ref="producerSwitchResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <service ref="manageHandlersCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <service ref="manageHandlersResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <service ref="manageGroupCommandHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <service ref="manageGroupResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-
     <reference id="registry" interface="org.apache.karaf.cellar.core.event.EventHandlerRegistry"/>
     <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
 
     <reference-list id="discoveryServices" availability="optional"
                     interface="org.apache.karaf.cellar.core.discovery.DiscoveryService"/>
-
-    <!-- Group Consumer & Producer Serices -->
     <reference-list id="groupEventProducers" availability="optional"
                     interface="org.apache.karaf.cellar.core.event.EventProducer"
                     filter="(type = group)"/>
     <reference-list id="groupEventConsumers" availability="optional"
                     interface="org.apache.karaf.cellar.core.event.EventConsumer"
                     filter="(type = group)"/>
-
     <reference-list id="synchronizers" availability="optional" interface="org.apache.karaf.cellar.core.Synchronizer"/>
 
 </blueprint>

Modified: karaf/cellar/branches/cellar-2.3.x/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java?rev=1475763&r1=1475762&r2=1475763&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/hazelcast/src/test/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactoryTest.java Thu Apr 25 13:36:12 2013
@@ -15,31 +15,14 @@ package org.apache.karaf.cellar.hazelcas
 
 import com.hazelcast.core.Hazelcast;
 import com.hazelcast.core.HazelcastInstance;
-import org.junit.After;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
-import java.util.Properties;
-
-/**
- * Hazelcast service factory test.
- */
 @RunWith(JUnit4.class)
 public class HazelcastServiceFactoryTest {
 
-    @Before
-    public void setUp() throws Exception {
-
-    }
-
-    @After
-    public void tearDown() throws Exception {
-
-    }
-
     @Test
     public void testDefaultInstance() throws InterruptedException {
         HazelcastServiceFactory factory = new HazelcastServiceFactory();



Mime
View raw message