Package org.apache.commons.cli2.validation

Examples of org.apache.commons.cli2.validation.Validator


    Group group = gbuilder.withName("Options").withOption(inputFileOpt).withOption(trainingOutputOpt)
         .withOption(testOutputOpt).withOption(trainingDataSizeOpt).withOption(testDataSizeOpt).create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return false;
      }
View Full Code Here


      .withOption(countFileOpt)
      .withOption(outputFileOpt)
      .withOption(solrUrlOpt).create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return false;
      }
View Full Code Here

      .withOption(outputFileOpt).withOption(limitOpt)
      .withOption(cutoffOpt).create();

   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return false;
      }
View Full Code Here

      .withOption(textFieldsOpt)
      .withOption(useTermVectorsOpt)
      .create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
View Full Code Here

    .withOption(modelOpt)
    .withOption(helpOpt)
    .create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
     
      if (cmdLine.hasOption(helpOpt)) {
        CommandLineUtil.printHelp(group);
        return;
      }
View Full Code Here

            abuilder.withName("batch").withMinimum(1).withMaximum(1).create()).
            withDescription("The number of docs to include in each indexing batch").withShortName("b").create();

    Group group = gbuilder.withName("Options").withOption(wikipediaFileOpt).withOption(numDocsOpt).withOption(solrURLOpt).withOption(solrBatchOpt).create();

    Parser parser = new Parser();
    parser.setGroup(group);
    CommandLine cmdLine = parser.parse(args);

    File file;
    file = new File(cmdLine.getValue(wikipediaFileOpt).toString());
    File[] dumpFiles;
    if (file.isDirectory()) {
View Full Code Here

  private static void parseCommand(String[] args)
  {
    Parser parser = new Parser();

    // configure a HelpFormatter
    HelpFormatter hf = new HelpFormatter();
    DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
    ;

    // configure a parser
    Parser p = new Parser();
View Full Code Here

        "Default Configuration File").withArgument(defaultFile).create());

    gBuilder.withOption(oBuilder.reset().withId(OPTION_G).withShortName("g").withLongName("genconf").withDescription(
        "Generate configuration file from pid").withArgument(pid2).create());

    FileValidator fValidator = VFSFileValidator.getExistingFileInstance().setBase(".");
    fValidator.setFile(false);
    // fValidator.setReadable(true);
    gBuilder.withOption(aBuilder.reset().withName(CONF_FILE).withDescription("is the wrapper.conf to use.  Name must be absolute or relative")
        .withMinimum(0).withMaximum(10).create());

    Validator pValidator = new Validator()
View Full Code Here

        if ((isExisting() && !f.exists()) || (isFile() && !f.getType().equals(FileType.FILE))
            || (isDirectory() && !f.getType().equals(FileType.FILE)) || (isHidden() && !f.isHidden())
            || (isReadable() && !f.isReadable()) || (isWritable() && !f.isWriteable()))
        {

          throw new InvalidArgumentException(name);
        }

        i.set(name);
      }
      catch (Exception ex)
      {
        ex.printStackTrace();
        throw new InvalidArgumentException(name);
      }
    }
  }
View Full Code Here

        for (Iterator it = values.iterator(); it.hasNext();)
        {
          String p = (String) it.next();
          if (!Pattern.matches("wrapper\\..*=.*", p))
          {
            throw new InvalidArgumentException(p);
          }
        }

      }

View Full Code Here

TOP

Related Classes of org.apache.commons.cli2.validation.Validator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.