Author: jbonofre
Date: Sat Aug  4 16:13:43 2012
New Revision: 1369356

URL: http://svn.apache.org/viewvc?rev=1369356&view=rev
Log:
[KARAF-1707] CellarNodeMBean now populates a local flag in the node list

Modified:
    
karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarNodeMBeanImpl.java

Modified: 
karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarNodeMBeanImpl.java
URL: 
http://svn.apache.org/viewvc/karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarNodeMBeanImpl.java?rev=1369356&r1=1369355&r2=1369356&view=diff
==============================================================================
--- 
karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarNodeMBeanImpl.java
 (original)
+++ 
karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarNodeMBeanImpl.java
 Sat Aug  4 16:13:43 2012
@@ -71,8 +71,8 @@ public class CellarNodeMBeanImpl extends
     public TabularData getNodes() throws Exception {
 
         CompositeType nodeType = new CompositeType("Node", "Karaf Cellar 
cluster node",
-                new String[]{ "id", "hostname", "port" },
-                new String[]{ "ID of the node", "Hostname of the node", "Port 
number of the node" },
+                new String[]{ "id", "hostname", "port", "local" },
+                new String[]{ "ID of the node", "Hostname of the node", "Port 
number of the node", "Flag defining if the node is local" },
                 new OpenType[]{ SimpleType.STRING, SimpleType.STRING, 
SimpleType.INTEGER });
 
         TabularType tableType = new TabularType("Nodes", "Table of all Karaf 
Cellar nodes", nodeType, new String[]{ "id" });
@@ -82,9 +82,10 @@ public class CellarNodeMBeanImpl extends
         Set<Node> nodes = clusterManager.listNodes();
 
         for (Node node : nodes) {
+            boolean local = (nodes.equals(clusterManager.getNode()));
             CompositeData data = new CompositeDataSupport(nodeType,
-                    new String[]{ "id", "hostname", "port" },
-                    new Object[]{ node.getId(), node.getHost(), node.getPort() 
});
+                    new String[]{ "id", "hostname", "port", "local" },
+                    new Object[]{ node.getId(), node.getHost(), 
node.getPort(), local });
             table.put(data);
         }
 


Reply via email to