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

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


    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


        public Object execute(CommandContext commandContext, Object... objects) throws Exception {
            env.getVariables().set(CURRENT_NODE, gn);
            if (objects.length > 0) {
                try {
                    String cmdId = String.valueOf(objects[0]);
                    Node n = gn.find(cmdId);
                    if (n == null) {
                        n = layout.find(cmdId);
                    }
                    if (n == null) {
                        throw new NotFoundException(cmdId);
                    }
                    CommandContext ctx = commandContext;
                    Command cmd;
                    if (n instanceof CommandNode) {
                        cmd = lookup(((CommandNode) n).getId());
                    } else if (n instanceof GroupNode) {
                        cmd = new GroupCommand(cmdId, (GroupNode) n);
                    } else if (n instanceof AliasNode) {
                        cmd = lookup(((AliasNode) n).getCommand().substring(ALIAS_PREFIX.length()));
                    } else {
                        throw new IllegalStateException("Unrecognized node type: " + n.getClass().getName());
                    }
                    return cmd.execute(ctx, Arguments.shift(objects));
                } finally {
                    env.getVariables().unset(CURRENT_NODE);
                }
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.