Mercurial > hg > Database > Christie
changeset 47:782c66b3b38f
add Config.java
author | akahori |
---|---|
date | Tue, 21 Aug 2018 08:40:03 +0900 |
parents | 21cf500585d1 |
children | 174a2f37ec28 |
files | src/main/java/christie/daemon/Config.java |
diffstat | 1 files changed, 44 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/daemon/Config.java Tue Aug 21 08:40:03 2018 +0900 @@ -0,0 +1,44 @@ +package christie.daemon; + +import org.apache.log4j.Level; + +public class Config { + + public int localPort = 10000; + public String logFile = null; + public Level level = Level.FATAL; + public String MCSTADDR = "224.0.0.1"; + public String nis = "en1"; + public boolean useKeepAlive = true; + + public Config(String[] args) { + for (int i = 0; i< args.length; i++) { + if ("-p".equals(args[i])) { + localPort = Integer.parseInt(args[++i]); + } else if ("-log".equals(args[i])) { + logFile = args[++i]; + } else if ("-n".equals(args[i])) { + nis = args[++i]; + } else if ("--noKeepAlive".equals(args[i])) { + useKeepAlive = false; + } else if ("-a".equals(args[i])) { + MCSTADDR = args[++i]; + } else if ("-level".equals(args[i])) { + String levelStr = args[++i]; + if (levelStr.equals("fatal")) { + level = Level.FATAL; + } else if (levelStr.equals("error")) { + level = Level.ERROR; + } else if (levelStr.equals("warn")) { + level = Level.WARN; + } else if (levelStr.equals("info")) { + level = Level.INFO; + } else if (levelStr.equals("debug")) { + level = Level.DEBUG; + } + } + } + + } + +}