?? datasrcutil.java.svn-base
字號:
package com.nsi.persistence;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.nsi.control.exceptions.NsiEventException;
import com.nsi.util.settings.SystemSettings;
public final class DataSrcUtil
{
private static Log log = LogFactory.getLog(DataSrcUtil.class);
/**
* private constructor of DataSrcUtil, prevent instantiation
*/
private DataSrcUtil()
{
}
private static class DataSrcUtilHolder
{
static final DataSrcUtil dataSrcUtil = new DataSrcUtil();
}
/**
* @return an instance of DataSrcUtil
*/
public static DataSrcUtil getInstance()
{
return DataSrcUtilHolder.dataSrcUtil;
}
public IsqlDataSource getDataSource() throws NsiEventException
{
String datasourceclassname = SystemSettings.getInstance().getDBDataSourceClassName();
IsqlDataSource drc = null;
try
{
drc = (IsqlDataSource)getClass().getClassLoader().loadClass( datasourceclassname ).newInstance();
}
catch (ClassNotFoundException cnfex)
{
log.error("getDataSource() -- caught ClassNotFoundException: ", cnfex);
throw new NsiEventException( "getDataSource() -- caught ClassNotFoundException: ", cnfex );
}
catch( InstantiationException initex)
{
log.error("getDataSource() -- caught InstantiationException: ", initex);
throw new NsiEventException( "getDataSource() -- caught InstantiationException: ", initex );
}
catch( IllegalAccessException illegex)
{
log.error("getDataSource() -- caught IllegalAccessException: ", illegex);
throw new NsiEventException( "getDataSource() -- caught IllegalAccessException: ", illegex );
}
catch( Exception ex)
{
log.error("getDataSource() -- caught Exception: ", ex);
throw new NsiEventException( "getDataSource() -- caught Exception: ", ex );
}
catch( Throwable trex)
{
log.error("getDataSource() -- caught Throwable: ", trex);
throw new NsiEventException( "getDataSource() -- caught Throwable: ", trex );
}
return drc;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -