Main method for NutchServer to run via command line. @param args arguments for log level, stopping the Server and port. @throws Exception exception
(String[] args)
| 367 | * @throws Exception exception |
| 368 | */ |
| 369 | public static void main(String[] args) throws Exception { |
| 370 | CommandLineParser parser = new PosixParser(); |
| 371 | Options options = createOptions(); |
| 372 | CommandLine commandLine = parser.parse(options, args); |
| 373 | |
| 374 | if (commandLine.hasOption(CMD_HELP)) { |
| 375 | HelpFormatter formatter = new HelpFormatter(); |
| 376 | formatter.printHelp("NutchServer", options, true); |
| 377 | return; |
| 378 | } |
| 379 | |
| 380 | if (commandLine.hasOption(CMD_LOG_LEVEL)) { |
| 381 | logLevel = commandLine.getOptionValue(CMD_LOG_LEVEL); |
| 382 | } |
| 383 | |
| 384 | if (commandLine.hasOption(CMD_PORT)) { |
| 385 | port = Integer.parseInt(commandLine.getOptionValue(CMD_PORT)); |
| 386 | } |
| 387 | |
| 388 | if (commandLine.hasOption(CMD_STOP)) { |
| 389 | String stopParameter = commandLine.getOptionValue(CMD_STOP); |
| 390 | boolean force = StringUtils.equals("force", stopParameter); |
| 391 | stopRemoteServer(force); |
| 392 | return; |
| 393 | } |
| 394 | |
| 395 | startServer(); |
| 396 | } |
| 397 | |
| 398 | private static void startServer() { |
| 399 | NutchServer server = new NutchServer(); |
nothing calls this directly
no test coverage detected