Browse Source

KERNEL-19047 设计器远程设计适配数据连接配置读写分离

mss/2.0
Destiny.Lin 4 months ago
parent
commit
4832989d75
  1. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  2. 5
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  3. 17
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java
  4. 5
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,6 +1,7 @@
package com.fr.design.data.datapane.connect;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.ConnectionConfigWriterFactory;
import com.fr.config.remote.RemoteConfigEvent;
import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection;
@ -352,11 +353,11 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) {
final int remaining = ConnectionConfigProviderFactory.getConfigProvider().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size());
try {
removedConnNames.forEach(n -> ConnectionConfigProviderFactory.getConfigProvider().removeConnection(n));
removedConnNames.forEach(n -> ConnectionConfigWriterFactory.getConfigWriter().removeConnection(n));
int innerRemaining = remaining;
for (ConnectionBean cb : addedOrUpdatedConnections) {
if (innerRemaining > 0) {
ConnectionConfigProviderFactory.getConfigProvider().addConnectionWithoutCheck(cb.getName(), cb.getConnection());
ConnectionConfigWriterFactory.getConfigWriter().addConnectionWithoutCheck(cb.getName(), cb.getConnection());
innerRemaining--;
} else {
break;

5
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -45,6 +45,11 @@ import com.fr.config.dao.impl.remote.RemoteXmlEntityDao;
import com.fr.config.impl.ConfConfigProviderImpl;
import com.fr.config.impl.ConfigInsecurityElementProviderImpl;
import com.fr.decision.service.context.ServiceContext;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionPluginProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDYConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor;
import com.fr.design.backup.EnvBackupHelper;
import com.fr.env.detect.EnvDetectorCenter;
import com.fr.event.EventDispatcher;

17
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java vendored

@ -1,11 +1,21 @@
package com.fanruan.boot.env.function;
import com.fanruan.boot.DatasourceComponent;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.ConnectionConfigWriter;
import com.fanruan.config.impl.data.ConnectionConfigWriterFactory;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionPluginProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDYConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor;
import com.fr.workspace.server.repository.connection.ConnectionWriterShell;
/**
@ -25,6 +35,11 @@ public class DesignDatasourceComponent extends DatasourceComponent {
@Supplemental
public void prepare() {
super.prepare();
// 注册数据连接处理器
ConnectionProcessorFactory.register(JDBCConnectionProcessor.KEY);
ConnectionProcessorFactory.register(JNDIConnectionProcessor.KEY);
ConnectionProcessorFactory.register(ConnectionPluginProcessor.KEY);
ConnectionProcessorFactory.register(JDYConnectionProcessor.KEY);
}
/**
@ -33,6 +48,8 @@ public class DesignDatasourceComponent extends DatasourceComponent {
@Start
public void start() {
super.start();
ConnectionConfigWriterFactory.registerConnectionConfigWriter((ConnectionConfigWriter) ConnectionConfigProviderFactory.getConfigProvider());
Carina.getApplicationContext().singleton(ConnectionWriterShell.class).set(ConnectionConfigWriterFactory.getConfigWriter());
}
/**

5
designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

@ -23,7 +23,6 @@ import com.fr.env.operator.CommonOperatorImpl;
import com.fr.esd.core.remote.ESDConfigEventOperator;
import com.fr.esd.core.remote.ESDConfigEventOperatorImpl;
import com.fr.file.ConnectionOperator;
import com.fr.file.ConnectionOperatorImpl;
import com.fr.file.TableDataOperator;
import com.fr.file.TableDataOperatorImpl;
import com.fr.file.filetree.FileNodes;
@ -48,6 +47,7 @@ import com.fr.workspace.pool.WorkRPCRegister;
import com.fr.workspace.pool.WorkRPCType;
import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fanruan.workplace.network.RemoteNetworkRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
@ -145,10 +145,9 @@ public class DesignWorkContextComponent {
WorkRPCRegister.wrap(DataOperatorProvider.class, new DataOperator()),
WorkRPCRegister.wrap(ESDConfigEventOperator.class, new ESDConfigEventOperatorImpl()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, TableDataOperator.class, TableDataOperatorImpl.getInstance()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, ConnectionOperator.class, ConnectionOperatorImpl.getInstance()),
WorkRPCRegister.wrap(FileAssistUtilsOperator.class, new FileAssistUtils()),
WorkRPCRegister.wrap(TableDataOperator.class, TableDataOperatorImpl.getInstance()),
WorkRPCRegister.wrap(ConnectionOperator.class, ConnectionOperatorImpl.getInstance()),
WorkRPCRegister.wrap(ConnectionOperator.class, CompatibleConnectionOperator.getInstance()),
WorkRPCRegister.wrap(BuildInfoOperator.class, new BuildInfoOperatorImpl())
);
}

Loading…
Cancel
Save