private List<String> createTreeForStatsProvider(TreeNode parentNode, Object statsProvider) { /* construct monitoring tree at PluginPoint using subTreePath */ List<String> childNodeNames = new ArrayList(); /* retrieve ManagedAttribute attribute id (v2 compatible) and method names */ /* 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; }
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; }
private TreeNode createSubTreeNode(TreeNode parent, String child) { TreeNode childNode = parent.getChild(child); if (childNode == null) { childNode = TreeNodeFactory.createTreeNode(child, null, child); parent.addChild(childNode); } else { // the childNode is found, but ensure that its enabled enableTreeNode(childNode); } return childNode; }