use of org.apache.helix.rest.server.auditlog.auditloggers.FileBasedAuditLogger in project helix by apache.
the class HelixRestMain method processCommandLineArgs.
private static void processCommandLineArgs(String[] cliArgs) throws Exception {
CommandLineParser cliParser = new GnuParser();
Options cliOptions = constructCommandLineOptions();
CommandLine cmd = null;
try {
cmd = cliParser.parse(cliOptions, cliArgs);
} catch (ParseException pe) {
LOG.error("RestAdminApplication: failed to parse command-line options: " + pe.toString());
printUsage(cliOptions);
System.exit(1);
}
int port = DEFAULT_PORT;
String zkAddr;
List<HelixRestNamespace> namespaces = new ArrayList<>();
if (cmd.hasOption(HELP)) {
printUsage(cliOptions);
return;
} else {
if (cmd.hasOption(PORT)) {
port = Integer.parseInt(cmd.getOptionValue(PORT));
}
zkAddr = String.valueOf(cmd.getOptionValue(ZKSERVERADDRESS));
namespaces.add(new HelixRestNamespace(zkAddr));
if (cmd.hasOption(NAMESPACE_MANIFEST_FILE)) {
constructNamespaceFromConfigFile(String.valueOf(cmd.getOptionValue(NAMESPACE_MANIFEST_FILE)), namespaces);
}
}
final HelixRestServer restServer = new HelixRestServer(namespaces, port, URI_PREFIX, Arrays.<AuditLogger>asList(new FileBasedAuditLogger()));
try {
restServer.start();
restServer.join();
} catch (HelixException ex) {
LOG.error("Failed to start Helix rest server, " + ex);
} finally {
restServer.shutdown();
}
}
Aggregations