Aggregator aggregator = Registry.getInstance().createAggregator(type);
if (aggregator == null) {
fail("Aggregator of type " + type + " is not registered.", elem);
}
if (aggregator instanceof GenericAggregator) {
GenericAggregator ga = (GenericAggregator) aggregator;
String title = elem.getAttribute("title");
if (title != null) {
ga.setName(title);
}
if ("true".equals(elem.getAttribute("isDefault"))) {
ga.setIsDefault("true");
}
for (Element child: getChildElements(elem)) {
if (child.getNodeName().equals("matches")) {
processFilter(ga.getMatchFilter(), child);
} else if (child.getNodeName().equals("contains")) {
processFilter(ga.getContentFilter(), child);
}
}
}
// finally add aggregator
getAggregators().add(aggregator);