* @return the Object resulting of the command execution.
* @throws Exception in case of execution failure.
*/
protected Object doExecute(ManageGroupAction action, String group, Group source, Collection<String> nodeIds, Boolean suppressOutput) throws Exception {
ManageGroupCommand command = new ManageGroupCommand(clusterManager.generateId());
// looking for nodes and check if exist
Set<Node> recipientList = new HashSet<Node>();
if (nodeIds != null && !nodeIds.isEmpty()) {
for (String nodeId : nodeIds) {
Node node = clusterManager.findNodeById(nodeId);
if (node == null) {
System.err.println("Cluster node " + nodeId + " doesn't exist");
} else {
recipientList.add(node);
}
}
} else {
recipientList.add(clusterManager.getNode());
}
if (recipientList.size() < 1) {
return null;
}
command.setDestination(recipientList);
command.setAction(action);
if (group != null) {
command.setGroupName(group);
}
if (source != null) {
command.setSourceGroup(source);
}
Map<Node, ManageGroupResult> results = executionContext.execute(command);
if (!suppressOutput) {
if (results == null || results.isEmpty()) {