use of com.haulmont.cuba.web.jmx.entity.ManagedBeanDomain in project cuba by cuba-platform.
the class ManagedBeanInfoDatasource method loadTree.
@Override
protected Tree<ManagedBeanInfo> loadTree(Map<String, Object> params) {
String tag = getLoggingTag("TDS");
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
List<Node<ManagedBeanInfo>> nodes = new ArrayList<>();
if (jmxInstance != null) {
List<ManagedBeanDomain> domains = jmxControlAPI.getDomains(jmxInstance);
Map<String, Node<ManagedBeanInfo>> domainMap = new HashMap<>();
for (ManagedBeanDomain mbd : domains) {
ManagedBeanInfo dummy = metadata.create(ManagedBeanInfo.class);
dummy.setDomain(mbd.getName());
Node<ManagedBeanInfo> node = new Node<>(dummy);
domainMap.put(mbd.getName(), node);
nodes.add(node);
}
List<ManagedBeanInfo> list = loadManagedBeans(params);
for (ManagedBeanInfo mbi : list) {
if (mbi != null) {
if (domainMap.containsKey(mbi.getDomain())) {
domainMap.get(mbi.getDomain()).addChild(new Node<>(mbi));
}
}
}
// remove root nodes that might have left without children after filtering
for (Node<ManagedBeanInfo> rootNode : new ArrayList<>(nodes)) {
if (rootNode.getChildren().isEmpty()) {
nodes.remove(rootNode);
}
}
}
sw.stop();
return new Tree<>(nodes);
}
Aggregations