Find a node in the tree.  The node must be "visible" to be found.
@param address The full address of the node matching ManagementModelNode.addressPath()
@return The node, or null if not found.
559722
public ManagementModelNode findNode(String address) {
        ManagementModelNode root = (ManagementModelNode)tree.getModel().getRoot();
        Enumeration<javax.swing.tree.TreeNode> allNodes = root.depthFirstEnumeration();
        while (allNodes.hasMoreElements()) {
            ManagementModelNode node = (ManagementModelNode)allNodes.nextElement();
            if (node.addressPath().equals(address)) return node;
        }

        return null;
    }
412253
public Node nodeBy(final NetworkAddress hostname) {
        if (hostname == null) {
            return null;
        }

        for (Node node : nodes) {
            if (node.hostname().equals(hostname)) {
                return node;
            }
        }
        return null;
    }
657536
ModelNode toModelNode() {
        ModelNode result = null;
        if (map != null) {
            result = new ModelNode();
            for (Map.Entry<PathAddress, ResourceData> entry : map.entrySet()) {
                ModelNode item = new ModelNode();
                PathAddress pa = entry.getKey();
                item.get(ABSOLUTE_ADDRESS).set(pa.toModelNode());
                ResourceData rd = entry.getValue();
                item.get(RELATIVE_ADDRESS).set(pa.subAddress(baseAddressLength).toModelNode());
                ModelNode attrs = new ModelNode().setEmptyList();
                if (rd.attributes != null) {
                    for (String attr : rd.attributes) {
                        attrs.add(attr);
                    }
                }
                if (attrs.asInt() > 0) {
                    item.get(FILTERED_ATTRIBUTES).set(attrs);
                }
                ModelNode children = new ModelNode().setEmptyList();
                if (rd.children != null) {
                    for (PathElement pe : rd.children) {
                        children.add(new Property(pe.getKey(), new ModelNode(pe.getValue())));
                    }
                }
                if (children.asInt() > 0) {
                    item.get(UNREADABLE_CHILDREN).set(children);
                }
                ModelNode childTypes = new ModelNode().setEmptyList();
                if (rd.childTypes != null) {
                    Set<String> added = new HashSet<String>();
                    for (PathElement pe : rd.childTypes) {
                        if (added.add(pe.getKey())) {
                            childTypes.add(pe.getKey());
                        }
                    }
                }
                if (childTypes.asInt() > 0) {
                    item.get(FILTERED_CHILDREN_TYPES).set(childTypes);
                }
                result.add(item);
            }
        }
        return result;
    }
1228555
public E find(E e) {
	Node<E> node = elmap.get(e);
	if(node == null) return e;
	return _find_root(node).element;
    }
1000873
public static PathAddress pathAddress(final ModelNode node) {
        if (node.isDefined()) {

//            final List<Property> props = node.asPropertyList();
            // Following bit is crap TODO; uncomment above and delete below
            // when bug is fixed
            final List<Property> props = new ArrayList<Property>();
            String key = null;
            for (ModelNode element : node.asList()) {
                Property prop = null;
                if (element.getType() == ModelType.PROPERTY || element.getType() == ModelType.OBJECT) {
                    prop = element.asProperty();
                } else if (key == null) {
                    key = element.asString();
                } else {
                    prop = new Property(key, element);
                }
                if (prop != null) {
                    props.add(prop);
                    key = null;
                }

            }
            if (props.size() == 0) {
                return EMPTY_ADDRESS;
            } else {
                final Set<String> seen = new HashSet<String>();
                final List<PathElement> values = new ArrayList<PathElement>();
                int index = 0;
                for (final Property prop : props) {
                    final String name = prop.getName();
                    if (seen.add(name)) {
                        values.add(new PathElement(name, prop.getValue().asString()));
                    } else {
                        throw duplicateElement(name);
                    }
                    if (index == 1 && name.equals(SERVER) && seen.contains(HOST)) {
                        seen.clear();
                    }
                    index++;
                }
                return new PathAddress(Collections.unmodifiableList(values));
            }
        } else {
            return EMPTY_ADDRESS;
        }
    }
1349965
public static ModelNode createRemoveOperation(final ModelNode address, final boolean recursive) {
        final ModelNode op = createRemoveOperation(address);
        op.get(RECURSIVE).set(recursive);
        return op;
    }
1071302
public TreeElement findNode(String nodeName)
    {
        TreeElement root = getRoot(this);
        return root.findNodeRecurse(nodeName, nodeName);
    }
387840
private Node findNode(String id) {
        Node result = doFindNode(id);
        if (result != null) {
            return result;
        }
        throw new IllegalArgumentException("Couldn't find node " + id);
    }
403357
public Node<T> get(long value) {
    	if (root == null) return null;
    	if (value == first.value) return first;
    	if (value == last.value) return last;
    	if (value < first.value) return null;
    	if (value > last.value) return null;
    	return get(root, value);
    }
862130
public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {
        return getAccessControl(client, null, address, operations);
    }
734223
@Nullable
    public T find(byte[] bytes)
    {
        ByteTrieNode<T> node = _root;
        T value = node._value;
        for (byte b : bytes) {
            ByteTrieNode<T> child = node._children.get(b);
            if (child == null)
                break;
            node = child;
            if (node._value != null)
                value = node._value;
        }
        return value;
    }
79561
private ModelNode parseAddress(final String profileName, final String inputAddress) {
        final ModelNode result = new ModelNode();
        if (profileName != null) {
            result.add(ServerOperations.PROFILE, profileName);
        }
        String[] parts = inputAddress.split(",");
        for (String part : parts) {
            String[] address = part.split("=");
            if (address.length != 2) {
                throw new RuntimeException(part + " is not a valid address segment");
            }
            result.add(address[0], address[1]);
        }
        return result;
    }
1131857
@Override
	public final TableTreeNode getNodeAtLine(final int row) {
		TableTreeNode node = root.next(); // the root node is never used

		for (int index = 0; node != null && index < row; index++) {
			node = node.next();
		}

		return node;
	}
958959
public RemoteAddress getAddress(String nodeID) {
		NodeDescriptor node = nodes.get(nodeID);
		if (node == null) {
			return null;
		}
		RemoteAddress address;
		node.readLock.lock();
		try {
			address = new RemoteAddress(node.host, node.port);
		} finally {
			node.readLock.unlock();
		}
		return address;
	}
1358478
public void explore() {
        if (isLeaf) return;
        if (isGeneric) return;
        removeAllChildren();

        try {
            String addressPath = addressPath();
            ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description");
            resourceDesc = resourceDesc.get("result");
            ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)");
            ModelNode result = response.get("result");
            if (!result.isDefined()) return;

            List<String> childrenTypes = getChildrenTypes(addressPath);
            for (ModelNode node : result.asList()) {
                Property prop = node.asProperty();
                if (childrenTypes.contains(prop.getName())) { // resource node
                    if (hasGenericOperations(addressPath, prop.getName())) {
                        add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName())));
                    }
                    if (prop.getValue().isDefined()) {
                        for (ModelNode innerNode : prop.getValue().asList()) {
                            UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName());
                            add(new ManagementModelNode(cliGuiCtx, usrObj));
                        }
                    }
                } else { // attribute node
                    UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString());
                    add(new ManagementModelNode(cliGuiCtx, usrObj));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
968864
public ZookeeperTxId getPrimaryLastTxId(String address, boolean sync)
      throws IOException,
      KeeperException, InterruptedException, ClassNotFoundException {
    Stat stat = new Stat();
    String node = getLastTxIdNode(address);
    byte[] data = getNodeData(node, stat, false, sync);
    if (data == null) {
      return null;
    }
    return ZookeeperTxId.getFromBytes(data);
  }
553812
Context findNewNode(final VirtualHost.HostEntry entry) {
        return electNode(entry.getContexts(), false, null);
    }