Esempio n. 1
0
  private Options createGraphOptions() {
    Options graphOptions = new Options();
    Option url = new Option(URL_OPTION, true, "Falcon URL");
    graphOptions.addOption(url);

    Option vertex = new Option(VERTEX_CMD, false, "show the vertices");
    Option vertices = new Option(VERTICES_CMD, false, "show the vertices");
    Option vertexEdges = new Option(VERTEX_EDGES_CMD, false, "show the edges for a given vertex");
    Option edges = new Option(EDGE_CMD, false, "show the edges");

    OptionGroup group = new OptionGroup();
    group.addOption(vertex);
    group.addOption(vertices);
    group.addOption(vertexEdges);
    group.addOption(edges);
    graphOptions.addOptionGroup(group);

    Option id = new Option(ID_OPT, true, "vertex or edge id");
    graphOptions.addOption(id);

    Option key = new Option(KEY_OPT, true, "key property");
    graphOptions.addOption(key);

    Option value = new Option(VALUE_OPT, true, "value property");
    graphOptions.addOption(value);

    Option direction = new Option(DIRECTION_OPT, true, "edge direction property");
    graphOptions.addOption(direction);

    return graphOptions;
  }
Esempio n. 2
0
  @Override
  public Options getOptions() {
    // Remove the options that specify which type of iterator this is, since
    // they are all scan iterators with this command.
    final HashSet<OptionGroup> groups = new HashSet<>();
    final Options parentOptions = super.getOptions();
    final Options modifiedOptions = new Options();
    for (Iterator<?> it = parentOptions.getOptions().iterator(); it.hasNext(); ) {
      Option o = (Option) it.next();
      if (!IteratorScope.majc.name().equals(o.getOpt())
          && !IteratorScope.minc.name().equals(o.getOpt())
          && !IteratorScope.scan.name().equals(o.getOpt())
          && !"table".equals(o.getLongOpt())) {
        modifiedOptions.addOption(o);
        OptionGroup group = parentOptions.getOptionGroup(o);
        if (group != null) groups.add(group);
      }
    }
    for (OptionGroup group : groups) {
      modifiedOptions.addOptionGroup(group);
    }

    profileOpt = new Option("pn", "profile", true, "iterator profile name");
    profileOpt.setRequired(true);
    profileOpt.setArgName("profile");

    modifiedOptions.addOption(profileOpt);

    return modifiedOptions;
  }
Esempio n. 3
0
  // Create the required command line options
  @SuppressWarnings("static-access")
  private static void initOptions(Options cmdLineOptions) {
    Option help = new Option("help", "print this message");
    Option upgradeOpt = new Option("upgradeSchema", "Schema upgrade");
    Option upgradeFromOpt =
        OptionBuilder.withArgName("upgradeFrom")
            .hasArg()
            .withDescription("Schema upgrade from a version")
            .create("upgradeSchemaFrom");
    Option initOpt = new Option("initSchema", "Schema initialization");
    Option initToOpt =
        OptionBuilder.withArgName("initTo")
            .hasArg()
            .withDescription("Schema initialization to a version")
            .create("initSchemaTo");
    Option infoOpt = new Option("info", "Show config and schema details");

    OptionGroup optGroup = new OptionGroup();
    optGroup
        .addOption(upgradeOpt)
        .addOption(initOpt)
        .addOption(help)
        .addOption(upgradeFromOpt)
        .addOption(initToOpt)
        .addOption(infoOpt);
    optGroup.setRequired(true);

    Option userNameOpt =
        OptionBuilder.withArgName("user")
            .hasArgs()
            .withDescription("Override config file user name")
            .create("userName");
    Option passwdOpt =
        OptionBuilder.withArgName("password")
            .hasArgs()
            .withDescription("Override config file password")
            .create("passWord");
    Option dbTypeOpt =
        OptionBuilder.withArgName("databaseType")
            .hasArgs()
            .withDescription("Metastore database type")
            .create("dbType");
    Option dbOpts =
        OptionBuilder.withArgName("databaseOpts")
            .hasArgs()
            .withDescription("Backend DB specific options")
            .create("dbOpts");
    Option dryRunOpt = new Option("dryRun", "list SQL scripts (no execute)");
    Option verboseOpt = new Option("verbose", "only print SQL statements");

    cmdLineOptions.addOption(help);
    cmdLineOptions.addOption(dryRunOpt);
    cmdLineOptions.addOption(userNameOpt);
    cmdLineOptions.addOption(passwdOpt);
    cmdLineOptions.addOption(dbTypeOpt);
    cmdLineOptions.addOption(verboseOpt);
    cmdLineOptions.addOption(dbOpts);
    cmdLineOptions.addOptionGroup(optGroup);
  }
 @Override
 void populate(Options options) {
   OptionGroup verbosityGroup = new OptionGroup();
   verbosityGroup.setRequired(false);
   verbosityGroup.addOption(new OptionBuilder("s", "silent").required(false).build());
   verbosityGroup.addOption(new OptionBuilder("v", "verbose").required(false).build());
   options.addOptionGroup(verbosityGroup);
 }
  /** @return an {@link Option} object containing the available command line options for ProB 2.0 */
  @SuppressWarnings("static-access")
  @Provides
  public final Options getCommandlineOptions() {
    Options options = new Options();
    Option shell = new Option("s", "shell", false, "start ProB's Groovy shell");

    Option restricted =
        new Option("local", "Free access to Groovy shell. Interface will be bound to 127.0.0.1");

    Option standalone = new Option("standalone", "Run in standalone mode");

    Option animation =
        new Option(
            "multianimation",
            "UI components will have the capability to show multiple animations"
                + " at once (NOTE: the development of this option is in the"
                + " experimental phase)");

    Option maxCacheSize =
        OptionBuilder.withArgName("maxSize")
            .hasArg()
            .withDescription("set the cache size for the states in the StateSpace")
            .create("maxCacheSize");

    Option browser =
        OptionBuilder.withArgName("url")
            .hasArg()
            .withDescription("Open URL in browser")
            .create("browser");

    Option port =
        OptionBuilder.withArgName("port")
            .hasArg()
            .withDescription("Set specific port for UI")
            .create("port");

    // TODO: add modelchecking option
    // Option modelcheck = new Option("mc", "modelcheck", false,
    // "start ProB model checking");
    OptionGroup mode = new OptionGroup();
    mode.setRequired(true);
    // mode.addOption(modelcheck);
    mode.addOption(shell);
    options.addOptionGroup(mode);
    options.addOption(browser);
    options.addOption(port);
    options.addOption(restricted);
    options.addOption(standalone);
    options.addOption(animation);
    options.addOption(maxCacheSize);
    return options;
  }
Esempio n. 6
0
 /** @param args */
 @SuppressWarnings("static-access")
 public static void main(String args[]) throws ParseException, IOException {
   Options options = new Options();
   options.addOption(
       OptionBuilder.withArgName("prop")
           .hasArg()
           .isRequired()
           .withDescription("property file with queries and other parameters. todo desc")
           .create("prop"));
   OptionGroup og = new OptionGroup();
   og.addOption(
       OptionBuilder.withArgName("prefix")
           .hasArg()
           .withDescription(
               "create network using specified concept graph and corpus. creates prefix.sif with edges and prefix.node.txt with node data in working directory.")
           .create("network"));
   og.addOption(
       OptionBuilder.withArgName("concept id")
           .hasArg()
           .withDescription(
               "get all descendants of specified concept, creates concept_id.tree file in working directory")
           .create("subtree"));
   og.setRequired(true);
   options.addOptionGroup(og);
   try {
     CommandLineParser parser = new GnuParser();
     CommandLine line = parser.parse(options, args);
     CytoscapeHelper cytHelper =
         KernelContextHolder.getApplicationContext().getBean(CytoscapeHelper.class);
     Properties props = FileUtil.loadProperties(line.getOptionValue("prop"), true);
     if (!cytHelper.validateProps(props)) {
       printHelp(options);
     } else {
       if (line.hasOption("network")) {
         cytHelper.exportNetwork(line.getOptionValue("network"), props);
       } else if (line.hasOption("subtree")) {
         cytHelper.exportSubtree(line.getOptionValue("subtree"), props);
       } else {
         printHelp(options);
       }
     }
   } catch (ParseException pe) {
     printHelp(options);
   }
 }
Esempio n. 7
0
  private Options createAdminOptions() {
    Options adminOptions = new Options();
    Option url = new Option(URL_OPTION, true, "Falcon URL");
    adminOptions.addOption(url);

    OptionGroup group = new OptionGroup();
    Option status = new Option(STATUS_OPTION, false, "show the current system status");
    Option version = new Option(VERSION_OPTION, false, "show Falcon server build version");
    Option stack = new Option(STACK_OPTION, false, "show the thread stack dump");
    Option help = new Option("help", false, "show Falcon help");
    group.addOption(status);
    group.addOption(version);
    group.addOption(stack);
    group.addOption(help);

    adminOptions.addOptionGroup(group);
    return adminOptions;
  }
Esempio n. 8
0
 private static Options initOptions() {
   Options options = new Options();
   OptionGroup og = new OptionGroup();
   og.addOption(
       OptionBuilder.withArgName("cvDir")
           .hasArg()
           .withDescription("fold cross-validation results directory")
           .create("cvDir"));
   og.addOption(
       OptionBuilder.withArgName("document")
           .hasArg()
           .withDescription("document prediction output")
           .create("docPred"));
   og.addOption(
       OptionBuilder.withArgName("document")
           .hasArg()
           .withDescription("prediction")
           .create("pred"));
   options.addOptionGroup(og);
   options.addOption(
       OptionBuilder.withArgName("algo").hasArg().withDescription("algorithm").create("algo"));
   options.addOption(
       OptionBuilder.withArgName("name")
           .hasArg()
           .withDescription("name")
           .isRequired()
           .create("name"));
   options.addOption(
       OptionBuilder.withArgName("experiment")
           .hasArg()
           .withDescription("experiment")
           .create("experiment"));
   options.addOption(
       OptionBuilder.withArgName("label")
           .hasArg()
           .withDescription("label / task")
           .create("label"));
   options.addOption(
       OptionBuilder.withArgName("yes/no")
           .hasArg()
           .withDescription("store probabilities, default yes")
           .create("storeProb"));
   return options;
 }
  static {
    OPTIONS.addOption(
        OptionBuilder.isRequired()
            .withArgName("sourcepath")
            .hasArgs()
            .withDescription(
                "Space-delimited list of directories in which to find resource Java source files\nIf neither -resourcepackages nor -resourcepackages is provided, all classes defined in the directories will be scanned")
            .create("sourcepath"));
    OPTIONS.addOption(
        OptionBuilder.withArgName("name")
            .hasArg()
            .withDescription("Name of the API")
            .create("name"));
    OPTIONS.addOption(
        OptionBuilder.withArgName("outdir")
            .hasArg()
            .withDescription(
                "Directory in which to output the generated IDL files (default=current working dir)")
            .create("outdir"));

    OPTIONS.addOption(
        new Option(
            "split",
            false,
            "DEPRECATED! Splits IDL across multiple files, one per root resource (always true)"));

    final OptionGroup sourceGroup = new OptionGroup();
    final Option sourcePkgs =
        OptionBuilder.withArgName("resourcepackages")
            .hasArgs()
            .withDescription("Space-delimited list of packages to scan for resource classes")
            .create("resourcepackages");
    final Option sourceClasses =
        OptionBuilder.withArgName("resourceclasses")
            .hasArgs()
            .withDescription("space-delimited list of resource classes to scan")
            .create("resourceclasses");
    sourceGroup.addOption(sourcePkgs);
    sourceGroup.addOption(sourceClasses);
    OPTIONS.addOptionGroup(sourceGroup);
  }
Esempio n. 10
0
  /** Returns an <tt>Options</tt> object that combines the standard options and the hidden ones. */
  @SuppressWarnings("unchecked")
  private Options getAllOptions() {
    Options newOptions = new Options();
    Set<OptionGroup> groups = new HashSet<OptionGroup>();
    Options[] optionses = new Options[] {mOptions, mHiddenOptions};
    for (Options options : optionses) {
      for (Option opt : (Collection<Option>) options.getOptions()) {
        OptionGroup group = options.getOptionGroup(opt);
        if (group != null) {
          groups.add(group);
        } else {
          newOptions.addOption(opt);
        }
      }
    }

    for (OptionGroup group : groups) {
      newOptions.addOptionGroup(group);
    }
    return newOptions;
  }
Esempio n. 11
0
 public Builder optionGroups(OptionGroupBuilder... optionGroupBuilders) {
   for (OptionGroupBuilder builder : optionGroupBuilders) {
     options.addOptionGroup(builder.build());
   }
   return this;
 }
Esempio n. 12
0
  private Options instanceOptions() {

    Options instanceOptions = new Options();

    Option running =
        new Option(RUNNING_OPT, false, "Gets running process instances for a given process");
    Option status =
        new Option(
            STATUS_OPT,
            false,
            "Gets status of process instances for a given process in the range start time and optional end time");
    Option summary =
        new Option(
            SUMMARY_OPT,
            false,
            "Gets summary of instances for a given process in the range start time and optional end time");
    Option kill =
        new Option(
            KILL_OPT,
            false,
            "Kills active process instances for a given process in the range start time and optional end time");
    Option suspend =
        new Option(
            SUSPEND_OPT,
            false,
            "Suspends active process instances for a given process in the range start time and optional end time");
    Option resume =
        new Option(
            RESUME_OPT,
            false,
            "Resumes suspended process instances for a given process "
                + "in the range start time and optional end time");
    Option rerun =
        new Option(
            RERUN_OPT,
            false,
            "Reruns process instances for a given process in the range start time and "
                + "optional end time and overrides properties present in job.properties file");

    Option continues =
        new Option(
            CONTINUE_OPT,
            false,
            "resume process instance execution for a given process in the range start time and "
                + "optional end time and overrides properties present in job.properties file");

    Option logs =
        new Option(
            LOG_OPT,
            false,
            "Logs print the logs for process instances for a given process in "
                + "the range start time and optional end time");

    Option params =
        new Option(
            PARARMS_OPT,
            false,
            "Displays the workflow parameters for a given instance of specified nominal time");

    OptionGroup group = new OptionGroup();
    group.addOption(running);
    group.addOption(status);
    group.addOption(summary);
    group.addOption(kill);
    group.addOption(resume);
    group.addOption(suspend);
    group.addOption(resume);
    group.addOption(rerun);
    group.addOption(logs);
    group.addOption(continues);
    group.addOption(params);

    Option url = new Option(URL_OPTION, true, "Falcon URL");
    Option start =
        new Option(
            START_OPT,
            true,
            "Start time is required for commands, status, kill, suspend, resume and re-run"
                + "and it is nominal time while displaying workflow params");
    Option end =
        new Option(
            END_OPT,
            true,
            "End time is optional for commands, status, kill, suspend, resume and re-run; "
                + "if not specified then current time is considered as end time");
    Option runid =
        new Option(
            RUNID_OPT,
            true,
            "Instance runid  is optional and user can specify the runid, defaults to 0");
    Option clusters =
        new Option(
            CLUSTERS_OPT,
            true,
            "clusters is optional for commands kill, suspend and resume, "
                + "should not be specified for other commands");
    Option sourceClusters =
        new Option(
            SOURCECLUSTER_OPT,
            true,
            " source cluster is optional for commands kill, suspend and resume, "
                + "should not be specified for other commands (required for only feed)");
    Option filePath =
        new Option(
            FILE_PATH_OPT,
            true,
            "Path to job.properties file is required for rerun command, "
                + "it should contain name=value pair for properties to override for rerun");
    Option entityType =
        new Option(ENTITY_TYPE_OPT, true, "Entity type, can be feed or process xml");
    Option entityName =
        new Option(ENTITY_NAME_OPT, true, "Entity name, can be feed or process name");
    Option colo = new Option(COLO_OPT, true, "Colo on which the cmd has to be executed");
    Option lifecycle =
        new Option(
            LIFECYCLE_OPT,
            true,
            "describes life cycle of entity , for feed it can be replication/retention "
                + "and for process it can be execution");

    instanceOptions.addOption(url);
    instanceOptions.addOptionGroup(group);
    instanceOptions.addOption(start);
    instanceOptions.addOption(end);
    instanceOptions.addOption(filePath);
    instanceOptions.addOption(entityType);
    instanceOptions.addOption(entityName);
    instanceOptions.addOption(runid);
    instanceOptions.addOption(clusters);
    instanceOptions.addOption(sourceClusters);
    instanceOptions.addOption(colo);
    instanceOptions.addOption(lifecycle);

    return instanceOptions;
  }
Esempio n. 13
0
  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 registerd for a type");

    OptionGroup group = new OptionGroup();
    group.addOption(submit);
    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);

    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");
    entityType.setRequired(true);
    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 colo = new Option(COLO_OPT, true, "Colo name");
    colo.setRequired(false);
    Option effective = new Option(EFFECTIVE_OPT, true, "Effective time for update");

    entityOptions.addOption(url);
    entityOptions.addOptionGroup(group);
    entityOptions.addOption(entityType);
    entityOptions.addOption(entityName);
    entityOptions.addOption(filePath);
    entityOptions.addOption(colo);
    entityOptions.addOption(effective);

    return entityOptions;
  }
Esempio n. 14
0
  /**
   * Creates the options the command line should understand.
   *
   * @return the options the program understands
   */
  private static Options getOptions() {
    Options options = new Options();
    OptionGroup group = new OptionGroup();

    /* Note: arguments are set to be optional since we implement argument
     * checks on our own (commons.cli is not flexible enough and only
     * checks for the existence of a first argument)
     */

    options.addOption(new Option("h", "help", false, "print this message"));

    options.addOption(
        new Option("v", "verbose", false, "print verbose information, e.g. the properties read"));

    Option read = new Option("r", "read", true, "read an item");
    read.setArgName("key");
    read.setArgs(1);
    read.setOptionalArg(true);
    group.addOption(read);

    Option write = new Option("w", "write", true, "write an item");
    write.setArgName("key> <value");
    write.setArgs(2);
    write.setOptionalArg(true);
    group.addOption(write);

    Option publish = new Option("p", "publish", true, "publish a new message for the given topic");
    publish.setArgName("topic> <message");
    publish.setArgs(2);
    publish.setOptionalArg(true);
    group.addOption(publish);

    Option subscribe = new Option("s", "subscribe", true, "subscribe to a topic");
    subscribe.setArgName("topic> <url");
    subscribe.setArgs(2);
    subscribe.setOptionalArg(true);
    group.addOption(subscribe);

    Option unsubscribe = new Option("u", "unsubscribe", true, "unsubscribe from a topic");
    unsubscribe.setArgName("topic> <url");
    unsubscribe.setArgs(2);
    unsubscribe.setOptionalArg(true);
    group.addOption(unsubscribe);

    Option getSubscribers = new Option("g", "getsubscribers", true, "get subscribers of a topic");
    getSubscribers.setArgName("topic");
    getSubscribers.setArgs(1);
    getSubscribers.setOptionalArg(true);
    group.addOption(getSubscribers);

    Option delete =
        new Option(
            "d",
            "delete",
            true,
            "delete an item (default timeout: 2000ms)\n"
                + "WARNING: This function can lead to inconsistent data (e.g. "
                + "deleted items can re-appear). Also when re-creating an item "
                + "the version before the delete can re-appear.");
    delete.setArgName("key> <[timeout]");
    delete.setArgs(2);
    delete.setOptionalArg(true);
    group.addOption(delete);

    options.addOption(new Option("b", "minibench", false, "run mini benchmark"));

    options.addOption(
        new Option(
            "lh",
            "localhost",
            false,
            "gets the local host's name as known to Java (for debugging purposes)"));

    options.addOptionGroup(group);

    return options;
  }
  @SuppressWarnings("unchecked")
  public boolean parseOptions(String args[]) {

    Options options = new Options();
    options.addOption(OUTPUT_DIR_OPTION, true, "Output directory" + Workload.MERGE.onlyUsedFor());
    options.addOption(
        COMPRESSION_OPTION,
        true,
        " Compression type, one of "
            + Arrays.toString(Compression.Algorithm.values())
            + Workload.MERGE.onlyUsedFor());
    options.addOption(
        BLOOM_FILTER_OPTION,
        true,
        "Bloom filter type, one of "
            + Arrays.toString(StoreFile.BloomType.values())
            + Workload.MERGE.onlyUsedFor());
    options.addOption(BLOCK_SIZE_OPTION, true, "HFile block size" + Workload.MERGE.onlyUsedFor());
    options.addOption(
        DURATION_OPTION,
        true,
        "The amount of time to run the "
            + "random read workload for"
            + Workload.RANDOM_READS.onlyUsedFor());
    options.addOption(
        NUM_THREADS_OPTION,
        true,
        "The number of random " + "reader threads" + Workload.RANDOM_READS.onlyUsedFor());
    options.addOption(
        NUM_THREADS_OPTION,
        true,
        "The number of random " + "reader threads" + Workload.RANDOM_READS.onlyUsedFor());
    options.addOption(
        LoadTestTool.OPT_DATA_BLOCK_ENCODING, true, LoadTestTool.OPT_DATA_BLOCK_ENCODING_USAGE);
    options.addOption(
        LoadTestTool.OPT_ENCODE_IN_CACHE_ONLY, false, LoadTestTool.OPT_ENCODE_IN_CACHE_ONLY_USAGE);
    options.addOptionGroup(Workload.getOptionGroup());

    if (args.length == 0) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(HFileReadWriteTest.class.getSimpleName(), options, true);
      return false;
    }

    CommandLineParser parser = new PosixParser();
    CommandLine cmdLine;
    try {
      cmdLine = parser.parse(options, args);
    } catch (ParseException ex) {
      LOG.error(ex);
      return false;
    }

    workload = Workload.fromCmdLine(cmdLine);
    if (workload == null) return false;

    inputFileNames = (List<String>) cmdLine.getArgList();

    if (inputFileNames.size() == 0) {
      LOG.error("No input file names specified");
      return false;
    }

    if (inputFileNames.size() < workload.minNumInputFiles) {
      LOG.error("Too few input files: at least " + workload.minNumInputFiles + " required");
      return false;
    }

    if (inputFileNames.size() > workload.maxNumInputFiles) {
      LOG.error("Too many input files: at most " + workload.minNumInputFiles + " allowed");
      return false;
    }

    if (cmdLine.hasOption(COMPRESSION_OPTION)) {
      compression = Compression.Algorithm.valueOf(cmdLine.getOptionValue(COMPRESSION_OPTION));
    }

    if (cmdLine.hasOption(BLOOM_FILTER_OPTION)) {
      bloomType = StoreFile.BloomType.valueOf(cmdLine.getOptionValue(BLOOM_FILTER_OPTION));
    }

    encodeInCacheOnly = cmdLine.hasOption(LoadTestTool.OPT_ENCODE_IN_CACHE_ONLY);

    if (cmdLine.hasOption(LoadTestTool.OPT_DATA_BLOCK_ENCODING)) {
      dataBlockEncoding =
          DataBlockEncoding.valueOf(cmdLine.getOptionValue(LoadTestTool.OPT_DATA_BLOCK_ENCODING));
      // Optionally encode on disk, always encode in cache.
      dataBlockEncoder =
          new HFileDataBlockEncoderImpl(
              encodeInCacheOnly ? DataBlockEncoding.NONE : dataBlockEncoding, dataBlockEncoding);
    } else {
      if (encodeInCacheOnly) {
        LOG.error(
            "The -"
                + LoadTestTool.OPT_ENCODE_IN_CACHE_ONLY
                + " option does not make sense without -"
                + LoadTestTool.OPT_DATA_BLOCK_ENCODING);
        return false;
      }
    }

    blockSize = conf.getInt("hfile.min.blocksize.size", 65536);
    if (cmdLine.hasOption(BLOCK_SIZE_OPTION))
      blockSize = Integer.valueOf(cmdLine.getOptionValue(BLOCK_SIZE_OPTION));

    if (workload == Workload.MERGE) {
      String outputDirStr = cmdLine.getOptionValue(OUTPUT_DIR_OPTION);
      if (outputDirStr == null) {
        LOG.error("Output directory is not specified");
        return false;
      }
      outputDir = new Path(outputDirStr);
      // Will be checked for existence in validateConfiguration.
    }

    if (workload == Workload.RANDOM_READS) {
      if (!requireOptions(cmdLine, new String[] {DURATION_OPTION, NUM_THREADS_OPTION})) {
        return false;
      }

      durationSec = Integer.parseInt(cmdLine.getOptionValue(DURATION_OPTION));
      numReadThreads = Integer.parseInt(cmdLine.getOptionValue(NUM_THREADS_OPTION));
    }

    Collections.sort(inputFileNames);

    return true;
  }
Esempio n. 16
0
  /**
   * Creates the options the command line should understand.
   *
   * @return the options the program understands
   */
  private static Options getOptions() {
    final Options options = new Options();
    final OptionGroup group = new OptionGroup();

    /* Note: arguments are set to be optional since we implement argument
     * checks on our own (commons.cli is not flexible enough and only
     * checks for the existence of a first argument)
     */

    options.addOption(new Option("h", "help", false, "print this message"));

    options.addOption(
        new Option("v", "verbose", false, "print verbose information, e.g. the properties read"));

    final Option read = new Option("r", "read", true, "read an item");
    read.setArgName("key");
    read.setArgs(1);
    read.setOptionalArg(true);
    group.addOption(read);

    final Option write = new Option("w", "write", true, "write an item");
    write.setArgName("key> <value");
    write.setArgs(2);
    write.setOptionalArg(true);
    group.addOption(write);

    final Option test_and_set =
        new Option(
            null,
            "test-and-set",
            true,
            "atomic test and set, i.e. write <key> to " + "<new> if the current value is <old>");
    test_and_set.setArgName("key> <old> <new");
    test_and_set.setArgs(3);
    test_and_set.setOptionalArg(true);
    group.addOption(test_and_set);

    final Option delete =
        new Option(
            "d",
            "delete",
            true,
            "delete an item (default timeout: 2000ms)\n"
                + "WARNING: This function can lead to inconsistent data (e.g. "
                + "deleted items can re-appear). Also when re-creating an item "
                + "the version before the delete can re-appear.");
    delete.setArgName("key> <[timeout]");
    delete.setArgs(2);
    delete.setOptionalArg(true);
    group.addOption(delete);

    final Option bench =
        new Option(
            "b",
            "minibench",
            true,
            "run selected mini benchmark(s) [1|...|18|all] (default: all benchmarks, 500 operations, 10 threads per Scalaris node)");
    bench.setArgName("[ops]> <[tpn]> <[benchs]");
    bench.setArgs(20);
    bench.setOptionalArg(true);
    group.addOption(bench);

    final Option monitor = new Option("m", "monitor", true, "print monitoring information");
    monitor.setArgName("node");
    monitor.setArgs(1);
    monitor.setOptionalArg(true);
    group.addOption(monitor);

    final Option jmx =
        new Option(
            "jmx",
            "jmxservice",
            true,
            "starts a service exposing Scalaris monitoring values via JMX");
    jmx.setArgName("node");
    jmx.setArgs(1);
    jmx.setOptionalArg(true);
    group.addOption(jmx);

    options.addOptionGroup(group);

    options.addOption(
        new Option(
            "lh",
            "localhost",
            false,
            "gets the local host's name as known to Java (for debugging purposes)"));

    return options;
  }
  @Override
  public void processCommandLineArguments(String[] args) throws ConfigurationException {
    Options options = new Options();

    // option: help
    Option help = new Option("help", "print this message");

    // option: sopeco config file
    Option config =
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription("sopeco configuration file")
            .create("config");

    // option: logger config file
    Option logconfig =
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription("the logback configuration file")
            .create("logconfig");

    // option: ME URI
    Option meURI =
        OptionBuilder.withArgName("URI")
            .hasArg()
            .withDescription("URI of the measurement environment controller service")
            .create("uri");

    // option: ME Class
    Option meClass =
        OptionBuilder.withArgName("class")
            .hasArg()
            .withDescription("classname of the measurement environment controller")
            .create("meClass");

    // option: scenario definition
    Option scenarioDef =
        OptionBuilder.withArgName("file")
            .hasArg()
            .withDescription("scenario definition file")
            .create("sd");

    // option: log verbosity
    Option logVerbosity =
        OptionBuilder.withArgName("level")
            .hasArg()
            .withDescription("logging verbosity level (overrides log config)")
            .create("lv");

    // option: set home folder
    Option homePathOption =
        OptionBuilder.withArgName("path")
            .hasArg()
            .withDescription("Path to SoPeCo home folder")
            .create("home");

    // Option selectedSeries = OptionBuilder.withArgName("series")
    // .withValueSeparator(',')
    // .hasArg()
    // .withDescription("the names of selected experiment series separated by comma")
    // .create("series");

    OptionGroup meGroup = new OptionGroup();
    meGroup.addOption(meURI);
    meGroup.addOption(meClass);

    options.addOption(scenarioDef);
    options.addOption(help);
    options.addOption(config);
    options.addOptionGroup(meGroup);
    options.addOption(logconfig);
    options.addOption(homePathOption);

    // include command-line extensions
    for (ICommandLineArgumentsExtension ext : commandLineExtensions) {
      for (Option opt : ext.getCommandLineOptions()) {
        options.addOption(opt);
      }
    }

    // options.addOption(logVerbosity);

    CommandLineParser parser = new GnuParser();
    CommandLine line = null;
    try {
      line = parser.parse(options, args);
    } catch (ParseException exp) {
      if (Tools.exists("-help", args) < 0) {
        final String err = "Invalid options. " + exp.getMessage();
        System.err.println(err);
        printHelpMessage(options);
        throw new ConfigurationException(err, exp);
      } else {
        printHelpMessage(options);
        System.exit(0);
      }
    }

    // -help
    if (line.hasOption(help.getOpt())) {
      printHelpMessage(options);
      System.exit(0);
    }

    // -sd
    if (line.hasOption(scenarioDef.getOpt())) {
      setScenarioDescriptionFileName(line.getOptionValue(scenarioDef.getOpt()));
    }

    // -config
    if (line.hasOption(config.getOpt())) {
      final String configFilePath = line.getOptionValue(config.getOpt());
      loadConfiguration(configFilePath);
    }

    // -uri
    if (line.hasOption(meURI.getOpt())) {
      final String uriStr = line.getOptionValue(meURI.getOpt());
      setMeasurementControllerURI(uriStr);
    }

    // -meClass
    if (line.hasOption(meClass.getOpt())) {
      final String className = line.getOptionValue(meClass.getOpt());
      setMeasurementControllerClassName(className);
    }

    // -logconfig
    if (line.hasOption(logconfig.getOpt())) {
      setLoggerConfigFileName(line.getOptionValue(logconfig.getOpt()));
    }

    // -lv
    if (line.hasOption(logVerbosity.getOpt())) {
      final String verbosity = line.getOptionValue(logVerbosity.getOpt());
      // TODO it may not be possible
    }

    // -home
    if (line.hasOption(homePathOption.getOpt())) {
      final String homePath = line.getOptionValue(homePathOption.getOpt());
      setAppRootDirectory(homePath);
    }

    // process command-line extensions
    for (ICommandLineArgumentsExtension ext : commandLineExtensions) {
      ext.processOptions(line);
    }
  }
Esempio n. 18
0
  /**
   * Creates <code>Options</code> object that contains all available options that can be used
   * launching Sequoia console.
   *
   * @return an <code>Options</code> instance
   */
  private static Options createOptions() {
    Options options = new Options();
    OptionGroup group = new OptionGroup();

    // help, verbose, text only console and file options (mutually exclusive
    // options)
    group.addOption(new Option("h", "help", false, "Displays usage information."));
    group.addOption(
        new Option("t", "text", false, "Ignored - only for previous version compatibility."));
    group.addOption(new Option("v", "version", false, "Displays version information."));
    group.addOption(
        new Option(
            "f",
            "file",
            true,
            "Use a given file as the source of commands instead of reading commands interactively."));
    options.addOptionGroup(group);

    /**
     * Controller JMX ip option, defined in {@link
     * org.continuent.sequoia.controller.core.ControllerConstants.DEFAULT_IP}
     */
    String defaultIp = "0.0.0.0";
    // should probably better be: InetAddress.anyLocalAddress().getHostAddress()
    options.addOption(
        new Option(
            "i",
            "ip",
            true,
            "The JMX server of the controller binds to this address (the default is '"
                + defaultIp
                + "')."));

    // controller port option
    options.addOption(
        new Option(
            "p",
            "port",
            true,
            "JMX/RMI port number of (the default is " + JmxConstants.DEFAULT_JMX_RMI_PORT + ")."));

    // JMX options
    options.addOption(new Option("u", "username", true, "Username for JMX connection."));
    options.addOption(new Option("s", "secret", true, "Password for JMX connection."));

    options.addOption(new Option("d", "debug", false, "Show stack trace when error occurs."));
    options.addOption(new Option("l", "silent", false, "Show only most meaningful messages."));

    options.addOption(
        new Option(
            "n",
            "nocolor",
            false,
            "Do not print colors in interactive mode for supported systems."));

    options.addOption(
        new Option("e", "exitonerror", false, "Stop on error in non interactive mode."));

    options.addOption(
        new Option(
            "r",
            "requestdelimiter",
            true,
            "Request delimiter for multiline statements in the SQL console."));

    options.addOption(
        new Option("m", "multiline", false, "Enable multiline statements in the SQL console."));

    options.addOption(new Option("q", "sqlclient", false, "Launch SQL client console."));

    return options;
  }
Esempio n. 19
0
  private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("name");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set device name, use DCMRCV by default");
    opts.addOption(OptionBuilder.create("device"));

    OptionBuilder.withArgName("NULL|3DES|AES");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("enable TLS connection without, 3DES or AES encryption");
    opts.addOption(OptionBuilder.create("tls"));

    OptionGroup tlsProtocol = new OptionGroup();
    tlsProtocol.addOption(
        new Option("tls1", "disable the use of SSLv3 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(
        new Option("ssl3", "disable the use of TLSv1 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("no_tls1", "disable the use of TLSv1 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl3", "disable the use of SSLv3 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl2", "disable the use of SSLv2 for TLS connections"));
    opts.addOptionGroup(tlsProtocol);

    opts.addOption("noclientauth", false, "disable client authentification for TLS");

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "file path or URL of P12 or JKS keystore, resource:tls/test_sys_2.p12 by default");
    opts.addOption(OptionBuilder.create("keystore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for keystore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("keystorepw"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "password for accessing the key in the keystore, keystore password by default");
    opts.addOption(OptionBuilder.create("keypw"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "file path or URL of JKS truststore, resource:tls/mesa_certs.jks by default");
    opts.addOption(OptionBuilder.create("truststore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for truststore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("truststorepw"));

    OptionBuilder.withArgName("dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "store received objects into files in specified directory <dir>."
            + " Do not store received objects by default.");
    opts.addOption(OptionBuilder.create("dest"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "file path or URL of properties for mapping Calling AETs to "
            + "sub-directories of the storage directory specified by "
            + "-dest, to separate the storage location dependend on "
            + "Calling AETs.");
    opts.addOption(OptionBuilder.create("calling2dir"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "file path or URL of properties for mapping Called AETs to "
            + "sub-directories of the storage directory specified by "
            + "-dest, to separate the storage location dependend on "
            + "Called AETs.");
    opts.addOption(OptionBuilder.create("called2dir"));

    OptionBuilder.withArgName("sub-dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "storage sub-directory used for Calling AETs for which no "
            + " mapping is defined by properties specified by "
            + "-calling2dir, 'OTHER' by default.");
    opts.addOption(OptionBuilder.create("callingdefdir"));

    OptionBuilder.withArgName("sub-dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "storage sub-directory used for Called AETs for which no "
            + " mapping is defined by properties specified by "
            + "-called2dir, 'OTHER' by default.");
    opts.addOption(OptionBuilder.create("calleddefdir"));

    OptionBuilder.withArgName("dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "register stored objects in cache journal files in specified directory <dir>."
            + " Do not register stored objects by default.");
    opts.addOption(OptionBuilder.create("journal"));

    OptionBuilder.withArgName("pattern");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "cache journal file path, with "
            + "'yyyy' will be replaced by the current year, "
            + "'MM' by the current month, 'dd' by the current date, "
            + "'HH' by the current hour and 'mm' by the current minute. "
            + "'yyyy/MM/dd/HH/mm' by default.");
    opts.addOption(OptionBuilder.create("journalfilepath"));

    opts.addOption("defts", false, "accept only default transfer syntax.");
    opts.addOption("bigendian", false, "accept also Explict VR Big Endian transfer syntax.");
    opts.addOption("native", false, "accept only transfer syntax with uncompressed pixel data.");

    OptionGroup scRetrieveAET = new OptionGroup();
    OptionBuilder.withArgName("aet");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "Retrieve AE Title included in Storage Commitment "
            + "N-EVENT-REPORT in items of the Referenced SOP Sequence.");
    scRetrieveAET.addOption(OptionBuilder.create("scretraets"));
    OptionBuilder.withArgName("aet");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "Retrieve AE Title included in Storage Commitment "
            + "N-EVENT-REPORT outside of the Referenced SOP Sequence.");
    scRetrieveAET.addOption(OptionBuilder.create("scretraet"));
    opts.addOptionGroup(scRetrieveAET);

    opts.addOption(
        "screusefrom",
        false,
        "attempt to issue the Storage Commitment N-EVENT-REPORT on "
            + "the same Association on which the N-ACTION operation was "
            + "performed; use different Association for N-EVENT-REPORT by "
            + "default.");

    opts.addOption(
        "screuseto",
        false,
        "attempt to issue the Storage Commitment N-EVENT-REPORT on "
            + "previous initiated Association to the Storage Commitment SCU; "
            + "initiate new Association for N-EVENT-REPORT by default.");

    OptionBuilder.withArgName("port");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "port of Storage Commitment SCU to connect to issue "
            + "N-EVENT-REPORT on different Association; 104 by default.");
    opts.addOption(OptionBuilder.create("scport"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "delay in ms for N-EVENT-REPORT-RQ to Storage Commitment SCU, " + "1s by default");
    opts.addOption(OptionBuilder.create("scdelay"));

    OptionBuilder.withArgName("retry");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "number of retries to issue N-EVENT-REPORT-RQ to Storage "
            + "Commitment SCU, 0 by default");
    opts.addOption(OptionBuilder.create("scretry"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "interval im ms between retries to issue N-EVENT-REPORT-RQ to"
            + "Storage Commitment SCU, 60s by default");
    opts.addOption(OptionBuilder.create("scretryperiod"));

    OptionBuilder.withArgName("maxops");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "maximum number of outstanding operations performed "
            + "asynchronously, unlimited by default.");
    opts.addOption(OptionBuilder.create("async"));

    opts.addOption(
        "pdv1",
        false,
        "send only one PDV in one P-Data-TF PDU, "
            + "pack command and data PDV in one P-DATA-TF PDU by default.");
    opts.addOption("tcpdelay", false, "set TCP_NODELAY socket option to false, true by default");

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for TCP connect, no timeout by default");
    opts.addOption(OptionBuilder.create("connectTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("rspTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-ASSOCIATE-AC, 5s by default");
    opts.addOption(OptionBuilder.create("acceptTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "delay in ms for Socket close after sending A-ABORT, 50ms by default");
    opts.addOption(OptionBuilder.create("soclosedelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "delay in ms for DIMSE-RSP; useful for testing asynchronous mode");
    opts.addOption(OptionBuilder.create("rspdelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving -ASSOCIATE-RQ, 5s by default");
    opts.addOption(OptionBuilder.create("requestTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-RELEASE-RP, 5s by default");
    opts.addOption(OptionBuilder.create("releaseTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "period in ms to check for outstanding DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("reaper"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RQ, 60s by default");
    opts.addOption(OptionBuilder.create("idleTO"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "maximal length in KB of received P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("rcvpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal length in KB of sent P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("sndpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_RCVBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sorcvbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_SNDBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sosndbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "minimal buffer size to write received object to file, 1KB by default");
    opts.addOption(OptionBuilder.create("bufsize"));

    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
      cl = new GnuParser().parse(opts, args);
    } catch (ParseException e) {
      exit("dcmrcv: " + e.getMessage());
      throw new RuntimeException("unreachable");
    }
    if (cl.hasOption("V")) {
      Package p = DcmRcv.class.getPackage();
      System.out.println("dcmrcv v" + p.getImplementationVersion());
      System.exit(0);
    }
    if (cl.hasOption("h") || cl.getArgList().size() == 0) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
      System.exit(0);
    }
    return cl;
  }
Esempio n. 20
0
  /**
   * Configures the program options
   *
   * @param options
   */
  private static void configureOptions(Options options) {

    Option transformationOpt = OptionBuilder.create(TRANSFORMATION);
    transformationOpt.setLongOpt(TRANSFORMATION_LONG);
    transformationOpt.setArgName("transformation.emftvm");
    transformationOpt.setDescription("URI of the ATL transformation file.");
    transformationOpt.setArgs(1);
    transformationOpt.setRequired(true);

    Option sourcemmOpt = OptionBuilder.create(SOURCE_PACKAGE);
    sourcemmOpt.setLongOpt(SOURCE_PACKAGE_LONG);
    sourcemmOpt.setArgName("source.ecore");
    sourcemmOpt.setDescription("FQN of the source package.");
    sourcemmOpt.setArgs(1);
    sourcemmOpt.setRequired(true);

    Option targetmmOpt = OptionBuilder.create(TARGET_PACKAGE);
    targetmmOpt.setLongOpt(TARGET_PACKAGE_LONG);
    targetmmOpt.setArgName("target.ecore");
    targetmmOpt.setDescription("FQN of the target package.");
    targetmmOpt.setArgs(1);
    targetmmOpt.setRequired(true);

    Option inputOpt = OptionBuilder.create(INPUT_MODEL);
    inputOpt.setLongOpt(INPUT_MODEL_LONG);
    inputOpt.setArgName("input.xmi");
    inputOpt.setDescription("URI of the input file.");
    inputOpt.setArgs(1);
    inputOpt.setRequired(true);

    Option outputOpt = OptionBuilder.create(OUTPUT_MODEL);
    outputOpt.setLongOpt(OUTPUT_MODEL_LONG);
    outputOpt.setArgName("output.xmi");
    outputOpt.setDescription("URI of the output file. Optional.");
    outputOpt.setArgs(1);

    Option recordsOpt = OptionBuilder.create(RECORDS_FILE);
    recordsOpt.setLongOpt(RECORDS_FILE_LONG);
    recordsOpt.setArgName("records.rec");
    recordsOpt.setDescription("URI of the records file.");
    recordsOpt.setArgs(1);
    recordsOpt.setRequired(true);

    Option recommendedMappersOption = OptionBuilder.create(RECOMMENDED_MAPPERS);
    recommendedMappersOption.setLongOpt(RECOMMENDED_MAPPERS_LONG);
    recommendedMappersOption.setArgName("mappers_hint");
    recommendedMappersOption.setDescription(
        "The recommended number of mappers (not strict, used only as a hint). Optional, defaults to 1. Excludes the use of '-n'.");
    recommendedMappersOption.setType(Number.class);
    recommendedMappersOption.setArgs(1);

    Option recordsPerMapperOption = OptionBuilder.create(RECORDS_PER_MAPPER);
    recordsPerMapperOption.setLongOpt(RECORDS_PER_MAPPER_LONG);
    recordsPerMapperOption.setArgName("recors_per_mapper");
    recordsPerMapperOption.setDescription(
        "Number of records to be processed by mapper. Optional, defaults to all records. Excludes the use of '-m'.");
    recordsPerMapperOption.setType(Number.class);
    recordsPerMapperOption.setArgs(1);

    OptionGroup mappersGroup = new OptionGroup();
    mappersGroup.addOption(recommendedMappersOption);
    mappersGroup.addOption(recordsPerMapperOption);

    Option quietOption = OptionBuilder.create(QUIET);
    quietOption.setLongOpt(QUIET_LONG);
    quietOption.setDescription(
        "Do not print any information about the transformation execution on the standard output. Optional, disabled by default.");
    quietOption.setArgs(0);

    Option verboseOption = OptionBuilder.create(VERBOSE);
    verboseOption.setLongOpt(VERBOSE_LONG);
    verboseOption.setDescription("Verbose mode. Optional, disabled by default.");
    verboseOption.setArgs(0);

    OptionGroup loggingGroup = new OptionGroup();
    loggingGroup.addOption(quietOption);
    loggingGroup.addOption(verboseOption);

    options.addOption(transformationOpt);
    options.addOption(sourcemmOpt);
    options.addOption(targetmmOpt);
    options.addOption(recordsOpt);
    options.addOption(inputOpt);
    options.addOption(outputOpt);
    options.addOptionGroup(loggingGroup);
    options.addOptionGroup(mappersGroup);
  }