diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java index 4b91320829..8dc3e2f2d2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java @@ -1,7 +1,10 @@ package com.fr.design.data.datapane.connect; import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; +import com.fanruan.datasource.driver.bean.DriverLoaderBean; import com.fr.data.driver.DriverClassNotFoundException; +import com.fr.data.driver.DriverLoader; +import com.fr.data.driver.config.DriverLoaderConfig; import com.fr.data.impl.Connection; import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean; import com.fr.decision.webservice.exception.general.DriverNotFoundException; @@ -9,13 +12,15 @@ import com.fr.decision.webservice.v10.datasource.connection.processor.impl.Conne import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper; import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; -import com.fr.security.encryption.transmission.TransmissionEncryptionManager; import com.fr.workspace.engine.exception.DriverUnExistException; import com.fr.workspace.server.repository.connection.BaseConnectionSource; + import java.sql.SQLException; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 本地Connection资源操作 @@ -98,6 +103,26 @@ public class LocalConnectionSource extends BaseConnectionSource { } + + @Override + public Map getDriverLoaders() throws Exception { + return DriverLoaderConfig.getInstance().getDriverLoaders().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, entry -> convertDriverLoader(entry.getValue()), (a, b) -> a, LinkedHashMap::new)); + } + + private DriverLoaderBean convertDriverLoader(DriverLoader driverLoader) { + if (driverLoader == null) { + return null; + } + DriverLoaderBean driverLoaderBean = new DriverLoaderBean(); + driverLoaderBean.setName(driverLoader.getName()); + driverLoaderBean.setDriverClass(driverLoader.getDriverClass()); + driverLoaderBean.setDriverList(driverLoader.getDriverList()); + driverLoaderBean.setDriverJarFiles(driverLoader.getDriverJarFiles()); + driverLoaderBean.setLoadingStrategy(driverLoader.getLoadingStrategy()); + return driverLoaderBean; + } + @Override public boolean lock(String str) { // 本地默认锁定成功,让其执行后续动作