in shell/src/main/java/org/apache/camel/karaf/shell/EndpointStats.java [46:93]
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("Context");
table.column("Uri");
table.column("Route Id");
table.column("Direction");
table.column("Static");
table.column("Dynamic");
table.column("Total #");
List<CamelContext> camelContexts = getCamelContext(name);
for (CamelContext camelContext : camelContexts) {
if (camelContext.getRuntimeEndpointRegistry() != null) {
EndpointRegistry endpointRegistry = camelContext.getEndpointRegistry();
for (RuntimeEndpointRegistry.Statistic stat : camelContext.getRuntimeEndpointRegistry().getEndpointStatistics()) {
String uri = stat.getUri();
String routeId = stat.getRouteId();
String direction = stat.getDirection();
boolean isStatic = endpointRegistry.isStatic(uri);
boolean isDynamic = endpointRegistry.isDynamic(uri);
long hits = stat.getHits();
if (decode) {
// decode uri so it's more human readable
uri = URLDecoder.decode(uri, "UTF-8");
}
// sanitize and mask uri so we don't see passwords
uri = URISupport.sanitizeUri(uri);
// should we filter ?
if (isValidRow(direction, Boolean.toString(isStatic), Boolean.toString(isDynamic))) {
table.addRow().addContent(camelContext.getName(),
uri,
routeId,
direction,
isStatic,
isDynamic,
hits);
}
}
}
}
table.print(System.out);
return null;
}