if(eventNode==null) {
tableData.clear();
this.fireTableDataChanged();
return;
}
RemoteServiceEvent event = eventNode.getEvent();
tableData.clear();
String impl = "<not declared>";
Throwable thrown;
if(event instanceof ProvisionFailureEvent) {
String label = "ProvisionFailureEvent."+eventNode.getValueAt(0);
ProvisionFailureEvent pfe = (ProvisionFailureEvent)event;
ServiceElement elem = pfe.getServiceElement();
if(elem.getComponentBundle()!=null)
impl = elem.getComponentBundle().getClassName();
thrown = pfe.getThrowable();
String exception = getExceptionText(thrown);
tableData.put("Event", label);
tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
tableData.put("Deployment", elem.getOperationalStringName());
tableData.put("Service", elem.getName());
tableData.put("Class", impl);
StringBuilder builder = new StringBuilder();
for(String reason : pfe.getFailureReasons()) {
if(builder.length()>0)
builder.append("\n ");
builder.append(reason);
}
tableData.put("Reason", builder.toString());
if(exception!=null) {
tableData.put("Exception", exception);
table.setRowHeight(tableData.size(), table.getRowHeight() * 20);
}
} else if(event instanceof ProvisionMonitorEvent) {
String label = "ProvisionMonitorEvent."+eventNode.getValueAt(0);
tableData.put("Event", label);
ProvisionMonitorEvent pme = (ProvisionMonitorEvent)event;
StringBuilder builder = new StringBuilder();
if(pme.getAction().equals(ProvisionMonitorEvent.Action.OPSTRING_DEPLOYED) ||
pme.getAction().equals(ProvisionMonitorEvent.Action.OPSTRING_UNDEPLOYED)) {
StringBuilder serviceNameBuilder = new StringBuilder();
for(ServiceElement service : pme.getOperationalString().getServices()) {
if(serviceNameBuilder.length()>0) {
serviceNameBuilder.append(", ");
}
serviceNameBuilder.append(service.getName());
}
builder.append(serviceNameBuilder.toString());
tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
tableData.put("Deployment", pme.getOperationalStringName());
tableData.put("Services", builder.toString());
} else {
tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
tableData.put("Deployment", pme.getOperationalStringName());
tableData.put("Description", eventNode.getDescription());
}
} else if(event instanceof ServiceLogEvent) {
String label = "ServiceLogEvent."+eventNode.getValueAt(0);
tableData.put("Event", label);
ServiceLogEvent sle = (ServiceLogEvent)event;
thrown = sle.getLogRecord().getThrown();
String exception = getExceptionText(thrown);
tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
tableData.put("Deployment", sle.getOpStringName());
tableData.put("Service", sle.getServiceName());
tableData.put("Machine", sle.getAddress().getHostName());
tableData.put("Message", sle.getLogRecord().getLevel()+": "+sle.getLogRecord().getMessage());
if(exception!=null) {
tableData.put("Exception", exception);
table.setRowHeight(tableData.size(), table.getRowHeight() * 20);
}
} else {
String label = "SLAThresholdEvent."+eventNode.getValueAt(0);
tableData.put("Event", label);
SLAThresholdEvent slaEvent = (SLAThresholdEvent)event;
StringBuilder builder = new StringBuilder();
builder.append("low=").append(slaEvent.getSLA().getCurrentLowThreshold());
builder.append(" high=").append(slaEvent.getSLA().getCurrentHighThreshold());
tableData.put("When", Constants.DATE_FORMAT.format(event.getDate()));
tableData.put("Deployment", slaEvent.getServiceElement().getOperationalStringName());
tableData.put("Service", slaEvent.getServiceElement().getName());
tableData.put("Machine", slaEvent.getHostAddress());
tableData.put("Value", numberFormatter.format(slaEvent.getCalculable().getValue()));
tableData.put("Threshold Values", builder.toString());