@Override public TabularData consumerStatus() throws Exception { ConsumerSwitchCommand command = new ConsumerSwitchCommand(clusterManager.generateId()); command.setStatus(null); Map<Node, ConsumerSwitchResult> results = executionContext.execute(command); CompositeType compositeType = new CompositeType("Event Consumer", "Karaf Cellar cluster event consumer", new String[]{"node", "status", "local"}, new String[]{"Node hosting event consumer", "Current status of the event consumer", "True if the node is local"}, new OpenType[]{SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN}); TabularType tableType = new TabularType("Event Consumers", "Table of Karaf Cellar cluster event consumers", compositeType, new String[]{"node"}); TabularDataSupport table = new TabularDataSupport(tableType); for (Node node : results.keySet()) { boolean local = (node.equals(clusterManager.getNode())); ConsumerSwitchResult consumerSwitchResult = results.get(node); String nodeName = node.getAlias(); if (nodeName == null) { nodeName = node.getId(); } CompositeDataSupport data = new CompositeDataSupport(compositeType, new String[]{"node", "status", "local"}, new Object[]{nodeName, consumerSwitchResult.getStatus(), local}); table.put(data); } return table; }
@Override public TabularData consumerStatus() throws Exception { ConsumerSwitchCommand command = new ConsumerSwitchCommand(clusterManager.generateId()); command.setStatus(null); Map<Node, ConsumerSwitchResult> results = executionContext.execute(command); CompositeType compositeType = new CompositeType("Event Consumer", "Karaf Cellar cluster event consumer", new String[]{"node", "status", "local"}, new String[]{"Node hosting event consumer", "Current status of the event consumer", "True if the node is local"}, new OpenType[]{SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN}); TabularType tableType = new TabularType("Event Consumers", "Table of Karaf Cellar cluster event consumers", compositeType, new String[]{"node"}); TabularDataSupport table = new TabularDataSupport(tableType); for (Node node : results.keySet()) { boolean local = (node.equals(clusterManager.getNode())); ConsumerSwitchResult consumerSwitchResult = results.get(node); String nodeName = node.getAlias(); if (nodeName == null) { nodeName = node.getId(); } CompositeDataSupport data = new CompositeDataSupport(compositeType, new String[]{"node", "status", "local"}, new Object[]{nodeName, consumerSwitchResult.getStatus(), local}); table.put(data); } return table; }
if (result.getStatus()) { statusString = "ON";