mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -493,6 +493,10 @@ public abstract class DruidAbstractDataSource extends WrapperAdapter implements
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
public void addConnectionProperty(String name, String value) {
|
||||
if (inited) {
|
||||
|
||||
@@ -291,8 +291,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
}
|
||||
}
|
||||
|
||||
this.dbType = JdbcUtils.getDbType(jdbcUrl, driverClass.getClass().getName());
|
||||
|
||||
if (this.dbType == null || this.dbType.length() == 0) {
|
||||
this.dbType = JdbcUtils.getDbType(jdbcUrl, driverClass.getClass().getName());
|
||||
}
|
||||
|
||||
if ("oracle".equals(this.dbType)) {
|
||||
isOracle = true;
|
||||
|
||||
|
||||
@@ -40,30 +40,28 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean {
|
||||
public void init(DataSourceProxy dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
|
||||
String dbType = this.dbType;
|
||||
|
||||
if (this.dbType == null || this.dbType.trim().length() == 0) {
|
||||
this.dbType = dataSource.getDbType();
|
||||
}
|
||||
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
provider = new MySqlWallProvider(config);
|
||||
|
||||
if (config == null) {
|
||||
config = new WallConfig(MySqlWallProvider.DEFAULT_CONFIG_DIR);
|
||||
}
|
||||
|
||||
provider = new MySqlWallProvider(config);
|
||||
} else if (JdbcUtils.ORACLE.equals(dbType)) {
|
||||
provider = new OracleWallProvider(config);
|
||||
|
||||
if (config == null) {
|
||||
config = new WallConfig(OracleWallProvider.DEFAULT_CONFIG_DIR);
|
||||
}
|
||||
|
||||
provider = new OracleWallProvider(config);
|
||||
} else if (JdbcUtils.SQL_SERVER.equals(dbType)) {
|
||||
provider = new SQLServerProvider(config);
|
||||
|
||||
if (config == null) {
|
||||
config = new WallConfig(SQLServerProvider.DEFAULT_CONFIG_DIR);
|
||||
}
|
||||
|
||||
provider = new SQLServerProvider(config);
|
||||
} else {
|
||||
throw new IllegalStateException("dbType not support : " + dbType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user