cmptcpconfiguration.java

来自「一个免费的CA,基于EJB平台的,老师叫我们测试,现把之共享出来让大家参考」· Java 代码 · 共 100 行

JAVA
100
字号
/************************************************************************* *                                                                       * *  EJBCA: The OpenSource Certificate Authority                          * *                                                                       * *  This software is free software; you can redistribute it and/or       * *  modify it under the terms of the GNU Lesser General Public           * *  License as published by the Free Software Foundation; either         * *  version 2.1 of the License, or any later version.                    * *                                                                       * *  See terms of license at gnu.org.                                     * *                                                                       * *************************************************************************/package org.ejbca.ui.tcp;/************************************************************************* *                                                                       * *                                                                       * *  This software is free software; you can redistribute it and/or       * *  modify it under the terms of the GNU Lesser General Public           * *  License as published by the Free Software Foundation; either         * *  version 2.1 of the License, or any later version.                    * *                                                                       * *  See terms of license at gnu.org.                                     * *                                                                       * *************************************************************************/ import java.util.Properties;import org.apache.commons.lang.StringUtils;/** * A singleton holding configuration information about the CMP TCP service *  * @author tomas * @version $Id: CmpTcpConfiguration.java,v 1.2 2007/01/16 11:44:29 anatom Exp $ */public class CmpTcpConfiguration {	/** Singleton instance */	private static CmpTcpConfiguration config = null;		/** Variable holding the properties configuration */	private Properties prop = null;		private static final int DEFAULT_PORT = 829;	private static final String DEFAULT_BIND_HOST="0.0.0.0";	private static final String DEFAULT_LOG_DIR="./log";	private static final String DEFAULT_CONF_FILE="";		private CmpTcpConfiguration() {	}		public static CmpTcpConfiguration instance() {		if (config == null) {			config = new CmpTcpConfiguration();		}		return config;	}		public void init(Properties prop) {		this.prop = prop;	}		public int getPort() {		int ret = DEFAULT_PORT;		String str = prop.getProperty("portNo");		if (StringUtils.isNotEmpty(str)) {			ret = new Integer(str).intValue();		}		return ret;	}	public String getLogDir() {		String ret = DEFAULT_LOG_DIR;		String str = prop.getProperty("logDir");		if (StringUtils.isNotEmpty(str)) {			ret = str;		}		return ret;			}	public String getConfFile() {		String ret = DEFAULT_CONF_FILE;		String str = prop.getProperty("confFile");		if (StringUtils.isNotEmpty(str)) {			ret = str;		}		return ret;			}	public String getBindHost() {		String ret = DEFAULT_BIND_HOST;		String str = prop.getProperty("bindHost");		if (StringUtils.isNotEmpty(str)) {			ret = str;		}		return ret;	}	public Properties getProperties() {		return prop;	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?