Browse Source

添加 'src/main/java/com/fr/plugin/dynamic/dbconnect/extension/AbstractFetchDynamicDbConnect.java'

master
gongbin 2 years ago
parent
commit
51d9be576b
  1. 43
      src/main/java/com/fr/plugin/dynamic/dbconnect/extension/AbstractFetchDynamicDbConnect.java

43
src/main/java/com/fr/plugin/dynamic/dbconnect/extension/AbstractFetchDynamicDbConnect.java

@ -0,0 +1,43 @@
package com.fr.plugin.dynamic.dbconnect.extension;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.dynamic.dbconnect.bean.DynamicDbConnectBean;
import com.fr.plugin.dynamic.dbconnect.conf.DynamicDbConnectConfig;
import com.fr.stable.fun.mark.API;
import java.util.HashMap;
@API(
level = 1
)
public class AbstractFetchDynamicDbConnect implements FetchDynamicDbConnect{
public String mark4Provider() {
return this.getClass().getName();
}
public int currentAPILevel() {
return 1;
}
@Override
public String getConnectName(HashMap<String, String> params) {
String role = params.get("role");;
String viewlet = params.get("viewlet");
String fineUserName = params.get("fine_username").toString();
String fineRole = params.get("fine_role").toString();
FineLoggerFactory.getLogger().info("DynamicDbConnectDSModifyProvider fineUserName="+fineUserName+",fineRole="+fineRole+",viewlet="+viewlet+",role="+role);
String oldConfig = DynamicDbConnectConfig.getInstance().oldConfig;
String newConfig = DynamicDbConnectConfig.getInstance().getConnectConfig();
if(oldConfig.equals(newConfig) == false){
DynamicDbConnectConfig.getInstance().parseConfig();
DynamicDbConnectConfig.getInstance().oldConfig = newConfig;
}
DynamicDbConnectBean connectBean = DynamicDbConnectConfig.getInstance().getDbConnectBean(viewlet,role);
if(connectBean != null){
return connectBean.getConnectName();
}
return null;
}
}
Loading…
Cancel
Save