4 changed files with 65 additions and 12 deletions
@ -1,11 +1,41 @@
|
||||
package org.leolo.nrdatad; |
||||
|
||||
|
||||
import org.apache.commons.cli.*; |
||||
import org.apache.logging.log4j.LogManager; |
||||
import org.apache.logging.log4j.Logger; |
||||
|
||||
/** |
||||
* Hello world! |
||||
* |
||||
*/ |
||||
public class App { |
||||
|
||||
Logger logger = LogManager.getLogger(); |
||||
public static void main( String[] args ) { |
||||
System.out.println( "Hello World!" ); |
||||
Option confFile = Option.builder() |
||||
.required(false) |
||||
.hasArg(true) |
||||
.argName("fileName") |
||||
.option("c") |
||||
.longOpt("config-file") |
||||
.build(); |
||||
Options opts = new Options(); |
||||
opts.addOption(confFile); |
||||
String confPath = "nrdatad.conf"; |
||||
try { |
||||
CommandLine cli = new DefaultParser().parse(opts, args); |
||||
if(cli.hasOption(confFile)){ |
||||
confPath = cli.getOptionValue(confFile); |
||||
} |
||||
} catch (ParseException e) { |
||||
throw new RuntimeException(e); |
||||
} |
||||
new App().run(confPath); |
||||
} |
||||
|
||||
private void run(String configPath){ |
||||
logger.always().log("System Started."); |
||||
|
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue