📄 systemconfig.java
字号:
/**
* SystemConfig.java 07/01/2002,
* Author:
*
* Copyright (c) 2002 Censoft Corp.
* Beijing China
* All rights reserved.
*
* Modifier:
* Time:
***/
package com.gs.util;
import java.io.*;
import java.util.*;
public class SystemConfig {
private static Properties systemConfig = null;
private static String propertyFile = "gs.properties";
private static String header = null;
private static void readSystemConfig() {
if (systemConfig != null) {
return;
}
try {
InputStream is = Class.forName(
"com.gs.util.SystemConfig").getClassLoader().
getResourceAsStream(propertyFile);
if (is != null) {
systemConfig = new Properties();
systemConfig.load(is);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
/**
* Get property value.
* @param name property name.
* @return the value.
*/
public static String getProperty(String name) {
String retVal = "";
if (systemConfig == null) {
readSystemConfig();
}
if (systemConfig != null) {
retVal = systemConfig.getProperty(name);
}
else {
//edit usercbg 无法读配置文件时
Debug.print(
"[SystemConfig]getProperty------>>>systemConfig is null");
//封面 制
if ("textTitle01".equals(name)) {
retVal = "中华人民共和国<br>国家工商行政管理总局制";
}else
//登记机关名称 用于简称打印
if ("areaAbbreviate".equals(name)) {
retVal = "鲁";
}else
//应用于直接连接数据库 with CLOB问题
if ("databaseConnectionUrl".equals(name)) {
retVal = "jdbc:oracle:thin:@192.168.0.10:1521:YU";
}else
//应用于直接连接数据库 with CLOB问题
if ("databaseConnectionUser".equals(name)) {
retVal = "GS";
}else
//应用于直接连接数据库 with CLOB问题
if ("databaseConnectionUserPassword".equals(name)) {
retVal = "111111";
}else
//操作系统 windows / unix / lunix
if ("operatingSystem".equals(name)) {
retVal = "unix";
}else
//发布程序war文件目录位置 windows / unix / lunix
if ("operatingSystemFileLocation".equals(name)) {
retVal = "weblogic/bea/bea/weblogic81/domains/Productdomains";
}
Debug.print(
"[SystemConfig]getProperty------>>>systemConfig retVal set:" +
retVal);
//edit usercbg end 2003.12.14
}
retVal = retVal == null ? null : retVal.trim();
//return PubFunc.decodeGB(retVal,"ISO8859-1");
return PubFunc.decodeGB(retVal, "GBK");
}
/**
* Set property value.
* @param name property name.
* @return the value.
*/
public static void setProperty(String name, String value) {
try {
if (systemConfig == null) {
readSystemConfig();
}
systemConfig.setProperty(name, value);
FileOutputStream out = new FileOutputStream(propertyFile);
systemConfig.store(out, header);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String arg[]) {
String s = SystemConfig.getProperty("user");
Debug.println(s);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -