📄 sunglobal.java
字号:
/*
* 创建日期 2005-5-5
*/
package com.suninformation.tools;
import java.util.*;
import java.io.*;
/**
* @author 刘镇
*/
public class SunGlobal {
private static String appHome = null;
private static String dbClassForName = null;
private static String dbServer = null;
private static String dbUser = null;
private static String dbPwd = null;
private static String version = null;
private static String helpHome = null;
public static String getPersonValue(String valueName)
throws UnloadPropertiesException {
String values = null;
if (values == null) {
values = new InitPropLoader().getValue(valueName);
}
return values;
}
public static String getHelpHome() throws UnloadPropertiesException {
if (helpHome == null) {
helpHome = new InitPropLoader().getValue("helpHome");
if (helpHome == null) {
helpHome = System.getProperty("helpHome");
}
}
return helpHome;
}
public static String getVersion() throws UnloadPropertiesException {
if (version == null) {
version = new InitPropLoader().getValue("version");
if (version == null) {
version = System.getProperty("version");
}
}
return version;
}
public static String getAppHome() throws UnloadPropertiesException {
if (appHome == null) {
appHome = new InitPropLoader().getValue("appHome");
if (appHome == null) {
appHome = System.getProperty("userHome");
}
}
return appHome;
}
public static String getDbClassForName() throws UnloadPropertiesException {
if (dbClassForName == null) {
dbClassForName = new InitPropLoader().getValue("dbClassForName");
if (dbClassForName == null) {
dbClassForName = System.getProperty("dbClassForName");
}
}
return dbClassForName;
}
public static String getDbServer() throws UnloadPropertiesException {
if (dbServer == null) {
dbServer = new InitPropLoader().getValue("dbServer");
if (dbServer == null) {
dbServer = System.getProperty("dbServer");
}
}
return dbServer;
}
public static String getDbUser() throws UnloadPropertiesException {
if (dbUser == null) {
dbUser = new InitPropLoader().getValue("dbUser");
if (dbUser == null) {
dbUser = System.getProperty("dbUser");
}
}
return dbUser;
}
public static String getDbPwd() throws UnloadPropertiesException {
if (dbPwd == null) {
dbPwd = new InitPropLoader().getValue("dbPwd");
if (dbPwd == null) {
dbPwd = System.getProperty("dbPwd");
}
}
return dbPwd;
}
}
class InitPropLoader {
public String getValue(String valueName) throws UnloadPropertiesException {
String m_Var = null;
Properties initProps = new Properties();
InputStream in = null;
try {
in = getClass().getResourceAsStream("/suninfo_init.properties");
initProps.load(in);
} catch (Exception e) {
throw new UnloadPropertiesException("无法读取系统属性文件。", e);
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception e) {
}
}
if (initProps != null) {
m_Var = initProps.getProperty(valueName);
if (m_Var != null) {
m_Var = m_Var.trim();
}
}
return m_Var;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -