1 13 package org.ejbca.ui.tcp; 14 25 26 import java.util.Properties ; 27 28 import org.apache.commons.lang.StringUtils; 29 30 36 public class CmpTcpConfiguration { 37 38 39 private static CmpTcpConfiguration config = null; 40 41 42 private Properties prop = null; 43 44 private static final int DEFAULT_PORT = 829; 45 private static final String DEFAULT_BIND_HOST="0.0.0.0"; 46 private static final String DEFAULT_LOG_DIR="./log"; 47 private static final String DEFAULT_CONF_FILE=""; 48 49 private CmpTcpConfiguration() { 50 } 51 52 public static CmpTcpConfiguration instance() { 53 if (config == null) { 54 config = new CmpTcpConfiguration(); 55 } 56 return config; 57 } 58 59 public void init(Properties prop) { 60 this.prop = prop; 61 } 62 63 public int getPort() { 64 int ret = DEFAULT_PORT; 65 String str = prop.getProperty("portNo"); 66 if (StringUtils.isNotEmpty(str)) { 67 ret = new Integer (str).intValue(); 68 } 69 return ret; 70 } 71 public String getLogDir() { 72 String ret = DEFAULT_LOG_DIR; 73 String str = prop.getProperty("logDir"); 74 if (StringUtils.isNotEmpty(str)) { 75 ret = str; 76 } 77 return ret; 78 } 79 public String getConfFile() { 80 String ret = DEFAULT_CONF_FILE; 81 String str = prop.getProperty("confFile"); 82 if (StringUtils.isNotEmpty(str)) { 83 ret = str; 84 } 85 return ret; 86 } 87 88 public String getBindHost() { 89 String ret = DEFAULT_BIND_HOST; 90 String str = prop.getProperty("bindHost"); 91 if (StringUtils.isNotEmpty(str)) { 92 ret = str; 93 } 94 return ret; 95 } 96 public Properties getProperties() { 97 return prop; 98 } 99 } 100 | Popular Tags |