public static void getMonitorEventValues(HandlerContext handlerCtx) {
try{
String configName = (String) handlerCtx.getInputValue("ConfigName");
String ruleName = (String) handlerCtx.getInputValue("RuleName");
ConfigConfig config = AMXUtil.getConfig(configName);
ManagementRuleConfig mgRuleConfig = config.getManagementRulesConfig().getManagementRuleConfigMap().get(ruleName);
Map<String,String> propMap = mgRuleConfig.getEventConfig().getProperties();
SelectItem[] numtypes = ConfigurationHandlers.getOptions(numTypes);
String monitorType = propMap.get("monitortype");
handlerCtx.setOutputValue("ObservedMbean", propMap.get("observedobject"));
handlerCtx.setOutputValue("ObservedAttr", propMap.get("observedattribute"));
handlerCtx.setOutputValue("Granularity", propMap.get("granularityperiod"));
if(monitorType.equals("countermonitor") || monitorType.equals("gaugemonitor")){
handlerCtx.setOutputValue("isString", false);
handlerCtx.setOutputValue("DiffMode", propMap.get("differencemode"));
handlerCtx.setOutputValue("NumType", propMap.get("numbertype"));
handlerCtx.setOutputValue("NumTypesList", numtypes);
if(monitorType.equals("countermonitor")){
handlerCtx.setOutputValue("isCounter", true);
handlerCtx.setOutputValue("isGauge", false);
handlerCtx.setOutputValue("MonitorType", "Counter");
handlerCtx.setOutputValue("InitThreshold", propMap.get("initthreshold"));
handlerCtx.setOutputValue("Offset", propMap.get("offset"));
handlerCtx.setOutputValue("Modulus", propMap.get("modulus"));
}
if(monitorType.equals("gaugemonitor")){
handlerCtx.setOutputValue("isGauge", true);
handlerCtx.setOutputValue("isCounter", false);
handlerCtx.setOutputValue("MonitorType", "Gauge");
handlerCtx.setOutputValue("LowThresh", propMap.get("lowthreshold"));
handlerCtx.setOutputValue("HighThresh", propMap.get("highthreshold"));
}
}
if(monitorType.equals("stringmonitor")){
handlerCtx.setOutputValue("isString", true);
handlerCtx.setOutputValue("isCounter", false);
handlerCtx.setOutputValue("isGauge", false);
handlerCtx.setOutputValue("MonitorType", "String");
SelectItem[] triggersList = ConfigurationHandlers.getOptions(triggerValues, triggerTypes);
handlerCtx.setOutputValue("TriggersList", triggersList);
handlerCtx.setOutputValue("Trigger", propMap.get("stringnotify"));
handlerCtx.setOutputValue("ValueProp", propMap.get("stringtocompare"));
}
if(mgRuleConfig.getActionConfig() != null){
handlerCtx.setOutputValue("Action", mgRuleConfig.getActionConfig().getActionMBeanName()); //NOI18N
}
}catch (Exception ex){
GuiUtil.handleException(handlerCtx, ex);
}
}