Ejemplo n.º 1
0
  /**
   * main CLI entry-point into the application.
   *
   * @param args the command line arguments
   */
  public void run(String[] args) {
    CliParser cli = new CliParser();
    try {
      cli.parse(args);
    } catch (FileNotFoundException ex) {
      Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
      return;
    } catch (ParseException ex) {
      Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
      return;
    }

    if (cli.isGetVersion()) {
      cli.printVersionInfo();
    } else if (cli.isLoadCPE()) {
      loadCPE(cli.getCpeFile());
    } else if (cli.isRunScan()) {
      if (cli.isAutoUpdate()) {
        Index cpeI = new Index();
        try {
          cpeI.update();
        } catch (Exception ex) {
          Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
        }
      }

      runScan(cli.getReportDirectory(), cli.getApplicationName(), cli.getScanFiles());
    } else {
      cli.printHelp();
    }
  }