List entries = new ArrayList(this.collector.getStatistics());
Collections.sort(entries, new ReportComparator());
final Iterator i = entries.iterator();
while ( i.hasNext() ) {
found = true;
final Report report = (Report)i.next();
final AttributesImpl attrs = new AttributesImpl();
attrs.addCDATAAttribute("name", report.getCategory());
XMLUtils.startElement(this.xmlConsumer, "report", attrs);
XMLUtils.createElement(this.xmlConsumer, "count", String.valueOf(report.getCount()));
XMLUtils.createElement(this.xmlConsumer, "min", this.getTime(report.getMin()));
XMLUtils.createElement(this.xmlConsumer, "max", this.getTime(report.getMax()));
XMLUtils.createElement(this.xmlConsumer, "last", this.getTime(report.getLast()));
XMLUtils.createElement(this.xmlConsumer, "all", report.getAll());
XMLUtils.createElement(this.xmlConsumer, "average", this.getTime(report.getAverage()));
XMLUtils.endElement(this.xmlConsumer, "report");
}
if ( !found ) {
XMLUtils.data(this.xmlConsumer, "No reports");
}
XMLUtils.endElement(this.xmlConsumer, "reports");
if ( found ) {
XMLUtils.startElement(this.xmlConsumer, "pages");
entries = new ArrayList(this.collector.getPageReports());
Collections.sort(entries, new PageReportComparator());
final Iterator pi = entries.iterator();
while ( pi.hasNext() ) {
final PageReport report = (PageReport)pi.next();
final AttributesImpl attrs = new AttributesImpl();
attrs.addCDATAAttribute("id", report.getId());
attrs.addCDATAAttribute("date", report.getDate().toString());
XMLUtils.startElement(this.xmlConsumer, "report", attrs);
final Iterator si = report.getStatistics().iterator();
while ( si.hasNext() ) {
final Statistics stats = (Statistics)si.next();
attrs.clear();
attrs.addCDATAAttribute("name", stats.getCategory());
attrs.addCDATAAttribute("duraration", String.valueOf(stats.getDuration()));