List of usage examples for org.apache.commons.cli Option setRequired
public void setRequired(boolean required)
From source file:org.apache.directory.server.tools.commands.importcmd.ImportCommandCL.java
public Options getOptions() { Options opts = new Options(); Option op = new Option("h", "host", true, "server host: defaults to localhost"); op.setRequired(false); opts.addOption(op);// w ww. ja v a 2s .c o m op = new Option("p", "port", true, "server port: defaults to 10389 or server.xml specified port"); op.setRequired(false); opts.addOption(op); op = new Option("u", "user", true, "the user: default to uid=admin, ou=system"); op.setRequired(false); opts.addOption(op); op = new Option("w", "password", true, "the apacheds administrator's password: defaults to secret"); op.setRequired(false); opts.addOption(op); op = new Option("a", "auth", true, "the authentication mode: defaults to 'simple'"); op.setRequired(false); opts.addOption(op); op = new Option("f", "file", true, "the ldif file to import"); op.setRequired(true); opts.addOption(op); op = new Option("e", "ignore", false, "continue to process the file even if errors are encountered "); op.setRequired(false); opts.addOption(op); return opts; }
From source file:org.apache.falcon.cli.FalconCLI.java
private Options entityOptions() { Options entityOptions = new Options(); Option submit = new Option(SUBMIT_OPT, false, "Submits an entity xml to Falcon"); Option update = new Option(UPDATE_OPT, false, "Updates an existing entity xml"); Option schedule = new Option(SCHEDULE_OPT, false, "Schedules a submited entity in Falcon"); Option suspend = new Option(SUSPEND_OPT, false, "Suspends a running entity in Falcon"); Option resume = new Option(RESUME_OPT, false, "Resumes a suspended entity in Falcon"); Option delete = new Option(DELETE_OPT, false, "Deletes an entity in Falcon, and kills its instance from workflow engine"); Option submitAndSchedule = new Option(SUBMIT_AND_SCHEDULE_OPT, false, "Submits and entity to Falcon and schedules it immediately"); Option validate = new Option(VALIDATE_OPT, false, "Validates an entity based on the entity type"); Option status = new Option(STATUS_OPT, false, "Gets the status of entity"); Option definition = new Option(DEFINITION_OPT, false, "Gets the Definition of entity"); Option dependency = new Option(DEPENDENCY_OPT, false, "Gets the dependencies of entity"); Option list = new Option(LIST_OPT, false, "List entities registered for a type"); Option lookup = new Option(LOOKUP_OPT, false, "Lookup a feed given its instance's path"); Option entitySummary = new Option(SUMMARY_OPT, false, "Get summary of instances for list of entities"); Option touch = new Option(TOUCH_OPT, false, "Force update the entity in workflow engine(even without any changes to entity)"); OptionGroup group = new OptionGroup(); group.addOption(submit);/*from w w w . ja v a 2 s .c o m*/ group.addOption(update); group.addOption(schedule); group.addOption(suspend); group.addOption(resume); group.addOption(delete); group.addOption(submitAndSchedule); group.addOption(validate); group.addOption(status); group.addOption(definition); group.addOption(dependency); group.addOption(list); group.addOption(lookup); group.addOption(entitySummary); group.addOption(touch); Option url = new Option(URL_OPTION, true, "Falcon URL"); Option entityType = new Option(ENTITY_TYPE_OPT, true, "Entity type, can be cluster, feed or process xml"); Option filePath = new Option(FILE_PATH_OPT, true, "Path to entity xml file"); Option entityName = new Option(ENTITY_NAME_OPT, true, "Entity type, can be cluster, feed or process xml"); Option start = new Option(START_OPT, true, "Start time is optional for summary"); Option end = new Option(END_OPT, true, "End time is optional for summary"); Option colo = new Option(COLO_OPT, true, "Colo name"); Option cluster = new Option(CLUSTER_OPT, true, "Cluster name"); colo.setRequired(false); Option fields = new Option(FIELDS_OPT, true, "Entity fields to show for a request"); Option filterBy = new Option(FILTER_BY_OPT, true, "Filter returned entities by the specified status"); Option filterTags = new Option(TAGS_OPT, true, "Filter returned entities by the specified tags"); Option nameSubsequence = new Option(NAMESEQ_OPT, true, "Subsequence of entity name"); Option tagKeywords = new Option(TAGKEYS_OPT, true, "Keywords in tags"); Option orderBy = new Option(ORDER_BY_OPT, true, "Order returned entities by this field"); Option sortOrder = new Option(SORT_ORDER_OPT, true, "asc or desc order for results"); Option offset = new Option(OFFSET_OPT, true, "Start returning entities from this offset"); Option numResults = new Option(NUM_RESULTS_OPT, true, "Number of results to return per request"); Option numInstances = new Option(NUM_INSTANCES_OPT, true, "Number of instances to return per entity summary request"); Option path = new Option(PATH_OPT, true, "Path for a feed's instance"); Option skipDryRun = new Option(SKIPDRYRUN_OPT, false, "skip dry run in workflow engine"); Option doAs = new Option(DO_AS_OPT, true, "doAs user"); entityOptions.addOption(url); entityOptions.addOption(path); entityOptions.addOptionGroup(group); entityOptions.addOption(entityType); entityOptions.addOption(entityName); entityOptions.addOption(filePath); entityOptions.addOption(colo); entityOptions.addOption(cluster); entityOptions.addOption(start); entityOptions.addOption(end); entityOptions.addOption(fields); entityOptions.addOption(filterBy); entityOptions.addOption(filterTags); entityOptions.addOption(nameSubsequence); entityOptions.addOption(tagKeywords); entityOptions.addOption(orderBy); entityOptions.addOption(sortOrder); entityOptions.addOption(offset); entityOptions.addOption(numResults); entityOptions.addOption(numInstances); entityOptions.addOption(skipDryRun); entityOptions.addOption(doAs); return entityOptions; }
From source file:org.apache.falcon.cli.FalconEntityCLI.java
public Options createEntityOptions() { Options entityOptions = new Options(); Option submit = new Option(SUBMIT_OPT, false, "Submits an entity xml to Falcon"); Option update = new Option(UPDATE_OPT, false, "Updates an existing entity xml"); Option schedule = new Option(SCHEDULE_OPT, false, "Schedules a submited entity in Falcon"); Option suspend = new Option(SUSPEND_OPT, false, "Suspends a running entity in Falcon"); Option resume = new Option(RESUME_OPT, false, "Resumes a suspended entity in Falcon"); Option delete = new Option(DELETE_OPT, false, "Deletes an entity in Falcon, and kills its instance from workflow engine"); Option submitAndSchedule = new Option(SUBMIT_AND_SCHEDULE_OPT, false, "Submits and entity to Falcon and schedules it immediately"); Option validate = new Option(VALIDATE_OPT, false, "Validates an entity based on the entity type"); Option status = new Option(STATUS_OPT, false, "Gets the status of entity"); Option definition = new Option(DEFINITION_OPT, false, "Gets the Definition of entity"); Option dependency = new Option(DEPENDENCY_OPT, false, "Gets the dependencies of entity"); Option list = new Option(LIST_OPT, false, "List entities registered for a type"); Option lookup = new Option(LOOKUP_OPT, false, "Lookup a feed given its instance's path"); Option slaAlert = new Option(SLA_MISS_ALERT_OPT, false, "Get missing feed instances which missed SLA"); Option entitySummary = new Option(SUMMARY_OPT, false, "Get summary of instances for list of entities"); Option touch = new Option(TOUCH_OPT, false, "Force update the entity in workflow engine(even without any changes to entity)"); OptionGroup group = new OptionGroup(); group.addOption(submit);/*from w ww . j av a 2 s . c o m*/ group.addOption(update); group.addOption(schedule); group.addOption(suspend); group.addOption(resume); group.addOption(delete); group.addOption(submitAndSchedule); group.addOption(validate); group.addOption(status); group.addOption(definition); group.addOption(dependency); group.addOption(list); group.addOption(lookup); group.addOption(slaAlert); group.addOption(entitySummary); group.addOption(touch); Option url = new Option(URL_OPTION, true, "Falcon URL"); Option entityType = new Option(TYPE_OPT, true, "Entity type, can be cluster, feed or process xml"); Option filePath = new Option(FILE_PATH_OPT, true, "Path to entity xml file"); Option entityName = new Option(ENTITY_NAME_OPT, true, "Entity type, can be cluster, feed or process xml"); Option start = new Option(START_OPT, true, "Start time is optional for summary"); Option end = new Option(END_OPT, true, "End time is optional for summary"); Option colo = new Option(COLO_OPT, true, "Colo name"); Option cluster = new Option(CLUSTER_OPT, true, "Cluster name"); colo.setRequired(false); Option fields = new Option(FIELDS_OPT, true, "Entity fields to show for a request"); Option filterBy = new Option(FILTER_BY_OPT, true, "Filter returned entities by the specified status"); Option filterTags = new Option(TAGS_OPT, true, "Filter returned entities by the specified tags"); Option nameSubsequence = new Option(NAMESEQ_OPT, true, "Subsequence of entity name"); Option tagKeywords = new Option(TAGKEYS_OPT, true, "Keywords in tags"); Option orderBy = new Option(ORDER_BY_OPT, true, "Order returned entities by this field"); Option sortOrder = new Option(SORT_ORDER_OPT, true, "asc or desc order for results"); Option offset = new Option(OFFSET_OPT, true, "Start returning entities from this offset"); Option numResults = new Option(NUM_RESULTS_OPT, true, "Number of results to return per request"); Option numInstances = new Option(NUM_INSTANCES_OPT, true, "Number of instances to return per entity summary request"); Option path = new Option(PATH_OPT, true, "Path for a feed's instance"); Option skipDryRun = new Option(SKIPDRYRUN_OPT, false, "skip dry run in workflow engine"); Option doAs = new Option(DO_AS_OPT, true, "doAs user"); Option userProps = new Option(PROPS_OPT, true, "User supplied comma separated key value properties"); Option debug = new Option(DEBUG_OPTION, false, "Use debug mode to see debugging statements on stdout"); entityOptions.addOption(url); entityOptions.addOption(path); entityOptions.addOptionGroup(group); entityOptions.addOption(entityType); entityOptions.addOption(entityName); entityOptions.addOption(filePath); entityOptions.addOption(colo); entityOptions.addOption(cluster); entityOptions.addOption(start); entityOptions.addOption(end); entityOptions.addOption(fields); entityOptions.addOption(filterBy); entityOptions.addOption(filterTags); entityOptions.addOption(nameSubsequence); entityOptions.addOption(tagKeywords); entityOptions.addOption(orderBy); entityOptions.addOption(sortOrder); entityOptions.addOption(offset); entityOptions.addOption(numResults); entityOptions.addOption(numInstances); entityOptions.addOption(skipDryRun); entityOptions.addOption(doAs); entityOptions.addOption(userProps); entityOptions.addOption(debug); return entityOptions; }
From source file:org.apache.falcon.FalconServer.java
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); Option opt; opt = new Option(APP_PATH, true, "Application Path"); opt.setRequired(false); options.addOption(opt);// www .j a v a2s.co m opt = new Option(APP_PORT, true, "Application Port"); opt.setRequired(false); options.addOption(opt); return new GnuParser().parse(options, args); }
From source file:org.apache.falcon.hive.HiveDROptions.java
private static void addOption(Options options, HiveDRArgs arg, boolean isRequired) { Option option = arg.getOption(); option.setRequired(isRequired); options.addOption(option);//from w w w. j av a 2 s . co m }
From source file:org.apache.falcon.latedata.LateDataHandler.java
private static CommandLine getCommand(String[] args) throws ParseException { Options options = new Options(); Option opt = new Option("out", true, "Out file name"); opt.setRequired(true); options.addOption(opt);/*from www . j a v a2s .c o m*/ opt = new Option("paths", true, "Comma separated path list, further separated by #"); opt.setRequired(true); options.addOption(opt); opt = new Option(WorkflowExecutionArgs.INPUT_NAMES.getName(), true, "Input feed names, further separated by #"); opt.setRequired(true); options.addOption(opt); opt = new Option(WorkflowExecutionArgs.INPUT_STORAGE_TYPES.getName(), true, "Feed storage types corresponding to Input feed names, separated by #"); opt.setRequired(true); options.addOption(opt); return new GnuParser().parse(options, args); }
From source file:org.apache.falcon.logging.LogMover.java
private void setupArgs(String[] arguments, ARGS args) throws ParseException { Options options = new Options(); Option opt = new Option("workflowEngineUrl", true, "url of workflow engine, ex:oozie"); opt.setRequired(true); options.addOption(opt);//from w w w .j a va 2 s. c o m opt = new Option("subflowId", true, "external id of userworkflow"); opt.setRequired(true); options.addOption(opt); opt = new Option("userWorkflowEngine", true, "user workflow engine type"); opt.setRequired(false); // replication will NOT have this arg sent options.addOption(opt); opt = new Option("runId", true, "current workflow's runid"); opt.setRequired(true); options.addOption(opt); opt = new Option("logDir", true, "log dir where job logs are stored"); opt.setRequired(true); options.addOption(opt); opt = new Option("status", true, "user workflow status"); opt.setRequired(true); options.addOption(opt); opt = new Option("entityType", true, "entity type feed or process"); opt.setRequired(true); options.addOption(opt); CommandLine cmd = new GnuParser().parse(options, arguments); args.oozieUrl = cmd.getOptionValue("workflowEngineUrl"); args.subflowId = cmd.getOptionValue("subflowId"); args.userWorkflowEngine = cmd.getOptionValue("userWorkflowEngine"); args.runId = cmd.getOptionValue("runId"); args.logDir = cmd.getOptionValue("logDir"); args.entityType = cmd.getOptionValue("entityType"); }
From source file:org.apache.falcon.messaging.MessageProducer.java
private static void addOption(Options options, Option opt, boolean isRequired) { opt.setRequired(isRequired); options.addOption(opt);/*ww w.ja v a 2s. com*/ }
From source file:org.apache.falcon.metadata.LineageRecorder.java
private static void addOption(Options options, LineageArgs arg, boolean isRequired) { Option option = arg.getOption(); option.setRequired(isRequired); options.addOption(option);//from w w w . j a va2 s .c o m }
From source file:org.apache.falcon.recipe.RecipeTool.java
private static void addOption(final Options options, final RecipeToolArgs arg, final boolean isRequired) { Option option = arg.getOption(); option.setRequired(isRequired); options.addOption(option);//from w ww.java 2s . com }