@HandlerOutput(name="result", type=java.util.List.class)}
)
public static void getLoadBalancerTargetTableList(HandlerContext handlerCtx){
String lbName = (String)handlerCtx.getInputValue("lbName");
LBConfig lbConfig = getLBConfigOfLoadBalancer(lbName);
if (lbConfig == null){
GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.noSuchLB", new Object[]{lbName}));
return;
}
String[] targets = AMXUtil.getLBConfigHelper().listTargets(lbName);
List result = new ArrayList();
boolean isCluster = true;
if(targets.length > 0)
isCluster = TargetUtil.isCluster(targets[0]); //all targets will either be cluster or instance.
for(int i=0; i<targets.length; i++ ){
HashMap oneRow = new HashMap();
String targetName = targets[i];
oneRow.put("targetName", targetName);
oneRow.put("lbConfigName", lbConfig.getName());
oneRow.put("selected", false);
oneRow.put("appLink", ApplicationHandlers.getNumberLBAppsByTarget(targetName));
if(isCluster){
oneRow.put("policy", lbConfig.getClusterRefConfigMap().get(targetName).getLBPolicy());
oneRow.put("targetLink", "/cluster/clusterGeneral.jsf?clusterName="+targetName);
oneRow.put("clusterInstanceLink", TargetUtil.getNumberLBInstancesByTarget(targetName));
}else{
oneRow.put("lbEnabled", lbConfig.getServerRefConfigMap().get(targetName).getLBEnabled());
oneRow.put("responseTimeoutInMinutes", ""+lbConfig.getServerRefConfigMap().get(targetName).getDisableTimeoutInMinutes());
oneRow.put("targetLink", "/standalone/standaloneInstanceGeneral.jsf?instanceName="+targetName);
}
result.add(oneRow);
}
handlerCtx.setOutputValue("result", result);