Package org.apache.geronimo.gshell.layout.model

Examples of org.apache.geronimo.gshell.layout.model.Node


            for (String p : path) {
                if (cn != null) {
                    io.err.println("Unexpected path '" + p + "'");
                    return FAILURE;
                }
                Node n = gn.find(p);
                if (n == null) {
                    io.err.println("Path '" + p + "' not found!");
                    return FAILURE;
                } else if (n instanceof GroupNode) {
                    gn = (GroupNode) n;
                } else if (n instanceof CommandNode) {
                    cn = (CommandNode) n;
                } else if (n instanceof AliasNode) {
                    cn = (CommandNode) layoutManager.findNode(gn, ((AliasNode) n).getCommand());
                } else {
                    throw new IllegalStateException("Unsupported node type " + n.getParent().getName());
                }
            }
        }

        if (cn == null) {
View Full Code Here


        String shell = (String) properties.get("shell");
        String[] aliases = properties.get("alias") != null ? properties.get("alias").toString().split(",") : new String[0];

        if (name.equals(shell))
        {
            Node n = gn.find(shell);
            MutableGroupNode g = new MutableGroupNode(shell);
            gn.add(g);
            register(command);
        }
        else
        {
            if (shell != null && shell.length() > 0) {
                Node n = gn.find(shell);
                if (n == null) {
                    MutableGroupNode g = new MutableGroupNode(shell);
                    gn.add(g);
                    register(new GroupCommand(shell, g));
                    gn = g;
View Full Code Here

            name = (String) properties.get("name");
        }
        String shell = (String) properties.get("shell");

        if (name.equals(shell) || shell == null || shell.length() == 0) {
            Node n = layout.find(name);
            layout.removeNode(n);
        } else {
            MutableGroupNode gn = (MutableGroupNode) layout.find(shell);
            Node n = gn.find(name);
            gn.removeNode(n);
            if (gn.size() == 0) {
                layout.removeNode(gn);
                unregister(lookup(shell));
            }
View Full Code Here

    public Layout getLayout() {
        return layout;
    }

    public Node findNode(String s) throws NotFoundException {
        Node start = (Node) env.getVariables().get(CURRENT_NODE);
        if (start != null) {
            try {
                return findNode(start, s);
            } catch (NotFoundException e) {
                // Ignore, we need to try at root level
View Full Code Here

    public Node findNode(Node node, String s) throws NotFoundException {
        if (node instanceof GroupNode) {
            if (s.startsWith(ALIAS_PREFIX)) {
                s = s.substring(ALIAS_PREFIX.length());
                Node n = recursiveFind((GroupNode) node, s);
                if (n != null) {
                    return n;
                }
                throw new NotFoundException(s);
            }
            Node n = ((GroupNode) node).find(s);
            if (n == null) {
                throw new NotFoundException(s);
            }
            if (n instanceof GroupNode) {
                return new CommandNode(n.getName(), n.getName());
            }
            return n;
        } else {
            throw new NotFoundException(s);
        }
View Full Code Here

    private Node recursiveFind(GroupNode groupNode, String s) {
        for (Node n : groupNode.nodes()) {
            if (n instanceof CommandNode && ((CommandNode) n).getId().equals(s)) {
                return n;
            } else if (n instanceof GroupNode) {
                Node n2 = recursiveFind((GroupNode) n, s);
                if (n2 != null) {
                    return n2;
                }
            }
        }
View Full Code Here

        String shell = (String) properties.get("shell");
        String[] aliases = properties.get("alias") != null ? properties.get("alias").toString().split(",") : new String[0];

        if (name.equals(shell))
        {
            Node n = gn.find(shell);
            MutableGroupNode g = new MutableGroupNode(shell);
            gn.add(g);
            register(command);
        }
        else
        {
            if (shell != null && shell.length() > 0) {
                Node n = gn.find(shell);
                if (n == null) {
                    MutableGroupNode g = new MutableGroupNode(shell);
                    gn.add(g);
                    register(new GroupCommand(shell, g));
                    gn = g;
View Full Code Here

            name = (String) properties.get("name");
        }
        String shell = (String) properties.get("shell");

        if (name.equals(shell) || shell == null || shell.length() == 0) {
            Node n = layout.find(name);
            layout.removeNode(n);
        } else {
            MutableGroupNode gn = (MutableGroupNode) layout.find(shell);
            Node n = gn.find(name);
            gn.removeNode(n);
            if (gn.size() == 0) {
                layout.removeNode(gn);
                unregister(lookup(shell));
            }
View Full Code Here

    public Layout getLayout() {
        return layout;
    }

    public Node findNode(String s) throws NotFoundException {
        Node start = (Node) env.getVariables().get(CURRENT_NODE);
        if (start != null) {
            try {
                return findNode(start, s);
            } catch (NotFoundException e) {
                // Ignore, we need to try at root level
View Full Code Here

    public Node findNode(Node node, String s) throws NotFoundException {
        if (node instanceof GroupNode) {
            if (s.startsWith(ALIAS_PREFIX)) {
                s = s.substring(ALIAS_PREFIX.length());
                Node n = recursiveFind((GroupNode) node, s);
                if (n != null) {
                    return n;
                }
                throw new NotFoundException(s);
            }
            Node n = ((GroupNode) node).find(s);
            if (n == null) {
                throw new NotFoundException(s);
            }
            if (n instanceof GroupNode) {
                return new CommandNode(n.getName(), n.getName());
            }
            return n;
        } else {
            throw new NotFoundException(s);
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gshell.layout.model.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.