configinfo.java
来自「该工程文件在Eclipse3.2+MyEclipse 5.0下调试成功我使用的是」· Java 代码 · 共 69 行
JAVA
69 行
package com.tocow.utilities;
import java.util.Properties;
import org.xmlmiddleware.xmldbms.tools.XMLDBMSProps;
public class ConfigInfo {
private String fileSeparator = "";
private String currentWorkingDir = "";
private final String dataSourceClass = "org.xmlmiddleware.db.JDBC1DataSource";
private final String dataHandlerClass = "org.xmlmiddleware.xmldbms.datahandlers.GenericHandler";
private final String parserutilsClass = "org.xmlmiddleware.xmlutils.external.ParserUtilsXerces";
private static ConfigInfo ci = null;
private ConfigInfo(){
fileSeparator = "/";
String sTemp = System.getProperty("dbConfig");
sTemp = sTemp.substring(0,sTemp.lastIndexOf("/")); // 定位到WEB-INF目录
sTemp = sTemp.substring(0,sTemp.lastIndexOf("/")+1); // 定位到web目录
currentWorkingDir = sTemp;
}
public static ConfigInfo getInstance(){
if(ci == null){
ci = new ConfigInfo();
}
return ci;
}
public String getCurrentWorkingDir() {
return currentWorkingDir;
}
public String getFileSeparator() {
return fileSeparator;
}
/**
*
* @return web文件夹的路径,即WEB-INF的上一级目录
*/
public String getStandardPath(){
return currentWorkingDir;
}
public Properties getXMLDBMSParameters(){
String driver = System.getProperty("driver");
String url = System.getProperty("url");
String user = System.getProperty("username");
String password = System.getProperty("password");
Properties prop = new Properties();
prop.setProperty(XMLDBMSProps.DRIVER, driver);
prop.setProperty(XMLDBMSProps.URL, url);
prop.setProperty(XMLDBMSProps.USER, user);
prop.setProperty(XMLDBMSProps.PASSWORD, password);
prop.setProperty(XMLDBMSProps.DATASOURCECLASS, dataSourceClass);
prop.setProperty(XMLDBMSProps.DATAHANDLERCLASS, dataHandlerClass);
prop.setProperty(XMLDBMSProps.PARSERUTILSCLASS, parserutilsClass);
return prop;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?