org.zodiac.datasource.config.DataSourceConfigInfo Maven / Gradle / Ivy
The newest version!
package org.zodiac.datasource.config;
import java.util.Map;
import org.zodiac.commons.constants.Constants;
import org.zodiac.datasource.jdbc.config.DataSourceRuleInfo;
import org.zodiac.datasource.jdbc.config.beecp.BeeCPMultipleDataSourceInfo;
import org.zodiac.datasource.jdbc.config.dbcp2.Dbcp2MultipleDataSourceInfo;
import org.zodiac.datasource.jdbc.config.druid.DruidMultipleDataSourceInfo;
import org.zodiac.datasource.jdbc.config.hikari.HikariCPMultipleDataSourceInfo;
import org.zodiac.datasource.strategy.ExpressionStrategy;
import org.zodiac.sdk.toolkit.util.collection.CollUtil;
public class DataSourceConfigInfo extends AbstractDataSourceConfigInfo {
/*主数据源*/
private String primary = Constants.Zodiac.DEFAULT_DATASOURCE_PRIMARY;
/*是否自动设置*/
private boolean autoSetPrimary = Constants.Zodiac.DEFAULT_DATASOURCE_CONFIG_AUT_SET_PRIMARY;
private boolean dynamicEnabled = Constants.Zodiac.DEFAULT_DATASOURCE_CONFIG_DYNAMIC_ENABLED;
private String dynamicDefault = primary;
private boolean routingEnabled = true;
private boolean transactionEnabled = true;
private boolean transactionManagerEnabled = true;
private boolean overrideInitializerEnabled = true;
// /*Druid数据源进行KeepAlive是否使用ping,默认关闭,在代理情况可能会出现连接断开的情况。*/
// private boolean druidKeepAliveUsePing = false;
//
// /**
// * 数据源连接池,可配置多个数据源
// */
// private Map druidPool = new HashMap<>();
private boolean jdbcRulesEnabled = true;
/**
* 数据源规则配置,可以配置多规则
*/
private Map jdbcRules = CollUtil.map();
private Map dynamicStrategies = CollUtil.map();
private final BeeCPMultipleDataSourceInfo bee = new BeeCPMultipleDataSourceInfo();
private final Dbcp2MultipleDataSourceInfo dbcp2 = new Dbcp2MultipleDataSourceInfo();
private final DruidMultipleDataSourceInfo druid = new DruidMultipleDataSourceInfo();
private final HikariCPMultipleDataSourceInfo hikari = new HikariCPMultipleDataSourceInfo();
public DataSourceConfigInfo() {
super();
}
// public Map getDruidPool() {
// return druidPool;
// }
//
// public void setDruidPool(Map druidPool) {
// this.druidPool = druidPool;
// }
public String getPrimary() {
return primary;
}
public void setPrimary(String primary) {
this.primary = primary;
}
public boolean isAutoSetPrimary() {
return autoSetPrimary;
}
public void setAutoSetPrimary(boolean autoSetPrimary) {
this.autoSetPrimary = autoSetPrimary;
}
public boolean isDynamicEnabled() {
return dynamicEnabled;
}
public void setDynamicEnabled(boolean dynamicEnabled) {
this.dynamicEnabled = dynamicEnabled;
}
public String getDynamicDefault() {
return dynamicDefault;
}
public void setDynamicDefault(String dynamicDefault) {
this.dynamicDefault = dynamicDefault;
}
public boolean isRoutingEnabled() {
return routingEnabled;
}
public void setRoutingEnabled(boolean routingEnabled) {
this.routingEnabled = routingEnabled;
}
public boolean isTransactionEnabled() {
return transactionEnabled;
}
public void setTransactionEnabled(boolean transactionEnabled) {
this.transactionEnabled = transactionEnabled;
}
public boolean isTransactionManagerEnabled() {
return transactionManagerEnabled;
}
public void setTransactionManagerEnabled(boolean transactionManagerEnabled) {
this.transactionManagerEnabled = transactionManagerEnabled;
}
public boolean isOverrideInitializerEnabled() {
return overrideInitializerEnabled;
}
public void setOverrideInitializerEnabled(boolean overrideInitializerEnabled) {
this.overrideInitializerEnabled = overrideInitializerEnabled;
}
public boolean isJdbcRulesEnabled() {
return jdbcRulesEnabled;
}
public void setJdbcRulesEnabled(boolean rulesEnabled) {
this.jdbcRulesEnabled = rulesEnabled;
}
public Map getJdbcRules() {
return jdbcRules;
}
public void setJdbcRules(Map jdbcRules) {
this.jdbcRules = jdbcRules;
}
public Map getDynamicStrategies() {
return dynamicStrategies;
}
public void setDynamicStrategies(Map dynamicStrategies) {
this.dynamicStrategies = dynamicStrategies;
}
public BeeCPMultipleDataSourceInfo getBee() {
return bee;
}
public Dbcp2MultipleDataSourceInfo getDbcp2() {
return dbcp2;
}
public DruidMultipleDataSourceInfo getDruid() {
return druid;
}
public HikariCPMultipleDataSourceInfo getHikari() {
return hikari;
}
}