}
// loop the routes, and append the processor stats if needed
sb.append(" <routeStats>\n");
for (ObjectName on : routes) {
ManagedRouteMBean route = MBeanServerInvocationHandler.newProxyInstance(server, on, ManagedRouteMBean.class, true);
sb.append(" <routeStat").append(String.format(" id=\"%s\"", route.getRouteId()));
// use substring as we only want the attributes
stat = route.dumpStatsAsXml(fullStats);
sb.append(" ").append(stat.substring(7, stat.length() - 2)).append(">\n");
// add processor details if needed
if (includeProcessors) {
sb.append(" <processorStats>\n");
for (ManagedProcessorMBean processor : processors) {
// the processor must belong to this route
if (route.getRouteId().equals(processor.getRouteId())) {
sb.append(" <processorStat").append(String.format(" id=\"%s\"", processor.getProcessorId()));
// use substring as we only want the attributes
sb.append(" ").append(processor.dumpStatsAsXml(fullStats).substring(7)).append("\n");
}
}