Examples of ParamModelData


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

               valid &= verifyInstancePassword(new File(nodeDirChild,instanceDir0));
           }
           if (!valid) {
               throw new CommandException(strings.get("incorrect.old.mp"));
           }
            ParamModelData nmpo = new ParamModelData("AS_ADMIN_NEWMASTERPASSWORD",
                    String.class, false, null);
            nmpo.prompt = strings.get("new.mp");
            nmpo.promptAgain = strings.get("new.mp.again");
            nmpo.param._password = true;
            newPassword = super.getPassword(nmpo, null, true);
View Full Code Here

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

                    jsonOptions.put(optns);
                }
                for (int i = 0; i < jsonOptions.length(); i++) {
                    JSONObject jsOpt = jsonOptions.getJSONObject(i);
                    String type = jsOpt.getString("@type");
                    ParamModelData opt = new ParamModelData(
                            jsOpt.getString("@name"),
                            typeOf(type),
                            jsOpt.optBoolean("@optional", false),
                            jsOpt.optString("@default"),
                            jsOpt.optString("@short"),
                            jsOpt.optBoolean("@obsolete", false),
                            jsOpt.optString("@alias"));
                    opt.param._acceptableValues = jsOpt.optString("@acceptable-values");
                    if ("PASSWORD".equals(type)) {
                        opt.param._password = true;
                        opt.description = jsOpt.optString("$");
                    } else if ("FILE".equals(type)) {
                        sawFile = true;
                    }
                    if (jsOpt.optBoolean("@primary", false)) {
                        opt.param._primary = true;
                    }
                    if (jsOpt.optBoolean("@multiple", false)) {
                        if (opt.type == File.class) {
                            opt.type = File[].class;
                        } else {
                            opt.type = List.class;
                        }
                        opt.param._multiple = true;
                    }
                    cm.add(opt);
                }
            }
            if (sawFile) {
                cm.add(new ParamModelData("upload", Boolean.class,
                        true, null));
                addedUploadOption = true;
                cm.setAddedUploadOption(true);
            }
            this.usage = cm.getUsage();
View Full Code Here

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

                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;
                cm.setAddedUploadOption(true);
            }
        } catch (ParserConfigurationException pex) {
View Full Code Here

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

     * The master password must be the same for all instances in a domain.

     * @throws CommandException
     */
    private void saveMasterPassword() throws CommandException {
        masterPasswordOption = new ParamModelData(CLIConstants.MASTER_PASSWORD,
                String.class, false, null);
        masterPasswordOption.description = Strings.get("MasterPassword");
        masterPasswordOption.param._password = true;
        if (saveMasterPassword)
            useMasterPassword = true;
View Full Code Here

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

    /**
     * Return a CommandModel that only includes the --help option.
     */
    private CommandModel helpModel() {
        CommandModelData cm = new CommandModelData(name);
        cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
        return cm;
    }
View Full Code Here

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

             * 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

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

                    jsonOptions.put(optns);
                }
                for (int i = 0; i < jsonOptions.length(); i++) {
                    JSONObject jsOpt = jsonOptions.getJSONObject(i);
                    String type = jsOpt.getString("@type");
                    ParamModelData opt = new ParamModelData(
                            jsOpt.getString("@name"),
                            typeOf(type),
                            jsOpt.optBoolean("@optional", false),
                            jsOpt.optString("@default"),
                            jsOpt.optString("@short"),
                            jsOpt.optBoolean("@obsolete", false),
                            jsOpt.optString("@alias"));
                    opt.param._acceptableValues = jsOpt.optString("@acceptable-values");
                    if ("PASSWORD".equals(type)) {
                        opt.param._password = true;
                        opt.prompt = jsOpt.optString("@prompt");
                        opt.promptAgain = jsOpt.optString("@prompt-again");
                    } else if ("FILE".equals(type)) {
                        sawFile = true;
                    }
                    if (jsOpt.optBoolean("@primary", false)) {
                        opt.param._primary = true;
                    }
                    if (jsOpt.optBoolean("@multiple", false)) {
                        if (opt.type == File.class) {
                            opt.type = File[].class;
                        } else {
                            opt.type = List.class;
                        }
                        opt.param._multiple = true;
                    }
                    cm.add(opt);
                }
            }
            if (sawFile) {
                cm.add(new ParamModelData("upload", Boolean.class,
                        true, null));
                addedUploadOption = true;
                cm.setAddedUploadOption(true);
            }
            this.usage = cm.getUsage();
View Full Code Here

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

                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.prompt = getAttr(attributes, "prompt");
                    opt.promptAgain = getAttr(attributes, "promptAgain");
                }
                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;
                cm.setAddedUploadOption(true);
            }
        } catch (ParserConfigurationException pex) {
View Full Code Here

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

                    jsonOptions.put(optns);
                }
                for (int i = 0; i < jsonOptions.length(); i++) {
                    JSONObject jsOpt = jsonOptions.getJSONObject(i);
                    String type = jsOpt.getString("@type");
                    ParamModelData opt = new ParamModelData(
                            jsOpt.getString("@name"),
                            typeOf(type),
                            jsOpt.optBoolean("@optional", false),
                            jsOpt.optString("@default"),
                            jsOpt.optString("@short"),
                            jsOpt.optBoolean("@obsolete", false),
                            jsOpt.optString("@alias"));
                    opt.param._acceptableValues = jsOpt.optString("@acceptable-values");
                    if ("PASSWORD".equals(type)) {
                        opt.param._password = true;
                        opt.prompt = jsOpt.optString("@prompt");
                        opt.promptAgain = jsOpt.optString("@prompt-again");
                    } else if ("FILE".equals(type)) {
                        sawFile = true;
                    }
                    if (jsOpt.optBoolean("@primary", false)) {
                        opt.param._primary = true;
                    }
                    if (jsOpt.optBoolean("@multiple", false)) {
                        if (opt.type == File.class) {
                            opt.type = File[].class;
                        } else {
                            opt.type = List.class;
                        }
                        opt.param._multiple = true;
                    }
                    cm.add(opt);
                }
            }
            if (sawFile) {
                cm.add(new ParamModelData("upload", Boolean.class,
                        true, null));
                addedUploadOption = true;
                cm.setAddedUploadOption(true);
            }
            this.usage = cm.getUsage();
View Full Code Here

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

     * option processing.)
     */
    protected Collection<ParamModel> usageOptions() {
        Collection<ParamModel> opts = commandModel.getParameters();
        Set<ParamModel> uopts = new LinkedHashSet<ParamModel>();
        ParamModel aPort = new ParamModelData(ADMIN_PORT, String.class, true,
                Integer.toString(CLIConstants.DEFAULT_ADMIN_PORT));
        ParamModel iPort = new ParamModelData(INSTANCE_PORT, String.class, true,
                Integer.toString(DEFAULT_INSTANCE_PORT));
        for (ParamModel pm : opts) {
            if (pm.getName().equals(ADMIN_PORT))
                uopts.add(aPort);
            else if (pm.getName().equals(INSTANCE_PORT))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.