Search in sources :

Example 21 with TreeNode

use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.

the class AbstractTreeNode method getPossibleParentNode.

@Override
public TreeNode getPossibleParentNode(String pattern) {
    // simplify by bailing out early if preconditions are not met...
    if (pattern == null || pattern.length() <= 0 || pattern.indexOf('*') >= 0)
        return null;
    TreeNode node = null;
    int longest = 0;
    for (TreeNode n : traverse(true)) {
        String aname = n.getCompletePathName();
        if (aname == null)
            // defensive pgming
            continue;
        if (pattern.startsWith(aname) || pattern.startsWith(aname.replace("\\", ""))) {
            int thisLength = aname.length();
            // keep the longest match ONLY!
            if (node == null || thisLength > longest) {
                node = n;
                longest = thisLength;
            }
        }
    }
    return node;
}
Also used : TreeNode(org.glassfish.flashlight.datatree.TreeNode)

Example 22 with TreeNode

use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.

the class AbstractTreeNode method findNodeInTreeNormalized.

private TreeNode findNodeInTreeNormalized(String desiredName) {
    if (!ok(desiredName))
        return null;
    desiredName = decodeNameToDots(desiredName);
    TreeNode node = normalizedChildren.get(desiredName);
    // one more try.  GUI sometimes chops off the starting "server".
    if (node == null && !desiredName.startsWith("server.")) {
        node = normalizedChildren.get("server." + desiredName);
        // to "instance1.server.blah"
        if (node == null && (desiredName = insertServerString(desiredName)) != null)
            node = normalizedChildren.get(desiredName);
    }
    return node;
}
Also used : TreeNode(org.glassfish.flashlight.datatree.TreeNode)

Example 23 with TreeNode

use of org.glassfish.flashlight.datatree.TreeNode in project Payara by payara.

the class AbstractTreeNode method traverse.

/**
 * Returns all the nodes under the current tree
 * @return List of all nodes in the current tree
 */
@Override
public List<TreeNode> traverse(boolean ignoreDisabled) {
    // System.out.println ("Node: " + this.getName ()+ " is enabled "+isEnabled());
    List<TreeNode> list = new ArrayList<TreeNode>();
    if (ignoreDisabled) {
        if (!this.enabled) {
            return list;
        }
    }
    list.add(this);
    if (!hasChildNodes()) {
        return list;
    }
    Collection<TreeNode> childList = children.values();
    for (TreeNode node : childList) {
        list.addAll(node.traverse(ignoreDisabled));
    }
    return list;
}
Also used : TreeNode(org.glassfish.flashlight.datatree.TreeNode)

Aggregations

TreeNode (org.glassfish.flashlight.datatree.TreeNode)23 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 Pattern (java.util.regex.Pattern)2 StatsProviderRegistryElement (org.glassfish.admin.monitor.StatsProviderRegistry.StatsProviderRegistryElement)2 ProbeClientMethodHandle (org.glassfish.flashlight.client.ProbeClientMethodHandle)2 Domain (com.sun.enterprise.config.serverbeans.Domain)1 Server (com.sun.enterprise.config.serverbeans.Server)1 PropertyVetoException (java.beans.PropertyVetoException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 Matcher (java.util.regex.Matcher)1 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 PathSegment (javax.ws.rs.core.PathSegment)1