List of usage examples for org.apache.commons.cli OptionBuilder create
public static Option create(String opt) throws IllegalArgumentException
char
. From source file:info.extensiblecatalog.OAIToolkit.importer.CLIProcessor.java
/** * Setup the command line options object * @return the command line options object *///from w w w . ja v a 2 s.c om public static Options getCommandLineOptions() { Option convert = new Option("convert", "Flag to convert file(s) with raw MARC records into MARCXML"); OptionBuilder.withArgName("modify"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Flag to modify MARCXML file(s) with XSLT transromation with the" + "given XSLT files before loading into the OAI repository"); Option modify = OptionBuilder.create("modify"); Option load = new Option("load", "Flag to load file(s) into the OAI repository"); Option production = new Option("production", "Flag to switch production mode. It means, that the" + "toolkit won't create any temporary files (except error" + " records) so it read MARC records, process it, and put " + "directly to the database or the target file format [DEPRECATED: OPTION IS NO LONGER AVAILABLE]"); OptionBuilder.withArgName("source"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory where the toolkit looks " + "for files to process"); Option source = OptionBuilder.create("source"); OptionBuilder.withArgName("destination"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory that the toolkit moves the source files into " + "as it successfully completes the processing of each file."); Option destination = OptionBuilder.create("destination"); OptionBuilder.withArgName("destination_xml"); OptionBuilder.hasArg(); OptionBuilder .withDescription("The directory that the toolkit places " + "MARCXML versions of the source data."); Option destination_xml = OptionBuilder.create("destination_xml"); OptionBuilder.withArgName("destination_modifiedxml"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "The directory that the toolkit places " + "modified MARCXML versions of the source data."); Option destination_modifiedxml = OptionBuilder.create("destination_modifiedxml"); OptionBuilder.withArgName("error"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory that the toolkit moves files into when " + "there is a processing error for that file."); Option error = OptionBuilder.create("error"); OptionBuilder.hasArg(); OptionBuilder.withArgName("error_xml"); OptionBuilder.withDescription("The directory that the toolkit places MARCXML versions of " + "the source data, if that MARCXML file was unable to be " + "loaded into the OAI repository due to an error condition."); Option error_xml = OptionBuilder.create("error_xml"); OptionBuilder.hasArg(); OptionBuilder.withArgName("error_modifiedxml"); OptionBuilder.withDescription("The directory that the toolkit places MARCXML versions of " + "the source data, if that MARCXML file was unable to be " + "loaded into the OAI repository due to an error condition."); Option error_modifiedxml = OptionBuilder.create("error_modifiedxml"); OptionBuilder.withArgName("log"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of log files for " + "warnings and errors"); Option log = OptionBuilder.create("log"); Option log_detail = new Option("log_detail", "Flag to offer more detailed processing log information"); OptionBuilder.withArgName("marc_schema"); OptionBuilder.hasArg(); OptionBuilder.withDescription("XML Schema file for MARCXML validation"); Option marc_schema = OptionBuilder.create("marc_schema"); OptionBuilder.withArgName("marc_encoding"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The encoding of the MARC file"); Option marc_encoding = OptionBuilder.create("marc_encoding"); OptionBuilder.withArgName("char_conversion"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "The character conversion method. " + "Possible values: MARC8 (Ansel), ISO5426, ISO6937, none"); Option char_conversion = OptionBuilder.create("char_conversion"); OptionBuilder.withArgName("split_size"); OptionBuilder.hasArg(); OptionBuilder.withDescription("How many records can an XML file" + " contain?"); Option split_size = OptionBuilder.create("split_size"); OptionBuilder.withArgName("lucene_index"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Lucene index directory."); Option lucene_index = OptionBuilder.create("lucene_index"); //OptionBuilder.withArgName("storage_type"); //OptionBuilder.hasArg(); //OptionBuilder.withDescription("The storage type of records: MySQL," + //" mixed, Lucene."); //Option storage_type = OptionBuilder.create("storage_type"); Option indent_xml = new Option("indent_xml", "Flag to indent XML"); Option xml_version_11 = new Option("xml_version_11", "Flag to create XML 1.1 instead of 1.0"); Option translate_leader_bad_chars_to_zero = new Option("translate_leader_bad_chars_to_zero", "Change the Bad characters in the leader to zeros"); Option translate_nonleader_bad_chars_to_spaces = new Option("translate_nonleader_bad_chars_to_spaces", "Change the Bad characters in the control and the data fields to spaces"); Option modify_validation = new Option("modify_validation", "Perform validation check during modify step"); OptionBuilder.withArgName("replace_repository_code"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Replace repository code."); Option replace_repository_code = OptionBuilder.create("replace_repository_code"); OptionBuilder.withArgName("convert_dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of marc files after " + "process."); Option convert_dir = OptionBuilder.create("convert_dir"); Option fileof_deleted_records = new Option("fileof_deleted_records", "The source marc file should be considered as deleted"); Option lucene_statistics = new Option("lucene_statistics", "Statistics for Lucene Database"); Option lucene_dump_ids = new Option("lucene_dump_ids", "List all ids (001s) to standard output"); OptionBuilder.withArgName("load_dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of marcxml files after" + " process."); Option load_dir = OptionBuilder.create("load_dir"); OptionBuilder.withArgName("modify_dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The directory of modified marcxml " + "files after process."); Option modify_dir = OptionBuilder.create("modify_dir"); OptionBuilder.withArgName("error_suffix"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The suffix of directory name of error" + " files after process."); Option error_suffix = OptionBuilder.create("error_suffix"); OptionBuilder.withArgName("destination_suffix"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The suffix of directory name of files" + " after process."); Option destination_suffix = OptionBuilder.create("destination_suffix"); OptionBuilder.withArgName("default_repository_code"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The default value of " + "repository code (field 003)."); Option default_repository_code = OptionBuilder.create("default_repository_code"); Option delete = new Option("delete", "Delete temporary files?"); Option ignore_repository_code = new Option("ignore_repository_code", "Do not merge 003 and 001 together."); Option help = new Option("help", "list available options"); Options options = new Options(); options.addOption(production); options.addOption(convert); options.addOption(modify); options.addOption(load); options.addOption(source); options.addOption(destination); options.addOption(destination_xml); options.addOption(error); options.addOption(error_xml); options.addOption(log); options.addOption(log_detail); options.addOption(marc_schema); options.addOption(marc_encoding); options.addOption(char_conversion); options.addOption(split_size); options.addOption(lucene_index); //options.addOption(storage_type); options.addOption(indent_xml); options.addOption(xml_version_11); options.addOption(translate_leader_bad_chars_to_zero); options.addOption(modify_validation); options.addOption(translate_nonleader_bad_chars_to_spaces); options.addOption(fileof_deleted_records); options.addOption(lucene_statistics); options.addOption(lucene_dump_ids); options.addOption(replace_repository_code); options.addOption(convert_dir); options.addOption(load_dir); options.addOption(modify_dir); options.addOption(error_suffix); options.addOption(destination_suffix); options.addOption(delete); options.addOption(destination_modifiedxml); options.addOption(error_modifiedxml); options.addOption(default_repository_code); options.addOption(ignore_repository_code); options.addOption(help); return options; }
From source file:com.google.code.stackexchange.client.examples.BadgesApiExample.java
/** * Builds the options./*from w w w . j a va 2 s .c om*/ * * @return the options */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Key."; OptionBuilder.withArgName("key"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(APPLICATION_KEY_OPTION); opts.addOption(consumerKey); String siteNameMsg = "Your site name."; OptionBuilder.withArgName("site"); OptionBuilder.hasArg(); OptionBuilder.withDescription(siteNameMsg); Option siteName = OptionBuilder.create(STACK_EXCHANGE_SITE); opts.addOption(siteName); return opts; }
From source file:de.clusteval.data.dataset.generator.QiuJoeCovarianceClusterDataSetGenerator.java
@Override protected Options getOptions() { Options options = new Options(); OptionBuilder.withArgName("n"); OptionBuilder.isRequired();/*from w w w. j av a2 s . c o m*/ OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of points."); Option option = OptionBuilder.create("n"); options.addOption(option); OptionBuilder.withDescription("Make the cluster sizes different."); option = OptionBuilder.create("sizes"); options.addOption(option); OptionBuilder.withArgName("k"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of clusters."); option = OptionBuilder.create("k"); options.addOption(option); OptionBuilder.withArgName("noisyfeatures"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of noisy features."); option = OptionBuilder.create("dn"); options.addOption(option); OptionBuilder.withArgName("features"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of non-noisy (clustered/separated) features."); option = OptionBuilder.create("d"); options.addOption(option); OptionBuilder.withArgName("clusterSeparation"); OptionBuilder.isRequired(); OptionBuilder.hasArg(); OptionBuilder.withDescription("The cluster separation (between -1.0 and +1.0)."); option = OptionBuilder.create("s"); options.addOption(option); return options; }
From source file:de.clusteval.data.dataset.generator.Gaussian2DDataSetGenerator.java
@Override public Options getOptions() { Options options = new Options(); // init valid command line options OptionBuilder.withArgName("radius"); OptionBuilder.hasArg();//from ww w . ja v a 2 s .c o m OptionBuilder.withDescription("The radius of the circle on which the gaussians are located."); Option option = OptionBuilder.create("r"); options.addOption(option); OptionBuilder.withArgName("sd"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The standard deviation of the gaussians."); option = OptionBuilder.create("sd"); options.addOption(option); OptionBuilder.withArgName("n"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of points."); option = OptionBuilder.create("n"); options.addOption(option); OptionBuilder.withArgName("cl"); OptionBuilder.hasArg(); OptionBuilder.withDescription("The number of gaussians."); option = OptionBuilder.create("cl"); options.addOption(option); options.addOption(option); return options; }
From source file:com.google.code.uclassify.client.examples.ClassifierExample.java
/** * Build command line options object.//from w ww . j a v a2s. co m * * @return the options */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Write Key."; OptionBuilder.withArgName("readKey"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(WRITE_KEY); opts.addOption(consumerKey); String idMsg = "Classifier Name"; OptionBuilder.withArgName("classifier"); OptionBuilder.hasArg(); OptionBuilder.withDescription(idMsg); Option id = OptionBuilder.create(CLASSIFIER); opts.addOption(id); return opts; }
From source file:com.google.code.linkedinapi.client.examples.PostCommentExample.java
/** * Build command line options object./*from w w w .j a v a 2 s. c o m*/ */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Consumer Key."; OptionBuilder.withArgName("consumerKey"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(CONSUMER_KEY_OPTION); opts.addOption(consumerKey); String consumerSecretMsg = "You API Consumer Secret."; OptionBuilder.withArgName("consumerSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerSecretMsg); Option consumerSecret = OptionBuilder.create(CONSUMER_SECRET_OPTION); opts.addOption(consumerSecret); String accessTokenMsg = "You OAuth Access Token."; OptionBuilder.withArgName("accessToken"); OptionBuilder.hasArg(); OptionBuilder.withDescription(accessTokenMsg); Option accessToken = OptionBuilder.create(ACCESS_TOKEN_OPTION); opts.addOption(accessToken); String tokenSecretMsg = "You OAuth Access Token Secret."; OptionBuilder.withArgName("accessTokenSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(tokenSecretMsg); Option accessTokenSecret = OptionBuilder.create(ACCESS_TOKEN_SECRET_OPTION); opts.addOption(accessTokenSecret); String idMsg = "ID of the post on which to comment."; OptionBuilder.withArgName("postId"); OptionBuilder.hasArg(); OptionBuilder.withDescription(idMsg); Option id = OptionBuilder.create(POST_ID_OPTION); opts.addOption(id); String commentMsg = "Text of the comment."; OptionBuilder.withArgName("comment"); OptionBuilder.hasArg(); OptionBuilder.withDescription(commentMsg); Option comment = OptionBuilder.create(COMMENT_TEXT_OPTION); opts.addOption(comment); return opts; }
From source file:com.google.code.linkedinapi.client.examples.PostShareExample.java
/** * Build command line options object.//from www. j ava 2s .c o m */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Consumer Key."; OptionBuilder.withArgName("consumerKey"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(CONSUMER_KEY_OPTION); opts.addOption(consumerKey); String consumerSecretMsg = "You API Consumer Secret."; OptionBuilder.withArgName("consumerSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerSecretMsg); Option consumerSecret = OptionBuilder.create(CONSUMER_SECRET_OPTION); opts.addOption(consumerSecret); String accessTokenMsg = "You OAuth Access Token."; OptionBuilder.withArgName("accessToken"); OptionBuilder.hasArg(); OptionBuilder.withDescription(accessTokenMsg); Option accessToken = OptionBuilder.create(ACCESS_TOKEN_OPTION); opts.addOption(accessToken); String tokenSecretMsg = "You OAuth Access Token Secret."; OptionBuilder.withArgName("accessTokenSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(tokenSecretMsg); Option accessTokenSecret = OptionBuilder.create(ACCESS_TOKEN_SECRET_OPTION); opts.addOption(accessTokenSecret); String statusMsg = "Text of the share."; OptionBuilder.withArgName("share"); OptionBuilder.hasArg(); OptionBuilder.withDescription(statusMsg); Option status = OptionBuilder.create(SHARE_TEXT_OPTION); opts.addOption(status); String urlMsg = "URL to be shared."; OptionBuilder.withArgName("url"); OptionBuilder.hasArg(); OptionBuilder.withDescription(urlMsg); Option url = OptionBuilder.create(URL_OPTION); opts.addOption(url); return opts; }
From source file:com.google.code.stackexchange.client.examples.AsyncApiExample.java
/** * Builds the options.// w w w . jav a2 s. co m * * @return the options */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Key."; OptionBuilder.withArgName("key"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(APPLICATION_KEY_OPTION); opts.addOption(consumerKey); return opts; }
From source file:com.google.code.linkedinapi.client.examples.PostStatusExample.java
/** * Build command line options object.// ww w . j ava 2 s .c om */ private static Options buildOptions() { Options opts = new Options(); String helpMsg = "Print this message."; Option help = new Option(HELP_OPTION, helpMsg); opts.addOption(help); String consumerKeyMsg = "You API Consumer Key."; OptionBuilder.withArgName("consumerKey"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerKeyMsg); Option consumerKey = OptionBuilder.create(CONSUMER_KEY_OPTION); opts.addOption(consumerKey); String consumerSecretMsg = "You API Consumer Secret."; OptionBuilder.withArgName("consumerSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(consumerSecretMsg); Option consumerSecret = OptionBuilder.create(CONSUMER_SECRET_OPTION); opts.addOption(consumerSecret); String accessTokenMsg = "You OAuth Access Token."; OptionBuilder.withArgName("accessToken"); OptionBuilder.hasArg(); OptionBuilder.withDescription(accessTokenMsg); Option accessToken = OptionBuilder.create(ACCESS_TOKEN_OPTION); opts.addOption(accessToken); String tokenSecretMsg = "You OAuth Access Token Secret."; OptionBuilder.withArgName("accessTokenSecret"); OptionBuilder.hasArg(); OptionBuilder.withDescription(tokenSecretMsg); Option accessTokenSecret = OptionBuilder.create(ACCESS_TOKEN_SECRET_OPTION); opts.addOption(accessTokenSecret); String statusMsg = "Text of the status."; OptionBuilder.withArgName("status"); OptionBuilder.hasArg(); OptionBuilder.withDescription(statusMsg); Option status = OptionBuilder.create(STATUS_TEXT_OPTION); opts.addOption(status); String deleteMsg = "Delete current status."; Option delete = new Option(DELETE_OPTION, deleteMsg); opts.addOption(delete); return opts; }
From source file:be.svlandeg.diffany.console.DiffanyOptions.java
/** * Define the options specifying necessary arguments for the Diffany algorithms *//* w w w.ja va2s . c o m*/ private Set<Option> getAllParameters() { Set<Option> allParameters = new HashSet<Option>(); OptionBuilder.withArgName("dir"); OptionBuilder.withLongOpt("inputDir"); OptionBuilder.hasArgs(1); OptionBuilder.isRequired(); OptionBuilder .withDescription("the input directory containing the reference and condition-specific networks"); allParameters.add(OptionBuilder.create(inputShort)); OptionBuilder.withArgName("dir"); OptionBuilder.withLongOpt("outputDir"); OptionBuilder.hasArgs(1); OptionBuilder.isRequired(); OptionBuilder.withDescription( "the output directory which will contain the generated differential/consensus networks"); allParameters.add(OptionBuilder.create(outputShort)); String defaultRunDiffString = defaultRunDiff ? "yes" : "no"; OptionBuilder.withLongOpt("differential"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription("whether or not to calculate differential networks: yes or no (default=" + defaultRunDiffString + ")"); allParameters.add(OptionBuilder.create(runDiff)); String defaultRunConsString = defaultRunCons ? "yes" : "no"; ; OptionBuilder.withLongOpt("consensus"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription( "whether or not to calculate consensus networks: yes or no (default=" + defaultRunConsString + ")"); allParameters.add(OptionBuilder.create(runCons)); OptionBuilder.withLongOpt("outputID"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription("the first ID that will be used for the generated networks"); allParameters.add(OptionBuilder.create(nextID)); OptionBuilder.withLongOpt("confidence"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription( "the minimum confidence threshold for output edges, as an integer or double (default=0.0)"); allParameters.add(OptionBuilder.create(cutoffShort)); String defaultMinOperatorString = defaultMinOperator ? "min" : "max"; OptionBuilder.withLongOpt("operator"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription("the operator used to create consensus edges: min or max (default=" + defaultMinOperatorString + ")"); allParameters.add(OptionBuilder.create(operatorShort)); String defaultModeString = defaultModePairwise ? "pairwise" : "all"; OptionBuilder.withLongOpt("mode"); OptionBuilder.hasArgs(1); OptionBuilder .withDescription("the mode of comparison: pairwise or all (default=" + defaultModeString + ")"); allParameters.add(OptionBuilder.create(modeShort)); String defaultHeaderString = defaultReadHeader ? "yes" : "no"; OptionBuilder.withLongOpt("skipHeader"); OptionBuilder.hasArgs(1); OptionBuilder.withDescription( "whether or not to skip the first line (header) in the network .txt files (default=" + defaultHeaderString + ")"); allParameters.add(OptionBuilder.create(headerShort)); return allParameters; }