Examples of CommandLineParser


Examples of org.apache.commons.cli.CommandLineParser

   
    public static void main(String[] args) throws Exception {
      Options options = getOptions();
      try {
       
        CommandLineParser parser = new GnuParser();

        CommandLine line = parser.parse( options, args );
        File dir = new File(line.getOptionValue("dir", "."));
        Collection files = ListFile.list(dir);
        System.out.println("listing files in "+dir);
        for (Iterator it = files.iterator(); it.hasNext(); ) {
          System.out.println("\t"+it.next()+"\n");
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

      if (args.length == 0) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("HFile ", options, true);
        System.exit(-1);
      }
      CommandLineParser parser = new PosixParser();
      CommandLine cmd = parser.parse(options, args);
      boolean verbose = cmd.hasOption("v");
      boolean printKeyValue = cmd.hasOption("p");
      boolean printMeta = cmd.hasOption("m");
      boolean checkRow = cmd.hasOption("k");
      boolean checkFamily = cmd.hasOption("a");
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

      return _usage;
    }

    public boolean processCommandLineArgs(String[] cliArgs) throws IOException, DatabusException
    {
      CommandLineParser cliParser = new GnuParser();
      _cmd = null;

      try
      {
        _cmd = cliParser.parse(_cliOptions, cliArgs);
      } catch (ParseException pe)
      {
        System.err.println(NAME + ": failed to parse command-line options: " + pe.toString());
        printCliHelp();
        return false;
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

    return options;
  }

  protected static String[] processLocalArgs(String[] cliArgs) throws IOException, ParseException
  {
    CommandLineParser cliParser = new GnuParser();
    Options cliOptions = constructCommandLineOptions();

    CommandLine cmd = cliParser.parse(cliOptions, cliArgs, true);
    // Options here has to be up front
    if (cmd.hasOption(RELAY_HOST_OPT_NAME))
    {
      _relayHost = cmd.getOptionValue(RELAY_HOST_OPT_NAME);
      LOG.info("Relay Host = " + _relayHost);
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

    public void processCommandLineArgs(String[] cliArgs) throws IOException, DatabusException
    {
      constructCommandLineOptions();

      CommandLineParser cliParser = new GnuParser();

      _cmd = null;
      try
      {
        _cmd = cliParser.parse(_cliOptions, cliArgs);
      }
      catch (ParseException pe)
      {
        System.err.println("HttpServer: failed to parse command-line options: " + pe.toString());
        printCliHelp();
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

    String rawDataPath = "";
    String tempTsvPath = "";
    String originalTSVPath = "";
    String sdmxTTLFile = "";
   
    CommandLineParser parser = new BasicParser( );
    Options options = new Options( );
    options.addOption("h", "help", false, "Print this usage information");
    options.addOption("i", "file path", true, "Input file path of the TableOfContents.xml file.");
    options.addOption("o", "output file path", true, "Output directory path where the new TableOfContents.xml file will be saved.");
    options.addOption("f", "log file path", true, "Output directory path where the log of updates will be stored.");
    options.addOption("z", "temp zip path", true, "Directory path where zip files will be temporarily stored.");
    options.addOption("v", "temp tsv path", true, "Directory path where tsv files will be temporarily stored.");
    options.addOption("t", "temp data path", true, "Directory path where the sdmx and dsd files will be temporarily stored.");
    options.addOption("s", "sdmx file path", true, "Output directory path to generate DataCube representation of observations.");
    options.addOption("d", "dsd file path", true, "Output directory path to generate DataCube representation of DSD.");
    options.addOption("l", "data log path", true, "File path where the logs will be written.");
    options.addOption("p", "original data path", true, "Path where zip files will be stored.");
    options.addOption("b", "original tsv path", true, "Path where tsv files will be stored.");
    options.addOption("r", "raw data path", true, "Path where the uncompressed files will be stored.");
    options.addOption("a", "sdmx ttl file", true, "Path where the sdmx ttl is located.");
    CommandLine commandLine = parser.parse( options, args );
   
    if( commandLine.hasOption('h') ) {
        usage();
        return;
     }
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

  }

  @SuppressWarnings("static-access")
  public static Config parseArgs(String[] args) throws Exception
  {
    CommandLineParser cliParser = new GnuParser();


    Option helpOption = OptionBuilder.withLongOpt(HELP_OPT_LONG_NAME)
        .withDescription("Help screen")
        .create(HELP_OPT_CHAR);

    Option sourceIdOption = OptionBuilder.withLongOpt(SOURCE_ID_OPT_LONG_NAME)
        .withDescription("Source ID for which tables need to be added")
        .hasArg()
        .withArgName("Source ID")
        .create(SOURCE_ID_OPT_CHAR);

    Option sourceNameOption = OptionBuilder.withLongOpt(SOURCE_NAME_OPT_LONG_NAME)
        .withDescription("Source Name for which tables need to be added")
        .hasArg()
        .withArgName("Source ID")
        .create(SOURCE_NAME_OPT_CHAR);

    Option dbOption = OptionBuilder.withLongOpt(BOOTSTRAP_DB_PROPS_OPT_LONG_NAME)
        .withDescription("Bootstrap producer properties to use")
        .hasArg()
        .withArgName("property_file")
        .create(BOOTSTRAP_DB_PROP_OPT_CHAR);

    Option cmdLinePropsOption = OptionBuilder.withLongOpt(CMD_LINE_PROPS_OPT_LONG_NAME)
        .withDescription("Cmd line override of config properties. Semicolon separated.")
        .hasArg()
        .withArgName("Semicolon_separated_properties")
        .create(CMD_LINE_PROPS_OPT_CHAR);

    Option log4jPropsOption = OptionBuilder.withLongOpt(LOG4J_PROPS_OPT_LONG_NAME)
        .withDescription("Log4j properties to use")
        .hasArg()
        .withArgName("property_file")
        .create(LOG4J_PROPS_OPT_CHAR);

    Options options = new Options();
    options.addOption(helpOption);
    options.addOption(sourceIdOption);
    options.addOption(sourceNameOption);
    options.addOption(dbOption);
    options.addOption(cmdLinePropsOption);
    options.addOption(log4jPropsOption);

    CommandLine cmd = null;
    try
    {
      cmd = cliParser.parse(options, args);
    }
    catch (ParseException pe)
    {
      LOG.error("Bootstrap Physical Config: failed to parse command-line options.", pe);
      throw new RuntimeException("Bootstrap Physical Config: failed to parse command-line options.", pe);
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

  {
    String fileName = "";
    String sdmxFilePath = "";
    String tsvFilePath = "";
   
    CommandLineParser parser = new BasicParser( );
    Options options = new Options( );
    options.addOption("h", "help", false, "Print this usage information");
    options.addOption("f", "filename", true, "Name of the file.");
    options.addOption("i", "file path", true, "File path of the SDMX xml file.");
    options.addOption("t", "tsv file path", true, "File path of the SDMX tsv file.");
    options.addOption("o", "output file path", true, "Output directory path to generate DataCube representation of observations");
    options.addOption("l", "log file path", true, "File path where the logs will be written.");
   
    CommandLine commandLine = parser.parse( options, args );
   
    if( commandLine.hasOption('h') ) {
        usage();
        return;
     }
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser


  @SuppressWarnings("static-access")
  public static void parseArgs(String[] args) throws IOException
  {
      CommandLineParser cliParser = new GnuParser();


      Option helpOption = OptionBuilder.withLongOpt(HELP_OPT_LONG_NAME)
                                     .withDescription("Help screen")
                                     .create(HELP_OPT_CHAR);

      Option dbOption = OptionBuilder.withLongOpt(BOOTSTRAP_DB_PROPS_OPT_LONG_NAME)
                                  .withDescription("Bootstrap Cleaner and DB properties to use")
                                  .hasArg()
                                  .withArgName("property_file")
                                  .create(BOOTSTRAP_DB_PROP_OPT_CHAR);

      Option cmdLinePropsOption1 = OptionBuilder.withLongOpt(CLEANER_CMD_LINE_PROPS_OPT_LONG_NAME)
                      .withDescription("Cmd line override of cleaner config properties. Semicolon separated.")
                      .hasArg()
                      .withArgName("Semicolon_separated_properties")
                      .create(CLEANER_CMD_LINE_PROPS_OPT_CHAR);

    Option log4jPropsOption = OptionBuilder.withLongOpt(LOG4J_PROPS_OPT_LONG_NAME)
                  .withDescription("Log4j properties to use")
                  .hasArg()
                  .withArgName("property_file")
                  .create(LOG4J_PROPS_OPT_CHAR);

      Option sourcesOption = OptionBuilder.withLongOpt(BOOTSTRAP_SOURCES_OPT_LONG_NAME)
              .withDescription("Comma seperated list of sourceNames. If not provided, no source will be cleaned up")
              .hasArg()
              .withArgName("comma-seperated sources")
              .create(BOOTSTRAP_SOURCES_PROP_OPT_CHAR);

      Options options = new Options();
      options.addOption(helpOption);
      options.addOption(dbOption);
      options.addOption(cmdLinePropsOption1);
    options.addOption(log4jPropsOption);
    options.addOption(sourcesOption);

      CommandLine cmd = null;
      try
      {
        cmd = cliParser.parse(options, args);
      }
      catch (ParseException pe)
      {
      LOG.error("Bootstrap Physical Config: failed to parse command-line options.", pe);
        throw new RuntimeException("Bootstrap Physical Config: failed to parse command-line options.", pe);
View Full Code Here

Examples of org.apache.commons.cli.CommandLineParser

  public static void main(String[] args) throws Exception
  {
   
    String sdmxFilePath = "";
    String logFilePath = "";
    CommandLineParser parser = new BasicParser( );
    Options options = new Options( );
   
    options.addOption("i", "file path", true, "sdmx file path.");
    options.addOption("l", "log file path", true, "File path where the logs will be generated");
   
    CommandLine commandLine = parser.parse( options, args );
   
    if(commandLine.hasOption('i'))
      sdmxFilePath = commandLine.getOptionValue('i');
       
    if(commandLine.hasOption('l'))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.