/** * 解析数据库连接信息 * * @param prop * @return */ private ConnectionInfo parseConnectionInfo(Properties prop) { String driver = PropertiesUtil.getProperties(prop, DRIVER, null, false); String url = PropertiesUtil.getProperties(prop, DBURL, null, false); String user = PropertiesUtil.getProperties(prop, DBUSER, null, false); String pwd = PropertiesUtil.getProperties(prop, DBPWD, null, false); return new ConnectionInfo(driver, url, user, pwd); }
/** * 解析连接池信息 * * @param prop * @return */ private DbPoolInfo parseDbPoolInfo(Properties prop) { String datasource = PropertiesUtil.getProperties(prop, POOL_DATASOURCE, null, false); Map<String, String> map = new HashMap<String, String>(); Iterator<Entry<Object, Object>> it = prop.entrySet().iterator(); while (it.hasNext()) { Entry<Object, Object> entry = it.next(); String key = (String) entry.getKey(); if (key.startsWith(POOL_HEADER)) { key = key.substring(POOL_HEADER.length()); String value = (String) entry.getValue(); map.put(key, value); } } return new DbPoolInfo(datasource, map); }