use of javax.management.openmbean.CompositeType 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;
}
}
use of javax.management.openmbean.CompositeType in project ddf by codice.
the class UndeliveredMessagesTest method createCompositeData.
private CompositeData[] createCompositeData(Object itemValue) throws OpenDataException {
CompositeData[] compositeDatas = new CompositeDataSupport[1];
String[] keys = { "itemName", "body" };
/* The first 5 bytes are removed because artemis adds unreadable characters to the
beginning of the message body. */
Object[] values = { "itemValue", itemValue };
CompositeType compositeType = new CompositeType("typeName", "description", keys, new String[] { "itemDescription", "messageBodyDescription" }, new OpenType[] { SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class) });
compositeDatas[0] = new CompositeDataSupport(compositeType, keys, values);
return compositeDatas;
}
Aggregations