gongbin
2 years ago
1 changed files with 43 additions and 0 deletions
@ -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…
Reference in new issue