new CommandModelData.ParamModelData(pName, pCls, pOptional, pDefaultValue, pShortName, pObsolete, pAlias); new CommandModelData.ParamModelData(pName, pCls, pOptional, pDefaultValue, pShortName, pObsolete, pAlias);
str = ((ParamModelData) paramModel).getPrompt(); if (str != null && !str.isEmpty()) { bw.write(PROMPT_ELEMENT); bw.newLine(); str = ((ParamModelData) paramModel).getPromptAgain(); if (str != null && !str.isEmpty()) { bw.write(PROMPT_AGAIN_ELEMENT);
String obs = getAttr(attributes, "obsolete"); String alias = getAttr(attributes, "alias"); ParamModelData opt = new ParamModelData( getAttr(attributes, "name"), typeOf(getAttr(attributes, "type")), if (opt.getType() == File.class) sawFile = true; ParamModelData pm = new ParamModelData( getAttr(attributes, "name"), type, min == 0, null); pm.param._primary = true; cm.add(new ParamModelData("upload", Boolean.class, true, null)); addedUploadOption = true;
String obs = getAttr(attributes, "obsolete"); String alias = getAttr(attributes, "alias"); ParamModelData opt = new ParamModelData( getAttr(attributes, "name"), typeOf(getAttr(attributes, "type")), if (opt.getType() == File.class) sawFile = true; type = List.class; ParamModelData pm = new ParamModelData( getAttr(attributes, "name"), type, min == 0, null); pm.param._primary = true; cm.add(new ParamModelData("upload", Boolean.class, true, null)); addedUploadOption = true;
String promptAgain = null; if (opt instanceof ParamModelData) { prompt = ((ParamModelData)opt).getPrompt(); promptAgain = ((ParamModelData)opt).getPromptAgain();
JSONObject jsOpt = jsonOptions.getJSONObject(i); String type = jsOpt.getString("@type"); ParamModelData opt = new ParamModelData( jsOpt.getString("@name"), typeOf(type), cm.add(new ParamModelData("upload", Boolean.class, true, null)); addedUploadOption = true; cm.add(new ParamModelData("notify",Boolean.class,false, "false"));
commandModel.add(new ParamModelData("notify", boolean.class, true, "false"));
cm.add(new ParamModelData("help", boolean.class, true, "false", "?")); this.commandModel = cm; rac.setCommandModel(cm);
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");
if (!super.verifyMasterPassword(mp)) throw new CommandException(strings.get("incorrect.mp")); ParamModelData nmpo = new ParamModelData("AS_ADMIN_NEWMASTERPASSWORD", String.class, false, null); nmpo.description = strings.get("new.mp");
masterPasswordOption = new ParamModelData(CLIConstants.MASTER_PASSWORD, String.class, false, null); masterPasswordOption.prompt = Strings.get("MasterPassword");
ParamModelData npwo = new ParamModelData(newpwName, String.class, false, null); npwo.prompt = strings.get("new.adminpw", auser); npwo.promptAgain = strings.get("new.adminpw.again", auser);
/** * Add --adminport and --instanceport options with proper default values. * (Can't set default values above because it conflicts with --portbase * option processing.) */ @Override 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)) { uopts.add(iPort); } else { uopts.add(pm); } } return uopts; }
/** * Add --adminport and --instanceport options with * proper default values. (Can't set default values above * because it conflicts with --portbase 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)) uopts.add(iPort); else uopts.add(pm); } return uopts; }
/** * Get ParamModel for long option name. */ private ParamModel lookupLongOption(String s) { if (s == null || s.length() == 0) return null; // XXX - for now, fake it if no options if (options == null) { // no valid options specified so everything is valid return new ParamModelData(s, String.class, true, null); } for (ParamModel od : options) { if (od.getParam().primary()) continue; if (s.equalsIgnoreCase(od.getName())) return od; if (s.equalsIgnoreCase(od.getParam().alias())) return od; } return null; }
/** * Get ParamModel for long option name. */ private ParamModel lookupLongOption(String s) { if (s == null || s.length() == 0) return null; // XXX - for now, fake it if no options if (options == null) { // no valid options specified so everything is valid return new ParamModelData(s, String.class, true, null); } for (ParamModel od : options) { if (od.getParam().primary()) continue; if (s.equalsIgnoreCase(od.getName())) return od; if (s.equalsIgnoreCase(od.getParam().alias())) return od; } return null; }
/** * In the usage message modify the --printprompt option to have a * default based on the --interactive option. */ protected Collection<ParamModel> usageOptions() { Collection<ParamModel> opts = commandModel.getParameters(); Set<ParamModel> uopts = new LinkedHashSet<ParamModel>(); ParamModel p = new CommandModelData.ParamModelData("printprompt", boolean.class, true, Boolean.toString(programOpts.isInteractive())); for (ParamModel pm : opts) { if (pm.getName().equals("printprompt")) uopts.add(p); else uopts.add(pm); } return uopts; }
/** * In the usage message modify the --printprompt option to have a default * based on the --interactive option. */ protected Collection<ParamModel> usageOptions() { Collection<ParamModel> opts = commandModel.getParameters(); Set<ParamModel> uopts = new LinkedHashSet<ParamModel>(); ParamModel p = new CommandModelData.ParamModelData("printprompt", boolean.class, true, Boolean.toString(programOpts.isInteractive())); for (ParamModel pm : opts) { if (pm.getName().equals("printprompt")) uopts.add(p); else uopts.add(pm); } return uopts; }
/** * Helper method to define a meta-option. * * @param name long option name * @param sname short option name * @param type option type (String.class, Boolean.class, etc.) * @param req is option required? * @param def default value for option */ private static void addMetaOption(Set<ParamModel> opts, String name, char sname, Class type, boolean req, String def) { ParamModel opt = new ParamModelData(name, type, !req, def, Character.toString(sname)); opts.add(opt); }
/** * Helper method to define a meta-option. * * @param name long option name * @param sname short option name * @param type option type (String.class, Boolean.class, etc.) * @param req is option required? * @param def default value for option */ private static void addMetaOption(Set<ParamModel> opts, String name, char sname, Class type, boolean req, String def) { ParamModel opt = new ParamModelData(name, type, !req, def, Character.toString(sname)); opts.add(opt); }