Browse Source
Merge in DESIGN/design from mss/2.0 to fbp-1.0 * commit 'bc0fd2632ce5fcde2215e611a24984bbb9067b16': REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 补充数据集的bean的属性 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 完善数据集与数据连接 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 预留token接口+完善报错 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 完善部分代码+屏蔽frm入口 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 适配数据连接+地图配置 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 KERNEL-18926 修改包名fbp-1.0
19 changed files with 215 additions and 98 deletions
@ -0,0 +1,67 @@ |
|||||||
|
package com.fr.design.data.datapane.connect; |
||||||
|
|
||||||
|
import com.fr.data.driver.DriverClassNotFoundException; |
||||||
|
import com.fr.data.impl.Connection; |
||||||
|
import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean; |
||||||
|
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.workspace.server.repository.connection.BaseConnectionSource; |
||||||
|
import java.sql.SQLException; |
||||||
|
|
||||||
|
/** |
||||||
|
* 本地Connection资源操作 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/5/29 |
||||||
|
*/ |
||||||
|
public class LocalConnectionSource extends BaseConnectionSource { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void add(ConnectionInfoBean bean) throws Exception { |
||||||
|
Connection connection = ConnectionProcessorFactory.createConnection(bean); |
||||||
|
validate(bean.getConnectionName(), connection); |
||||||
|
ConnectionProcessorFactory.addConnection(bean); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void delete(ConnectionInfoBean bean) throws Exception { |
||||||
|
ConnectionProcessorFactory.deleteConnection(bean.getConnectionName()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(ConnectionInfoBean bean) throws Exception { |
||||||
|
Connection connection = ConnectionProcessorFactory.createConnection(bean); |
||||||
|
validate(bean.getConnectionName(), connection); |
||||||
|
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean lock(String str) { |
||||||
|
// 本地默认锁定成功,让其执行后续动作
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean unlock(String str) { |
||||||
|
// 本地默认解锁成功
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean isLock(String str) { |
||||||
|
// 本地默认未锁定
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
private void validate(String name, Connection connection) throws SQLException { |
||||||
|
try { |
||||||
|
connection.validateSettings(); |
||||||
|
} catch (DriverClassNotFoundException e) { |
||||||
|
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||||
|
} catch (Exception e) { |
||||||
|
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", name) + ", " + e.getMessage(), e.getCause()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue