+ filePath);
try {
XMLReader reader = BeanXMLUtil.getBeanXMLReader(configFile);
reader.setBeanName("dataSource");
reader.setClass("dataSource", DBInfoConfigBean.class);
DBInfoConfigBean dcb = reader.readOne();
if (dcb == null) {
error = rebuildXmlFile(configFile,
ConfigInfoCons.REPAIR_FILE_INFO);
} else {
String error1 = CheckConfigBean.checkORMDBInfo(dcb,
filePath);
if (error1 == null) {
DBInfoConfigBeanCache.add(dcb.getDsName(), dcb);
DataSource ds = DataSourceCreator.create(dcb);
DataSourceWrap dsw = new DataSourceWrap(
dcb.getDsName(), ds);
String error2 = dsw.getConnection() == null ? ConfigInfoCons.CANNOT_GET_DB_CON
: null;
if (error2 != null)
if (error == null)
error = error2;
else
error += error2;
else {
String info = dcb.getDsName()
+ ConfigInfoCons.READ_CONFIG_INFO_SUCCESS;
LogFactory.getORMLogger("INFO").write(info);
// ------log-------
// 将数据源放入缓存,它可是个重量级对象
// 此步也是为了共存多个数据源
DataSourceWrapCache.put(dcb.getDsName(), dsw);
}
} else if (error == null)
error = error1;
else
error += error1;