public void parse()

in metron-platform/metron-pcap-backend/src/main/java/org/apache/metron/pcap/query/CliParser.java [74:140]


  public void parse(CommandLine commandLine, PcapConfig config) throws java.text.ParseException {
    if (commandLine.hasOption("help")) {
      config.setShowHelp(true);
    }
    if (commandLine.hasOption("date_format")) {
      config.setDateFormat(commandLine.getOptionValue("date_format"));
    }
    if (commandLine.hasOption("base_path")) {
      config.setBasePath(commandLine.getOptionValue("base_path"));
    } else {
      config.setBasePath(BASE_INPUT_PATH_DEFAULT);
    }
    if (commandLine.hasOption("base_output_path")) {
      config.setBaseInterimResultPath(commandLine.getOptionValue("base_output_path"));
    } else {
      config.setBaseInterimResultPath(BASE_INTERIM_RESULT_PATH_DEFAULT);
    }
    if (commandLine.hasOption("start_time")) {
      try {
        if (commandLine.hasOption("date_format")) {
          long startTime = config.getDateFormat().parse(commandLine.getOptionValue("start_time")).getTime();
          config.setStartTimeMs(startTime);
        } else {
          long startTime = Long.parseLong(commandLine.getOptionValue("start_time"));
          config.setStartTimeMs(startTime);
        }
      } catch (NumberFormatException nfe) {
        //no-op
      }
    }
    if (commandLine.hasOption("num_reducers")) {
      int numReducers = Integer.parseInt(commandLine.getOptionValue("num_reducers"));
      config.setNumReducers(numReducers);
    }
    else {
      config.setNumReducers(NUM_REDUCERS_DEFAULT);
    }
    if (commandLine.hasOption("records_per_file")) {
      int numRecordsPerFile = Integer.parseInt(commandLine.getOptionValue("records_per_file"));
      config.setNumRecordsPerFile(numRecordsPerFile);
    }
    else {
      config.setNumRecordsPerFile(NUM_RECORDS_PER_FILE_DEFAULT);
    }
    if (commandLine.hasOption("end_time")) {
      try {
        if (commandLine.hasOption("date_format")) {
          long endTime = config.getDateFormat().parse(commandLine.getOptionValue("end_time")).getTime();
          config.setEndTimeMs(endTime);
        } else {
          long endTime = Long.parseLong(commandLine.getOptionValue("end_time"));
          config.setEndTimeMs(endTime);
        }
      } catch (NumberFormatException nfe) {
        //no-op
      }
    }
    if (commandLine.hasOption("yarn_queue")) {
      config.setYarnQueue(commandLine.getOptionValue("yarn_queue"));
    }
    if (commandLine.hasOption("finalizer_threads")) {
      String numThreads = commandLine.getOptionValue("finalizer_threads");
      config.setFinalizerThreadpoolSize(numThreads);
    } else {
      config.setFinalizerThreadpoolSize(NUM_FINALIZER_THREADS_DEFAULT);
    }
  }