From 51d9be576b2c2ce03a65073d4841e11233f38ee2 Mon Sep 17 00:00:00 2001 From: gongbin <47426305@qq.com> Date: Mon, 1 Aug 2022 22:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'src/main/java/com/fr/plug?= =?UTF-8?q?in/dynamic/dbconnect/extension/AbstractFetchDynamicDbConnect.ja?= =?UTF-8?q?va'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractFetchDynamicDbConnect.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/main/java/com/fr/plugin/dynamic/dbconnect/extension/AbstractFetchDynamicDbConnect.java diff --git a/src/main/java/com/fr/plugin/dynamic/dbconnect/extension/AbstractFetchDynamicDbConnect.java b/src/main/java/com/fr/plugin/dynamic/dbconnect/extension/AbstractFetchDynamicDbConnect.java new file mode 100644 index 0000000..4aa33b0 --- /dev/null +++ b/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 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; + } +}