Package com.sun.enterprise.admin.util

Examples of com.sun.enterprise.admin.util.CommandModelData


             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here


             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

            logger.finer("------- RAW METADATA RESPONSE ---------");
            logger.finer(response);
            logger.finer("------- RAW METADATA RESPONSE ---------");
        }

        CommandModelData cm = new CommandModelData(name);
        boolean sawFile = false;
        try {
            DocumentBuilder d =
                    DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = d.parse(in);
            NodeList cmd = doc.getElementsByTagName("command");
            Node cmdnode = cmd.item(0);
            if (cmdnode == null) {
                Node report = doc.getElementsByTagName("action-report").item(0);
                String cause = getAttr(report.getAttributes(), "failure-cause");
                if (ok(cause))
                    errors.append(cause);
                else {
                    Node mp = report.getFirstChild();   // message-part
                    if (mp != null)
                        cause = getAttr(mp.getAttributes(), "message");
                    if (ok(cause))
                        errors.append(cause);
                }
                // no command info, must be invalid command or something
                // wrong with command implementation
                return null;
            }
            NamedNodeMap cmdattrs = cmdnode.getAttributes();
            usage = getAttr(cmdattrs, "usage");
            String dashOk = getAttr(cmdattrs, "unknown-options-are-operands");
            if (dashOk != null)
                cm.dashOk = Boolean.parseBoolean(dashOk);
            NodeList opts = doc.getElementsByTagName("option");
            for (int i = 0; i < opts.getLength(); i++) {
                Node n = opts.item(i);
                NamedNodeMap attributes = n.getAttributes();
                String sn = getAttr(attributes, "short");
                String def = getAttr(attributes, "default");
                String obs = getAttr(attributes, "obsolete");
                String alias = getAttr(attributes, "alias");
                ParamModelData opt = new ParamModelData(
                        getAttr(attributes, "name"),
                        typeOf(getAttr(attributes, "type")),
                        Boolean.parseBoolean(getAttr(attributes, "optional")),
                        def,
                        ok(sn) ? sn : null,
      ok(obs) ? Boolean.parseBoolean(obs) : false,
      alias);
                if (getAttr(attributes, "type").equals("PASSWORD")) {
                    opt.param._password = true;
                    opt.description = getAttr(attributes, "description");
                }
                cm.add(opt);
                if (opt.getType() == File.class)
                    sawFile = true;
            }
            // should be only one operand item
            opts = doc.getElementsByTagName("operand");
            for (int i = 0; i < opts.getLength(); i++) {
                Node n = opts.item(i);
                NamedNodeMap attributes = n.getAttributes();
                Class<?> type = typeOf(getAttr(attributes, "type"));
                if (type == File.class)
                    sawFile = true;
                int min = Integer.parseInt(getAttr(attributes, "min"));
                String max = getAttr(attributes, "max");
                boolean multiple = false;
                if (max.equals("unlimited")) {
                    multiple = true;
                    // XXX - should convert to array of whatever
                    if (type == File.class)
                        type = File[].class;
                    else
                        type = List.class;
                }
                ParamModelData pm = new ParamModelData(
                    getAttr(attributes, "name"), type, min == 0, null);
                pm.param._primary = true;
                pm.param._multiple = multiple;
                cm.add(pm);
            }

            /*
             * If one of the options or operands is a FILE,
             * make sure there's also a --upload option available.
             * XXX - should only add it if it's not present
             * XXX - should just define upload parameter on remote command
             */
            if (sawFile) {
                cm.add(new ParamModelData("upload", Boolean.class,
                        true, null));
                addedUploadOption = true;
            }
        } catch (ParserConfigurationException pex) {
            // ignore for now
View Full Code Here

             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
            if (programOpts.isHelp()) {
                CommandModelData cm = new CommandModelData(name);
                cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
                this.commandModel = cm;
                rac.setCommandModel(cm);
                return;
            }

View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.util.CommandModelData

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.