use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class StatsProviderManagerDelegateImpl method createTreeForStatsProvider.
private List<String> createTreeForStatsProvider(TreeNode parentNode, Object statsProvider) {
/* construct monitoring tree at PluginPoint using subTreePath */
List<String> childNodeNames = new ArrayList();
/* Check for custom reset method and store for later to be called instead of
standard reset methods on Statistic classes*/
for (Method m : statsProvider.getClass().getMethods()) {
ManagedAttribute ma = m.getAnnotation(ManagedAttribute.class);
Reset resetMeth = m.getAnnotation(Reset.class);
if (resetMeth != null) {
StatsProviderRegistryElement spre = this.statsProviderRegistry.getStatsProviderRegistryElement(statsProvider);
spre.setResetMethod(m);
}
if (ma != null) {
String methodName = m.getName();
String id = ma.id();
if ((id == null) || id.isEmpty()) {
// if id not specified, derive from method name
String methodNameLower = methodName.toLowerCase(Locale.ENGLISH);
if (methodNameLower.startsWith("get") && methodNameLower.length() > 3) {
id = methodNameLower.substring(3);
}
}
TreeNode attrNode = TreeNodeFactory.createMethodInvoker(id, statsProvider, id, m);
parentNode.addChild(attrNode);
childNodeNames.add(attrNode.getName());
}
}
return childNodeNames;
}
use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class StatsProviderManagerDelegateImpl method constructServerPP.
private TreeNode constructServerPP() {
TreeNode srvrNode = mrdr.get(instanceName);
if (srvrNode != null) {
return srvrNode;
}
srvrNode = TreeNodeFactory.createTreeNode(instanceName, null, instanceName);
srvrNode.setEnabled(false);
mrdr.add(instanceName, srvrNode);
return srvrNode;
}
use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class TreeNodeFactory method createMethodInvoker.
public static TreeNode createMethodInvoker(String name, Object instance, String category, Method m) {
TreeNode tn = new MethodInvokerImpl();
tn.setName(name);
((MethodInvoker) tn).setInstance(instance);
((MethodInvoker) tn).setMethod(m);
tn.setCategory(category);
tn.setEnabled(true);
return tn;
}
use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class TreeNodeFactory method createTreeNode.
public static TreeNode createTreeNode(String name, Object instance, String category) {
TreeNode tn = new TreeNodeImpl(name, category);
tn.setEnabled(true);
return tn;
}
use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.
the class AbstractTreeNode method getNode.
@Override
public TreeNode getNode(String completeName) {
if (completeName == null) {
return null;
}
completeName = encodePath(completeName);
Pattern pattern = Pattern.compile(AbstractTreeNode.REGEX);
String[] tokens = pattern.split(completeName);
TreeNode n = findNodeInTree(tokens);
if (n == null)
n = findNodeInTreeNormalized(completeName);
return n;
}
Aggregations