use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class Monitor method toXml.
public XmlBuilder toXml() {
XmlBuilder monitor = new XmlBuilder("monitor");
monitor.addAttribute("name", getName());
monitor.addAttribute("type", getType());
monitor.addAttribute("destinations", getDestinationsAsString());
for (Iterator<Trigger> it = triggers.iterator(); it.hasNext(); ) {
Trigger trigger = (Trigger) it.next();
trigger.toXml(monitor);
}
return monitor;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class MonitorAdapterBase method makeXml.
public String makeXml(String subSource, EventTypeEnum eventType, SeverityEnum severity, String message, Throwable t) {
XmlBuilder eventXml = new XmlBuilder("event");
eventXml.addAttribute("hostname", hostname);
eventXml.addAttribute("source", sourceId);
eventXml.addAttribute("subSource", subSource);
eventXml.addAttribute("eventType", eventType.getName());
eventXml.addAttribute("severity", severity.getName());
eventXml.addAttribute("message", message);
return eventXml.toXML();
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class MonitorManager method toXml.
public XmlBuilder toXml() {
XmlBuilder configXml = new XmlBuilder("monitoring");
configXml.addAttribute("enabled", isEnabled());
XmlBuilder destinationsXml = new XmlBuilder("destinations");
for (Iterator it = destinations.keySet().iterator(); it.hasNext(); ) {
String name = (String) it.next();
IMonitorAdapter ma = getDestination(name);
XmlBuilder destinationXml = new XmlBuilder("destination");
destinationXml.addAttribute("name", ma.getName());
destinationXml.addAttribute("className", ma.getClass().getName());
destinationsXml.addSubElement(ma.toXml());
}
configXml.addSubElement(destinationsXml);
XmlBuilder monitorsXml = new XmlBuilder("monitors");
for (int i = 0; i < monitors.size(); i++) {
Monitor monitor = getMonitor(i);
monitorsXml.addSubElement(monitor.toXml());
}
configXml.addSubElement(monitorsXml);
return configXml;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class SenderMonitorAdapter method toXml.
public XmlBuilder toXml() {
XmlBuilder result = super.toXml();
XmlBuilder senderXml = new XmlBuilder("sender");
senderXml.addAttribute("className", getSender().getClass().getName());
try {
Map properties = BeanUtils.describe(sender);
for (Iterator it = properties.keySet().iterator(); it.hasNext(); ) {
String property = (String) it.next();
if (!property.equals("name")) {
addNonDefaultAttribute(senderXml, sender, property);
}
}
} catch (Exception e) {
log.error("cannot set attributes of sender [" + ClassUtils.nameOf(sender) + "]");
}
result.addSubElement(senderXml);
return result;
}
use of nl.nn.adapterframework.util.XmlBuilder in project iaf by ibissource.
the class Trigger method toXml.
public void toXml(XmlBuilder monitor) {
XmlBuilder trigger = new XmlBuilder(isAlarm() ? "alarm" : "clearing");
monitor.addSubElement(trigger);
if (getSeverity() != null) {
trigger.addAttribute("severity", getSeverity());
}
if (getThreshold() > 0) {
trigger.addAttribute("threshold", getThreshold());
}
if (getPeriod() > 0) {
trigger.addAttribute("period", getPeriod());
}
XmlBuilder events = new XmlBuilder("events");
trigger.addSubElement(events);
for (int i = 0; i < eventCodes.size(); i++) {
XmlBuilder event = new XmlBuilder("event");
events.addSubElement(event);
event.setValue((String) eventCodes.get(i));
}
if (getAdapterFilters() != null) {
XmlBuilder filtersXml = new XmlBuilder("filters");
filtersXml.addAttribute("filterExclusive", isFilterExclusive());
trigger.addSubElement(filtersXml);
if (getSourceFiltering() != SOURCE_FILTERING_NONE) {
for (Iterator<String> it = getAdapterFilters().keySet().iterator(); it.hasNext(); ) {
String adapterName = (String) it.next();
AdapterFilter af = (AdapterFilter) getAdapterFilters().get(adapterName);
XmlBuilder adapter = new XmlBuilder("adapterfilter");
filtersXml.addSubElement(adapter);
adapter.addAttribute("adapter", adapterName);
if (isFilterOnLowerLevelObjects()) {
XmlBuilder sourcesXml = new XmlBuilder("sources");
adapter.addSubElement(sourcesXml);
List subobjectList = af.getSubObjectList();
if (subobjectList != null) {
for (Iterator it2 = subobjectList.iterator(); it2.hasNext(); ) {
String subObjectName = (String) it2.next();
XmlBuilder sourceXml = new XmlBuilder("source");
sourcesXml.addSubElement(sourceXml);
sourceXml.setValue(subObjectName);
}
}
}
}
}
}
}
Aggregations