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); } }
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; }