use of javax.management.openmbean.TabularType in project tomee by apache.
the class SimpleRouter method getActiveRoutes.
@ManagedAttribute
public TabularData getActiveRoutes() {
if (routes.length == 0) {
return null;
}
final OpenType<?>[] types = new OpenType<?>[routes.length];
final String[] keys = new String[types.length];
final String[] values = new String[types.length];
for (int i = 0; i < types.length; i++) {
types[i] = SimpleType.STRING;
keys[i] = routes[i].getOrigin().substring(prefix.length());
values[i] = routes[i].getRawDestination().substring(prefix.length());
}
try {
final CompositeType ct = new CompositeType("routes", "routes", keys, keys, types);
final TabularType type = new TabularType("router", "routes", ct, keys);
final TabularDataSupport data = new TabularDataSupport(type);
final CompositeData line = new CompositeDataSupport(ct, keys, values);
data.put(line);
return data;
} catch (final OpenDataException e) {
return null;
}
}
Aggregations