use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.
the class ConsolidatedListenerMBeanImpl method getLeaderBoard.
@Override
public TabularData getLeaderBoard() {
TabularDataSupport tds;
try {
int id = 0;
TabularType tt = new TabularType(LeaderBoardData.class.getName(), "Leaderboard", LeaderBoardData.TYPE, new String[] { "index" });
tds = new TabularDataSupport(tt);
List<LeaderBoardData> leaderBoard = Lists.newArrayList();
for (Map.Entry<ObjectName, EventListenerMBean> e : eventListeners.entrySet()) {
String listenerId = getListenerId(e.getKey());
EventListenerMBean mbean = e.getValue();
FilterConfigMBean filterConfigMBean = null;
for (Map.Entry<ObjectName, FilterConfigMBean> ef : filterConfigs.entrySet()) {
if (Objects.equal(getListenerId(ef.getKey()), listenerId)) {
filterConfigMBean = ef.getValue();
break;
}
}
leaderBoard.add(new LeaderBoardData(++id, mbean, filterConfigMBean));
}
sort(leaderBoard);
for (LeaderBoardData data : leaderBoard) {
tds.put(data.toCompositeData());
}
} catch (OpenDataException e) {
throw new IllegalStateException(e);
}
return tds;
}
use of javax.management.openmbean.TabularDataSupport in project karaf by apache.
the class InstanceToTableMapper method tableFrom.
public static TabularData tableFrom(List<Instance> instances) {
try {
CompositeType rowType = createRowType();
TabularType tableType = new TabularType("Instances", "Table of all Karaf instances", rowType, new String[] { InstancesMBean.INSTANCE_NAME });
TabularDataSupport table = new TabularDataSupport(tableType);
for (Instance instance : instances) {
CompositeDataSupport row = mapInstance(instance, rowType);
table.put(row);
}
return table;
} catch (OpenDataException e) {
throw new IllegalStateException("Error building instance table", e);
}
}
use of javax.management.openmbean.TabularDataSupport in project karaf by apache.
the class JmxFeature method getConfigList.
static TabularData getConfigList(List<ConfigInfo> config) throws OpenDataException {
TabularDataSupport table = new TabularDataSupport(FEATURE_CONFIG_TABLE);
for (ConfigInfo configInfo : config) {
String[] itemNames = FeaturesServiceMBean.FEATURE_CONFIG;
Object[] itemValues = { configInfo.getName(), getConfigElementTable(configInfo.getProperties()), new Boolean(configInfo.isAppend()) };
CompositeData configComposite = new CompositeDataSupport(FEATURE_CONFIG, itemNames, itemValues);
table.put(configComposite);
}
return table;
}
use of javax.management.openmbean.TabularDataSupport in project karaf by apache.
the class JmxFeature method getDependencyIdentifierTable.
private static TabularData getDependencyIdentifierTable(List<Dependency> features) throws OpenDataException {
TabularDataSupport table = new TabularDataSupport(FEATURE_IDENTIFIER_TABLE);
Set<String> featureSet = new HashSet<>();
for (Dependency feature : features) {
if (featureSet.contains(feature.getName() + feature.getVersion())) {
continue;
} else {
featureSet.add(feature.getName() + feature.getVersion());
}
String[] itemNames = new String[] { FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION };
Object[] itemValues = new Object[] { feature.getName(), feature.getVersion() };
CompositeData ident = new CompositeDataSupport(FEATURE_IDENTIFIER, itemNames, itemValues);
table.put(ident);
}
return table;
}
use of javax.management.openmbean.TabularDataSupport in project karaf by apache.
the class JmxFeature method getConfigElementTable.
static TabularData getConfigElementTable(Map<String, String> config) throws OpenDataException {
TabularDataSupport table = new TabularDataSupport(FEATURE_CONFIG_ELEMENT_TABLE);
for (Map.Entry<String, String> entry : config.entrySet()) {
String[] itemNames = FeaturesServiceMBean.FEATURE_CONFIG_ELEMENT;
Object[] itemValues = { entry.getKey(), entry.getValue() };
CompositeData element = new CompositeDataSupport(FEATURE_CONFIG_ELEMENT, itemNames, itemValues);
table.put(element);
}
return table;
}
Aggregations