Beispiel #1
0
 public Demo(String[] args) throws Exception {
   commandLineOptions = parseParameters(args);
   String nodeType = commandLineOptions.getString("nodeType");
   isMaster = nodeType != null && nodeType.equals("master");
   cfgFile = commandLineOptions.getString("configFile");
   if (cfgFile == null) {
     System.err.println(jsap.getHelp());
     System.exit(1);
   }
 }
Beispiel #2
0
  protected JSAPResult parseParameters(String[] args) throws Exception {
    jsap = buildCommandLineOptions();

    JSAPResult config = jsap.parse(args);
    if (!config.success() || jsap.messagePrinted()) {
      Iterator<?> messageIterator = config.getErrorMessageIterator();
      while (messageIterator.hasNext()) System.err.println(messageIterator.next());
      System.err.println(jsap.getHelp());
      System.exit(1);
    }

    return config;
  }