/**
* lists node agents and their status
*/
public String[] listNodeAgentsAsString(String targetName, boolean andStatus) throws AgentException
{
final StringManager stringMgr = StringManager.getManager(AgentManager.class);
try {
final TargetType[] validTargets = {TargetType.NODE_AGENT, TargetType.CLUSTER,
TargetType.DOMAIN, TargetType.SERVER};
final ConfigContext configContext = getConfigContext();
Target target = TargetBuilder.INSTANCE.createTarget(
DOMAIN_TARGET, validTargets, targetName,
configContext);
final NodeAgent[] agents = target.getNodeAgents();
final int numAgents = agents.length;
String[] result = new String[numAgents];
String nodeAgentName = null;
RuntimeStatusList statusList = null;
if (andStatus) {
//Fetch the status of all the node agents in parallel
statusList = getRuntimeStatus(agents);
}
for (int i = 0; i < numAgents; i++) {
nodeAgentName = agents[i].getName();
if (andStatus) {
result[i] = stringMgr.getString("listAgentElement", nodeAgentName,
(statusList.getStatus(i)).toShortString());
} else {
result[i] = nodeAgentName;
}
}