List of usage examples for org.apache.commons.cli Option setOptionalArg
public void setOptionalArg(boolean optionalArg)
From source file:org.ow2.proactive.resourcemanager.utils.RMNodeStarter.java
/** * Fills the command line options./*from w ww . j a v a2s .c o m*/ * @param options the options to fill */ protected void fillOptions(final Options options) { // The path to the file that contains the credential final Option credentialFile = new Option(Character.toString(OPTION_CREDENTIAL_FILE), "credentialFile", true, "path to file that contains the credential"); credentialFile.setRequired(false); credentialFile.setArgName("path"); options.addOption(credentialFile); // The credential passed as environment variable final Option credentialEnv = new Option(Character.toString(OPTION_CREDENTIAL_ENV), "credentialEnv", true, "name of the environment variable that contains the credential"); credentialEnv.setRequired(false); credentialEnv.setArgName("name"); options.addOption(credentialEnv); // The credential passed as value final Option credVal = new Option(Character.toString(OPTION_CREDENTIAL_VAL), "credentialVal", true, "explicit value of the credential"); credVal.setRequired(false); credVal.setArgName("credential"); options.addOption(credVal); // The url of the resource manager final Option rmURL = new Option(Character.toString(OPTION_RM_URL), "rmURL", true, "URL of the resource manager. If no URL is provided, the node won't register."); rmURL.setRequired(false); rmURL.setArgName("url"); options.addOption(rmURL); // The node name final Option nodeName = new Option(Character.toString(OPTION_NODE_NAME), "nodeName", true, "node name (default is hostname_pid)"); nodeName.setRequired(false); nodeName.setArgName("name"); options.addOption(nodeName); // The node source name final Option sourceName = new Option(Character.toString(OPTION_SOURCE_NAME), "sourceName", true, "node source name"); sourceName.setRequired(false); sourceName.setArgName("name"); options.addOption(sourceName); // The wait on join timeout in millis final Option waitOnJoinTimeout = new Option(OPTION_WAIT_AND_JOIN_TIMEOUT, "waitOnJoinTimeout", true, "wait on join the resource manager timeout in millis (default is " + WAIT_ON_JOIN_TIMEOUT_IN_MS + ")"); waitOnJoinTimeout.setRequired(false); waitOnJoinTimeout.setArgName("millis"); options.addOption(waitOnJoinTimeout); // The ping delay in millis final Option pingDelay = new Option(Character.toString(OPTION_PING_DELAY), "pingDelay", true, "ping delay in millis used by RMPinger thread that calls System.exit(1) if the resource manager is down (default is " + PING_DELAY_IN_MS + "). A null or negative frequency means no ping at all."); pingDelay.setRequired(false); pingDelay.setArgName("millis"); options.addOption(pingDelay); // The number of attempts option final Option addNodeAttempts = new Option(Character.toString(OPTION_ADD_NODE_ATTEMPTS), "addNodeAttempts", true, "number of attempts to add the node(s) to the resource manager. Default is " + NB_OF_ADD_NODE_ATTEMPTS + "). When 0 is specified node(s) remains alive without " + "trying to add itself to the RM. Otherwise the process is terminated when number " + "of attempts exceeded."); addNodeAttempts.setRequired(false); addNodeAttempts.setArgName("number"); options.addOption(addNodeAttempts); // The delay between attempts option final Option addNodeAttemptsDelay = new Option(Character.toString(OPTION_ADD_NODE_ATTEMPTS_DELAY), "addNodeAttemptsDelay", true, "delay in millis between attempts to add the node(s) to the resource manager (default is " + ADD_NODE_ATTEMPTS_DELAY_IN_MS + ")"); addNodeAttemptsDelay.setRequired(false); addNodeAttemptsDelay.setArgName("millis"); options.addOption(addNodeAttemptsDelay); // The discovery port final Option discoveryPort = new Option(OPTION_DISCOVERY_PORT, "discoveryPort", true, "port to use for RM discovery (default is " + this.discoveryPort + ")"); discoveryPort.setRequired(false); options.addOption(discoveryPort); // The discovery timeout final Option discoveryTimeout = new Option(OPTION_DISCOVERY_TIMEOUT, "discoveryTimeout", true, "timeout to use for RM discovery (default is " + discoveryTimeoutInMs + "ms)"); discoveryTimeout.setRequired(false); options.addOption(discoveryTimeout); // The number of workers final Option workers = new Option(OPTION_WORKERS, "workers", true, "Number of workers, i.e number of tasks that can be executed in parallel on this node (default is 1). If no value specified, number of cores."); workers.setRequired(false); workers.setOptionalArg(true); options.addOption(workers); final Option availabilityReportTimeout = new Option(OPTION_AVAILABILITY_REPORT_TIMEOUT, "availabilityReportTimeout", true, "The maximum time to wait in milliseconds for retrieving the answer for the node availability report that is pushed periodically."); availabilityReportTimeout.setRequired(false); availabilityReportTimeout.setArgName("timeInMilliseconds"); options.addOption(availabilityReportTimeout); // Displays the help final Option help = new Option(Character.toString(OPTION_HELP), "help", false, "to display this help"); help.setRequired(false); options.addOption(help); // Disable monitoring final Option monitorOption = new Option(OPTION_DISABLE_MONITORING, "disableMonitoring", false, "to disable JMX node monitoring functionality"); monitorOption.setRequired(false); options.addOption(monitorOption); }
From source file:org.ow2.proactive.scheduler.util.console.SchedulerController.java
protected OptionGroup addCommandLineOptions(Options options) { OptionGroup actionGroup = new OptionGroup(); Option opt = new Option("s", "submit", true, control + "Submit the given job XML file"); opt.setArgName("XMLDescriptor"); opt.setRequired(false);/*ww w .j a v a 2s . com*/ opt.setArgs(Option.UNLIMITED_VALUES); actionGroup.addOption(opt); opt = new Option("sa", "submitarchive", true, control + "Submit the given job archive"); opt.setArgName("jobarchive"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("cmd", "command", false, control + "If mentionned, -submit argument becomes a command line, ie: -submit command args..."); opt.setRequired(false); options.addOption(opt); opt = new Option("cmdf", "commandf", false, control + "If mentionned, -submit argument becomes a text file path containing command lines to schedule"); opt.setRequired(false); options.addOption(opt); opt = new Option("ss", "selectscript", true, control + "Used with -cmd or -cmdf, specify a selection script"); opt.setArgName("selectScript"); opt.setRequired(false); opt.setArgs(1); options.addOption(opt); opt = new Option("jn", "jobname", true, control + "Used with -cmd or -cmdf, specify the job name"); opt.setArgName("jobName"); opt.setRequired(false); opt.setArgs(1); options.addOption(opt); opt = new Option("pj", "pausejob", true, control + "Pause the given job (pause every non-running tasks)"); opt.setArgName("jobId"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("rj", "resumejob", true, control + "Resume the given job (restart every paused tasks)"); opt.setArgName("jobId"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("kj", "killjob", true, control + "Kill the given job (cause the job to finish)"); opt.setArgName("jobId"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("rmj", "removejob", true, control + "Remove the given job"); opt.setArgName("jobId"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("pt", "preempttask", true, control + "Stop the given task and re-schedules it after specified delay."); opt.setArgName("jobId taskName delay"); opt.setRequired(false); opt.setArgs(3); actionGroup.addOption(opt); opt = new Option("rt", "restarttask", true, control + "Terminate the given task and re-schedules it after specified delay."); opt.setArgName("jobId taskName delay"); opt.setRequired(false); opt.setArgs(3); actionGroup.addOption(opt); opt = new Option("kt", "killtask", true, control + "Kill the given task."); opt.setArgName("jobId taskName"); opt.setRequired(false); opt.setArgs(2); actionGroup.addOption(opt); opt = new Option("jr", "jobresult", true, control + "Get the result of the given job"); opt.setArgName("jobId"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("tr", "taskresult", true, control + "Get the result of the given task"); opt.setArgName("jobId taskName [inc]"); opt.setRequired(false); opt.setArgs(3); opt.setOptionalArg(true); actionGroup.addOption(opt); opt = new Option("jo", "joboutput", true, control + "Get the output of the given job"); opt.setArgName("jobId"); opt.setRequired(false); opt.setArgs(2); actionGroup.addOption(opt); opt = new Option("to", "taskoutput", true, control + "Get the output of the given task"); opt.setArgName("jobId taskName"); opt.setRequired(false); opt.setArgs(2); actionGroup.addOption(opt); opt = new Option("jp", "jobpriority", true, control + "Change the priority of the given job (Idle, Lowest, Low, Normal, High, Highest)"); opt.setArgName("jobId newPriority"); opt.setRequired(false); opt.setArgs(2); actionGroup.addOption(opt); opt = new Option("js", "jobstate", true, control + "Get the current state of the given job (Also tasks description)"); opt.setArgName("jobId"); opt.setRequired(false); opt.setArgs(2); actionGroup.addOption(opt); opt = new Option("lj", "listjobs", false, control + "Display the list of jobs managed by the scheduler"); opt.setRequired(false); opt.setArgs(0); actionGroup.addOption(opt); opt = new Option("stats", "statistics", false, control + "Display some statistics about the Scheduler"); opt.setRequired(false); opt.setArgs(0); actionGroup.addOption(opt); opt = new Option("ma", "myaccount", false, control + "Display current user account information"); opt.setRequired(false); opt.setArgs(0); actionGroup.addOption(opt); opt = new Option("ua", "useraccount", false, control + "Display account information by username"); opt.setRequired(false); opt.setArgs(1); opt.setArgName("username"); actionGroup.addOption(opt); opt = new Option("rc", "reloadconfig", false, control + "Reloads the scheduler permission policy and log4j config"); opt.setRequired(false); opt.setArgs(0); actionGroup.addOption(opt); opt = new Option("sf", "script", true, control + "Execute the given javascript file with optional arguments."); opt.setArgName("filePath arg1=val1 arg2=val2 ..."); opt.setRequired(false); opt.setArgs(Option.UNLIMITED_VALUES); opt.setOptionalArg(true); actionGroup.addOption(opt); opt = new Option("env", "environment", true, "Execute the given script as an environment for the interactive mode"); opt.setArgName("filePath"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("test", false, control + "Test if the Scheduler is successfully started by committing some examples"); opt.setRequired(false); opt.setArgs(0); actionGroup.addOption(opt); opt = new Option("c", "credentials", true, "Path to the credentials (" + Credentials.getCredentialsPath() + ")."); opt.setRequired(false); opt.setOptionalArg(true); options.addOption(opt); options.addOptionGroup(actionGroup); opt = new Option("start", "schedulerstart", false, control + "Start the Scheduler"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("stop", "schedulerstop", false, control + "Stop the Scheduler"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("pause", "schedulerpause", false, control + "Pause the Scheduler (cause all non-running jobs to be paused)"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("freeze", "schedulerfreeze", false, control + "Freeze the Scheduler (cause all non-running tasks to be paused)"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("resume", "schedulerresume", false, control + "Resume the Scheduler"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("shutdown", "schedulershutdown", false, control + "Shutdown the Scheduler"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("kill", "schedulerkill", false, control + "Kill the Scheduler"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("lrm", "linkrm", true, control + "Reconnect a RM to the scheduler"); opt.setArgName("rmURL"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("pr", "policyreload", false, control + "Reload the policy configuration"); opt.setRequired(false); actionGroup.addOption(opt); opt = new Option("p", "policy", true, control + "Change the current scheduling policy"); opt.setArgName("fullName"); opt.setRequired(false); opt.setArgs(1); actionGroup.addOption(opt); opt = new Option("ll", "logs", true, control + "Get server logs of given job or task"); opt.setArgName("jobId [taskName]"); opt.setRequired(false); opt.setArgs(2); actionGroup.addOption(opt); options.addOptionGroup(actionGroup); return actionGroup; }
From source file:org.ow2.proactive_grid_cloud_portal.cli.CommandFactory.java
protected Options createOptions(Collection<CommandSet.Entry> entries) { Options options = new Options(); for (CommandSet.Entry entry : entries) { Option option = new Option(entry.opt(), entry.longOpt(), entry.hasArgs(), entry.description()); option.setArgName(entry.argNames()); option.setArgs(entry.numOfArgs()); option.setOptionalArg(entry.hasOptionalArg()); options.addOption(option);//from w w w . ja v a2 s . c o m } return options; }
From source file:org.seedstack.seed.core.internal.cli.CliModel.java
CliModel(Set<Field> fields) { for (Field field : fields) { CliOption optionAnnotation = field.getAnnotation(CliOption.class); CliArgs argsAnnotation = field.getAnnotation(CliArgs.class); if (optionAnnotation != null) { Option option = new Option(optionAnnotation.name(), optionAnnotation.longName(), optionAnnotation.valueCount() > 0 || optionAnnotation.valueCount() == -1, optionAnnotation.description()); if (optionAnnotation.valueCount() == -1) { option.setArgs(Option.UNLIMITED_VALUES); } else if (optionAnnotation.valueCount() > 0) { option.setArgs(optionAnnotation.valueCount()); }// w ww . j av a 2 s . co m option.setValueSeparator(optionAnnotation.valueSeparator()); option.setRequired(optionAnnotation.mandatory()); option.setOptionalArg(!optionAnnotation.mandatoryValue()); optionAnnotations.add(optionAnnotation); optionFields.add(field); options.addOption(option); } else if (argsAnnotation != null) { mandatoryArgsCount = argsAnnotation.mandatoryCount(); argsField = field; } } }
From source file:org.uli.util.MyOptionBuilder.java
/** * Create an Option using the current settings and with * the specified Option <code>char</code>. * * @param opt the <code>java.lang.String</code> representation * of the Option//from w w w . j a v a 2 s . co m * @return the Option instance * @throws IllegalArgumentException if <code>opt</code> is not * a valid character. See Option. */ public Option create(String opt) throws IllegalArgumentException { Option option = null; try { // create the option option = new Option(opt, description); // set the option properties option.setLongOpt(longopt); option.setRequired(required); option.setOptionalArg(optionalArg); option.setArgs(numberOfArgs); option.setType(type); option.setValueSeparator(valuesep); option.setArgName(argName); } finally { // reset the OptionBuilder properties this.reset(); } // return the Option instance return option; }
From source file:org.wildfly.security.tool.CredentialStoreCommand.java
CredentialStoreCommand() { options = new Options(); Option opt = new Option("l", STORE_LOCATION_PARAM, true, ElytronToolMessages.msg.cmdLineStoreLocationDesc()); opt.setArgName("loc"); opt.setOptionalArg(false); options.addOption(opt);//w w w . j a v a 2 s . co m opt = new Option("u", IMPLEMENTATION_PROPERTIES_PARAM, true, ElytronToolMessages.msg.cmdLineImplementationPropertiesDesc()); options.addOption(opt); opt = new Option("p", CREDENTIAL_STORE_PASSWORD_PARAM, true, ElytronToolMessages.msg.cmdLineCredentialStorePassword()); opt.setArgName("pwd"); options.addOption(opt); options.addOption("s", SALT_PARAM, true, ElytronToolMessages.msg.cmdLineSaltDesc()); options.addOption("i", ITERATION_PARAM, true, ElytronToolMessages.msg.cmdLineIterationCountDesc()); opt = new Option("x", PASSWORD_CREDENTIAL_VALUE_PARAM, true, ElytronToolMessages.msg.cmdLinePasswordCredentialValueDesc()); opt.setArgName("secret to store"); opt.setOptionalArg(true); options.addOption(opt); opt = new Option("n", ENTRY_TYPE_PARAM, true, ElytronToolMessages.msg.cmdLineEntryTypeDesc()); opt.setArgName("type"); opt.setOptionalArg(true); options.addOption(opt); opt = new Option("o", OTHER_PROVIDERS_PARAM, true, ElytronToolMessages.msg.cmdLineOtherProvidersDesc()); opt.setArgName("providers"); opt.setOptionalArg(true); options.addOption(opt); opt = new Option("q", CUSTOM_CREDENTIAL_STORE_PROVIDER_PARAM, true, ElytronToolMessages.msg.cmdLineCustomCredentialStoreProviderDesc()); opt.setArgName("cs-provider"); opt.setOptionalArg(true); options.addOption(opt); options.addOption("c", CREATE_CREDENTIAL_STORE_PARAM, false, ElytronToolMessages.msg.cmdLineCreateCredentialStoreDesc()); opt = new Option("t", CREDENTIAL_STORE_TYPE_PARAM, true, ElytronToolMessages.msg.cmdLineCredentialStoreTypeDesc()); opt.setArgName("type"); options.addOption(opt); options.addOption("f", PRINT_SUMMARY_PARAM, false, ElytronToolMessages.msg.cmdLinePrintSummary()); OptionGroup og = new OptionGroup(); Option a = new Option("a", ADD_ALIAS_PARAM, true, ElytronToolMessages.msg.cmdLineAddAliasDesc()); a.setArgName("alias"); Option e = new Option("e", CHECK_ALIAS_PARAM, true, ElytronToolMessages.msg.cmdLineCheckAliasDesc()); e.setArgName("alias"); Option r = new Option("r", REMOVE_ALIAS_PARAM, true, ElytronToolMessages.msg.cmdLineRemoveAliasDesc()); r.setArgName("alias"); Option v = new Option("v", ALIASES_PARAM, false, ElytronToolMessages.msg.cmdLineAliasesDesc()); Option h = new Option("h", HELP_PARAM, false, ElytronToolMessages.msg.cmdLineHelp()); Option d = new Option("d", DEBUG_PARAM, false, ElytronToolMessages.msg.cmdLineDebug()); og.addOption(a); og.addOption(e); og.addOption(r); og.addOption(v); options.addOptionGroup(og); options.addOption(h); options.addOption(d); }
From source file:org.wildfly.security.tool.VaultCommand.java
public VaultCommand() { options = new Options(); // PB vault related options Option o = new Option("k", KEYSTORE_PARAM, true, ElytronToolMessages.msg.cmdLineVaultKeyStoreURL()); o.setArgName(KEYSTORE_PARAM);/*from ww w .j a v a 2 s . co m*/ options.addOption(o); o = new Option("p", KEYSTORE_PASSWORD_PARAM, true, ElytronToolMessages.msg.cmdLineVaultKeyStorePassword()); o.setArgName("pwd"); options.addOption(o); o = new Option("e", ENC_DIR_PARAM, true, ElytronToolMessages.msg.cmdLineVaultEncryptionDirectory()); o.setArgName("dir"); options.addOption(o); o = new Option("s", SALT_PARAM, true, ElytronToolMessages.msg.cmdVaultLineSalt()); o.setArgName("salt"); options.addOption(o); o = new Option("i", ITERATION_PARAM, true, ElytronToolMessages.msg.cmdLineVaultIterationCount()); options.addOption(o); o = new Option("v", ALIAS_PARAM, true, ElytronToolMessages.msg.cmdLineVaultKeyStoreAlias()); options.addOption(o); // Credential Store generation options o = new Option("l", STORE_LOCATION_PARAM, true, ElytronToolMessages.msg.cmdLineVaultCSLocationDesc()); o.setArgName("loc"); options.addOption(o); o = new Option("u", CredentialStoreCommand.IMPLEMENTATION_PROPERTIES_PARAM, true, ElytronToolMessages.msg.cmdLineVaultCSParametersDesc()); o.setValueSeparator(';'); o.setOptionalArg(true); options.addOption(o); o = new Option("t", CredentialStoreCommand.CREDENTIAL_STORE_TYPE_PARAM, true, ElytronToolMessages.msg.cmdLineVaultCSTypeDesc()); o.setArgName("type"); options.addOption(o); o = new Option("o", CredentialStoreCommand.OTHER_PROVIDERS_PARAM, true, ElytronToolMessages.msg.cmdLineOtherProvidersDesc()); o.setArgName("providers"); o.setOptionalArg(true); options.addOption(o); o = new Option("q", CredentialStoreCommand.CUSTOM_CREDENTIAL_STORE_PROVIDER_PARAM, true, ElytronToolMessages.msg.cmdLineCustomCredentialStoreProviderDesc()); o.setArgName("cs-provider"); o.setOptionalArg(true); options.addOption(o); options.addOption("f", PRINT_SUMMARY_PARAM, false, ElytronToolMessages.msg.cmdLineVaultPrintSummary()); Option b = new Option("b", BULK_CONVERT_PARAM, true, ElytronToolMessages.msg.cliCommandBulkVaultCredentialStoreConversion()); b.setArgName("description file"); Option h = new Option("h", HELP_PARAM, false, ElytronToolMessages.msg.cmdLineHelp()); Option d = new Option("d", DEBUG_PARAM, false, ElytronToolMessages.msg.cmdLineDebug()); options.addOption(b); options.addOption(h); options.addOption(d); }
From source file:ru.apertum.qsystem.common.QConfig.java
private QConfig() { try {//from w ww . jav a2 s .com if (new File(Uses.PROPERTIES_FILE).exists()) { this.config = new PropertiesConfiguration(Uses.PROPERTIES_FILE); } else { this.config = new PropertiesConfiguration(); } } catch (ConfigurationException ex) { throw new RuntimeException("Properties file wasn't read.", ex); } options.addOption("?", "hey", false, "Show information about command line arguments"); options.addOption("h", "help", false, "Show information about command line arguments"); /* CLIENT: ide -s 127.0.0.1 -cport 3129 -sport 3128 -cfg config/clientboard.xml -cfgfx1 config/clientboardfx.properties -point1 234 debug -terminal1 RECEPTION: ide -s 127.0.0.1 -cport 3129 -sport 3128 debug WELCOME: ide -s 127.0.0.1 -sport 3128 -cport 3129 debug med info1 -buttons1 demo1 -clangs1 -keyboard1 Option o = new Option("log", "loglavel", true, "Level for logger log4j. It have higher priority than properties file."); o.setArgName("ebat'"); options.addOption(o); */ // 0-?,1-,2-?,3-,4-?,5-? , 26 - , 17 - //type = -1; options.addOption("ndiv", KEY_NUM_DIVIDER, true, "Divider for client ticket number between prefix and number. For ex: A-800. Default is empty."); options.addOption("d", KEY_DEBUG, false, "Debug mode. Show all messages in console and do not make forms fulscreen."); options.addOption("li", KEY_LOG_INFO, false, "Logging mode. Info level only."); if (type == -1 || type == 0 || type == 1 || type == 4 || type == 26) { options.addOption(KEY_DEMO, false, "Demo mode. You can use mouse and you can see header of forms."); options.addOption("nhc", KEY_NO_HIDE_CURSOR, false, "No-hide-cursor mode. In some linux GUI could be problen with hide cursor."); } options.addOption(KEY_IDE, false, "Do not touch it!"); if (type == -1 || type == 5) { options.addOption("ubs", KEY_START, false, "Auto start for hardware user buttons: YES"); } options.addOption("np", KEY_NOPLUGINS, false, "Do not load plugins."); Option o = new Option("p", KEY_DELAY, true, "Do delay before starting. It can be useful for waiting for prepared other components of QSystem."); o.setArgName("in seconds"); options.addOption(o); if (type == -1 || type == 0 || type == 1) { options.addOption("t", KEY_TERMINAL, false, "If QSystem working in terminal environment. Not on dedicated computers."); } if (type == -1 || type == 4) { o = new Option("wm", KEY_WELCOME_MODE, true, "If welcome app is not a touch kiosk.\ninfo - just show and print an information.\nmed - Input some number and stand for advance.\nbtn - if it is special hardware buttons device.\nkbd- Ability to work for registration point if there is only a keyboard ar mouse. A list of services in the form of a picture which indicate that to press on keyboard or mouse for a particular service."); o.setArgName("touch,info,med,btn,kbd"); options.addOption(o); options.addOption("cl", KEY_CLANGS, false, "Manage multi language mode before start welcome point."); } if (type == -1 || type == 0) { options.addOption("r", KEY_RETAIN, false, "Always to keep the state after restart the server QSystem."); o = new Option("dfi", KEY_DELAY_INVITE_FIRST, true, "Pause before calling a client by user after getting line. To have time to run into the room."); o.setArgName("in seconds"); options.addOption(o); o = new Option("http", KEY_HTTP, true, "To start built-in http server which support servlets and web-socket. Specify a port."); o.setArgName("port"); options.addOption(o); } if (type == -1 || type == 1) { o = new Option("pt", KEY_POINT, true, "Alternative label for user's workplace.."); o.setOptionalArg(true); o.setArgName("label"); options.addOption(o); o = new Option("cfg", KEY_BOARD_CFG, true, "Config xml file for main board."); o.setArgName("xml-file"); options.addOption(o); o = new Option("cfgfx", KEY_BOARD_FX_CFG, true, "Config properties file for main board as FX form."); o.setArgName("file"); options.addOption(o); } if (type == -1 || type == 1 || type == 2 || type == 4) { //-s 127.0.0.1 -sport 3128 -cport 3129 o = new Option("s", KEY_S, true, "Address of QMS QSystem server."); o.setArgName("label"); options.addOption(o); o = new Option("sport", KEY_S_PORT, true, "TCP port of QMS QSystem server."); o.setArgName("port"); options.addOption(o); o = new Option("cport", KEY_C_PORT, true, "UDP port of user's computer for receiving message from server."); o.setArgName("port"); options.addOption(o); } if (type == -1 || type == 3) { options.addOption("uep", KEY_USE_EXT_PRIORITY, false, "Bad. Forget about it. This is amount of additional priorities for services."); } if (type == -1 || type == 26) { o = new Option("zcfg", ZKEY_BOARD_CFG, true, "Config xml file for zone board."); o.setArgName("xml-file"); options.addOption(o); } if (type == -1 || type == 17) { o = new Option("tcfg", TKEY_BOARD_CFG, true, "Config xml file for board."); o.setArgName("xml-file"); options.addOption(o); } try { // create the parser line = parser.parse(options, new String[0]); } catch (ParseException ex) { } try { tcpServerAddress = InetAddress.getByName(getServerAddress()); } catch (UnknownHostException exception) { throw new ServerException("Address TCP server is not correct.", exception); } }
From source file:ru.taximaxim.dbreplicator2.cli.AbstractCommandLineParser.java
/** * ? /*from w ww. j av a 2s.c om*/ * * @param opt * - ? ? * * @param longOpt * - ? * * @param hasArg * - * * @param description * - ? * * @param num * <code>Integer</code> - ? * * @param optionalArg * - <code>boolean</code> * * @param argName * - ? * */ protected void setOption(String opt, String longOpt, boolean hasArg, String description, Integer num, boolean optionalArg, String argName) { Option option = new Option(opt, longOpt, hasArg, description); if (num != null) { option.setArgs(num); } option.setOptionalArg(optionalArg); option.setArgName(argName); posixOptions.addOption(option); }
From source file:scalabilityTests.scenarios.SchedulerJobSubmission.java
private static void addCommandLineOptions(Options options) { Option help = new Option("h", "help", false, "Display this help"); help.setRequired(false);//from w ww .java 2 s . com options.addOption(help); Option xmlDescriptor = new Option("ad", "gcmad", true, "path to the GCM Aplication Descriptor to be used"); xmlDescriptor.setArgName("GCMA_xml"); xmlDescriptor.setArgs(1); xmlDescriptor.setRequired(true); options.addOption(xmlDescriptor); Option vnode = new Option("vn", "virtualNode", true, "the name of the virtual node which identifies the nodes onto which the Active Object Actors will be deployed"); vnode.setArgName("AO_nodes"); vnode.setArgs(1); vnode.setRequired(true); options.addOption(vnode); Option schedulerUrl = new Option("u", "schedulerUrl", true, "the URL of the Scheduler"); schedulerUrl.setArgName("schedulerURL"); schedulerUrl.setArgs(1); schedulerUrl.setRequired(true); options.addOption(schedulerUrl); Option username = new Option("l", "login", true, "The username to join the Scheduler"); username.setArgName("login"); username.setArgs(1); username.setRequired(false); options.addOption(username); Option password = new Option("p", "password", true, "The password to join the Scheduler"); password.setArgName("pwd"); password.setArgs(1); password.setRequired(false); options.addOption(password); Option loginFile = new Option("lf", "loginFile", true, "The path to a file containing valid username:password combinations for the Scheduler"); loginFile.setArgName("login_cfg"); loginFile.setArgs(1); loginFile.setRequired(false); options.addOption(loginFile); Option jobDescriptor = new Option("j", "jobDesc", true, "The path to the XML job descriptor"); jobDescriptor.setArgName("XML_Job_Descriptor"); jobDescriptor.setArgs(1); jobDescriptor.setRequired(true); options.addOption(jobDescriptor); Option registerListeners = new Option("rl", "listener", false, "Register the specified Scheduler listener for each user. If no listener is specified, then a 'simple' scheduler listener will be registered"); registerListeners.setRequired(false); registerListeners.setOptionalArg(true); registerListeners.setArgs(1); registerListeners.setArgName("listenerClassName"); options.addOption(registerListeners); Option jobRepetition = new Option("rp", "repeats", true, "The number of times the job will be submitted(optional parameter; by default it will be set to 1)"); jobRepetition.setRequired(false); jobRepetition.setArgName("jobRepeats"); jobRepetition.setArgs(1); options.addOption(jobRepetition); Option jobResult = new Option("jr", "jobResult", false, "Fetch the result for the submitted jobs. Optional parameter, defaults to false"); jobResult.setRequired(false); options.addOption(jobResult); OptionGroup initialStateGroup = new OptionGroup(); initialStateGroup.setRequired(false); Option gui = new Option("gu", "gui", false, "Simulate an user which interacts with the Scheduler using a GUI(all scheduler state will be downloaded at login)"); gui.setRequired(false); initialStateGroup.addOption(gui); Option cli = new Option("cu", "cli", false, "Simulate an user which interacts with the Scheduler using a CLI(the scheduler state will NOT be downloaded at login)"); cli.setRequired(false); initialStateGroup.addOption(cli); options.addOptionGroup(initialStateGroup); Option myEventsOnly = new Option("me", "myEvsOnly", false, "While registering a listener, get only the events which concern me"); myEventsOnly.setRequired(false); options.addOption(myEventsOnly); }