From faf2af7a215d100ed6374ceb2828be13cf221515 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 10 Jul 2024 17:51:58 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-126694=20=E9=A2=84=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/server/FunctionManagerAction.java | 3 +-- .../com/fr/design/actions/server/ProcedureListAction.java | 4 +--- .../main/java/com/fr/design/module/ChartPreStyleListPane.java | 2 +- .../fr/design/actions/server/ServerConfigManagerAction.java | 3 +-- .../java/com/fr/design/actions/server/StyleListAction.java | 3 +-- .../com/fr/design/actions/server/WidgetManagerAction.java | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java index d7f1cdbb7a..c31ff61525 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java @@ -59,8 +59,7 @@ public class FunctionManagerAction extends UpdateAction { } }); - FunctionConfig mirror = functionManager.mirror(); - functionManagerPane.populate(mirror); + functionManagerPane.populate(functionManager); functionManagerDialog.setVisible(true); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java index 9989182d48..905e84e253 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java @@ -36,9 +36,7 @@ public class ProcedureListAction extends UpdateAction { final ProcedureConfig procedureConfig = ProcedureConfig.getInstance(); final ProcedureManagerPane databaseManagerPane = new ProcedureManagerPane() { public void complete() { - - ProcedureConfig mirror = procedureConfig.mirror(); - populate(mirror); + populate(procedureConfig); } }; BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java index 99d048a811..06b3eb5028 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java @@ -111,7 +111,7 @@ public class ChartPreStyleListPane extends JListControlPane { } public void populateBean() { - ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror(); + ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); ArrayList list = new ArrayList(); Iterator keys = config.names(); diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java index 26eb81cbc4..8d1ebec6c6 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java @@ -49,8 +49,7 @@ public class ServerConfigManagerAction extends UpdateAction { @Override public void complete() { - ServerPreferenceConfig mirror = config.mirror(); - populate(mirror); + populate(config); } }; diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java index cc5f7a1b55..727e18341e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java @@ -61,8 +61,7 @@ public class StyleListAction extends UpdateAction { } }); - ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); - styleListPane.populate(mirror); + styleListPane.populate(ServerPreferenceConfig.getInstance()); styleListDialog.setVisible(true); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java index d04dc76975..c7a3bc7e13 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java @@ -39,8 +39,7 @@ public class WidgetManagerAction extends UpdateAction { final WidgetManagerPane widgetManagerPane = new WidgetManagerPane() { @Override public void complete() { - WidgetInfoConfig mirror = widgetManager.mirror(); - populate(mirror); + populate(widgetManager); } }; From 541aec5bb31589a7ba114dd1f55bcb1ccb46d1bc Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 11 Jul 2024 14:04:34 +0800 Subject: [PATCH 2/6] =?UTF-8?q?REPORT-126687=20fbp=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E2=80=94=E2=80=94=E5=8D=95=E5=85=83=E6=A0=BC=E5=BD=A2?= =?UTF-8?q?=E6=80=81-=E6=9D=A1=E5=BD=A2=E7=A0=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/present/BarCodePane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java b/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java index b0df938db0..15a895a201 100644 --- a/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java +++ b/designer-realize/src/main/java/com/fr/design/present/BarCodePane.java @@ -1,5 +1,6 @@ package com.fr.design.present; +import com.fr.barcode.core.Barcode; import com.fr.code.bar.core.BarcodeAttr; import com.fr.code.BarcodeImpl; import com.fr.code.bar.core.BarCodeUtils; @@ -326,8 +327,8 @@ public class BarCodePane extends FurtherBasicBeanPane { if (obj == null) { return; } - if (obj instanceof BarcodeImpl) { - BarcodeImpl barcodeImpl = (BarcodeImpl) obj; + if (obj instanceof Barcode) { + Barcode barcodeImpl = (Barcode) obj; Dimension size = this.getSize(); barcodeImpl.draw((Graphics2D) g, (int) (size.getWidth() - barcodeImpl.getWidth()) / 2, (int) (size.getHeight() - barcodeImpl.getHeight()) / 2); } else { From 7c9cf9a022dbee587f9627a54dad0e9c66410050 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 11 Jul 2024 16:55:24 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-126723=20=E6=96=B0=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE=E9=9B=86=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E9=87=8D=E5=90=AF=E5=90=8E=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fanruan/boot/ConfigHelper.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java b/designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java index 40aebe54b6..a354a2f6b8 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java +++ b/designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java @@ -7,8 +7,9 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import java.io.BufferedReader; import java.io.File; -import java.io.InputStream; +import java.io.FileReader; import java.util.Properties; /** @@ -92,9 +93,7 @@ public class ConfigHelper { if (!ResourceIOUtils.exist(path)) { ResourceIOUtils.createFile(path); } - try (InputStream is = ResourceIOUtils.read(path)){ - properties.load(is); - } + properties.load(new BufferedReader(new FileReader(path))); } catch (Exception e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); } From 362783181fa7c2614df1ea8a80672461ac6f3f18 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 12 Jul 2024 13:07:34 +0800 Subject: [PATCH 4/6] =?UTF-8?q?REPORT-126685=20fbp=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=80=82=E9=85=8D=E2=80=94=E2=80=94=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=AD=98=E5=82=A8=E4=BD=8D=E7=BD=AE=E7=A0=94?= =?UTF-8?q?=E7=A9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design}/ConfigHelper.java | 78 +++++++----- .../java/com/fr/design/EnvChangeEntrance.java | 9 +- .../com/fr/design/backup}/DesignContext.java | 2 +- .../com/fr/design/backup/EnvBackupHelper.java | 117 ++++++++++++++++++ .../fr/design/mem/MemConfigBackupManager.java | 88 +++++++++++++ .../fr/design}/mem/MemConfigRepository.java | 2 +- .../mem/MemConfigRepositoryBuilder.java | 30 +++++ .../boot/env/DesignEnvChooseComponent.java | 19 ++- .../fanruan/boot/env/DesignEnvComponent.java | 15 +-- .../boot/mem/MemConfigRepositoryBuilder.java | 20 --- .../boot/pre/DesignPreStartComponent.java | 17 +-- .../java/com/fr/start/CarinaDesigner.java | 1 + .../module/DesignerWorkspaceProvider.java | 2 +- 13 files changed, 307 insertions(+), 93 deletions(-) rename {designer-realize/src/main/java/com/fanruan/boot => designer-base/src/main/java/com/fr/design}/ConfigHelper.java (51%) rename {designer-realize/src/main/java/com/fr/start => designer-base/src/main/java/com/fr/design/backup}/DesignContext.java (97%) create mode 100644 designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java create mode 100644 designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java rename {designer-realize/src/main/java/com/fanruan/boot => designer-base/src/main/java/com/fr/design}/mem/MemConfigRepository.java (99%) create mode 100644 designer-base/src/main/java/com/fr/design/mem/MemConfigRepositoryBuilder.java delete mode 100644 designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java diff --git a/designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java b/designer-base/src/main/java/com/fr/design/ConfigHelper.java similarity index 51% rename from designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java rename to designer-base/src/main/java/com/fr/design/ConfigHelper.java index a354a2f6b8..c3f22a8718 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java +++ b/designer-base/src/main/java/com/fr/design/ConfigHelper.java @@ -1,15 +1,21 @@ -package com.fanruan.boot; +package com.fr.design; import com.fanruan.carina.Carina; import com.fanruan.product.ProductConstants; import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.CommonUtils; import com.fr.stable.StringUtils; +import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import com.fr.workspace.resource.ResourceIOException; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; +import java.io.IOException; import java.util.Properties; /** @@ -27,9 +33,9 @@ import java.util.Properties; public class ConfigHelper { public static final String TAIL = ".properties"; public static final String CONFIG = "confighelper"; + public static final String ENV = "envconfig"; public static final String BASE = ProductConstants.getEnvHome() + File.separator + CONFIG + File.separator; public static final String BASE_PATH = BASE + "BaseProperties" + TAIL; - private static String path = StringUtils.EMPTY; @@ -42,46 +48,31 @@ public class ConfigHelper { /** - * 获取当前环境配置 + * 获取对应环境配置 */ - public static Properties getEnvProperties() { - return getProperties(getEnvPropertiesPath(), getBaseProperties()); + public static Properties getEnvProperties(Workspace workspace) { + return getProperties(getEnvPropertiesPath(workspace), getBaseProperties()); } /** - * 获取当前环境配置的路径 - */ - public static String getEnvPropertiesPath() { - return path + TAIL; - } - - /** - * 规范化配置文件的路径,保证配置文件落在缓存文件夹(110)中 + * 获取当前环境配置 */ - public static String normalise(String path) { - if (!path.startsWith(BASE)) { - path = BASE + path.replace("\\", "_").replace("/", "_").replace(":", "_"); - } - return path; + public static Properties getEnvProperties() { + return getProperties(getEnvPropertiesPath(null), getBaseProperties()); } - /** - * 设置config路径 + * 获取对应环境配置的路径 */ - public static void setPath(String path) { - ConfigHelper.path = normalise(path); + public static String getEnvPropertiesPath(Workspace workspace) { + return CommonUtils.pathJoin(workspace == null ? WorkContext.getCurrent().getPath() : workspace.getPath(), ProjectConstants.ASSETS_NAME, CONFIG, ENV) + TAIL; } - /** - * 获取路径 + * 获取当前环境配置的路径 */ - public static String getPath() { - if (StringUtils.isEmpty(path)) { - path = Carina.getApplicationContext().getWebInfPath(); - } - return path; + public static String getEnvPropertiesPath() { + return getEnvPropertiesPath(null); } private static Properties getProperties(String path, Properties defaultValue){ @@ -90,8 +81,9 @@ public class ConfigHelper { properties.putAll(defaultValue); } try { - if (!ResourceIOUtils.exist(path)) { - ResourceIOUtils.createFile(path); + File file = new File(path); + if (!file.exists()) { + createFile(file); } properties.load(new BufferedReader(new FileReader(path))); } catch (Exception e) { @@ -100,4 +92,28 @@ public class ConfigHelper { return properties; } + + private static boolean createFile(File file) throws ResourceIOException { + String parent = file.getParent(); + if (StringUtils.isNotEmpty(parent)) { + createDirectory(parent); + } + try { + return file.createNewFile(); + } catch (IOException e) { + throw new ResourceIOException("[Resource] Failed to create '" + file.getPath() + "'", e); + } + } + + private static boolean createDirectory(String dir) { + File root = new File(dir); + if (root.exists()) { + return false; + } + if (!dir.endsWith(File.separator)) { + dir = dir.concat(File.separator); + } + // 创建目录 + return root.mkdirs() || new File(dir).mkdirs(); + } } diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index d38def2836..bb55c90205 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -1,6 +1,7 @@ package com.fr.design; import com.fr.common.report.ReportState; +import com.fr.design.backup.EnvBackupHelper; import com.fr.design.mainframe.manager.clip.TemplateTreeClipboard; import com.fr.design.plugin.remind.PluginErrorDesignReminder; import com.fr.design.data.DesignTableDataManager; @@ -59,6 +60,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Properties; import java.util.Set; import java.util.HashSet; @@ -109,14 +111,15 @@ public class EnvChangeEntrance { DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); DesignerWorkspaceInfoContext.setWorkspaceInfo(selectedEnv); WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); - + EnvBackupHelper.getInstance().backup(); try { Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); boolean checkValid = workspace != null && selectedEnv.checkValid(); if (!checkValid) { return false; } - + // 更新目标环境 + EnvBackupHelper.getInstance().prepare4switch(workspace); WorkContext.switchTo(workspace, new WorkContextCallback() { @Override public void done() { @@ -127,6 +130,7 @@ public class EnvChangeEntrance { //初始化一下serverTray ServerTray.init(); } + EnvBackupHelper.getInstance().success(); } }); // REPORT-25688如果是war包部署的服务器,给与提示 @@ -142,6 +146,7 @@ public class EnvChangeEntrance { PluginErrorDesignReminder.getInstance().remindStartFailedPlugins(); } catch (Exception exception) { // 失败的处理 + EnvBackupHelper.getInstance().failed(); WorkspaceExceptionHandler.getInstance().handleInSwitch(exception, selectedEnv); return false; } diff --git a/designer-realize/src/main/java/com/fr/start/DesignContext.java b/designer-base/src/main/java/com/fr/design/backup/DesignContext.java similarity index 97% rename from designer-realize/src/main/java/com/fr/start/DesignContext.java rename to designer-base/src/main/java/com/fr/design/backup/DesignContext.java index b4bb41ff58..bdb739b339 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignContext.java +++ b/designer-base/src/main/java/com/fr/design/backup/DesignContext.java @@ -1,4 +1,4 @@ -package com.fr.start; +package com.fr.design.backup; import com.fanruan.carina.context.CarinaApplicationContext; import com.fanruan.carina.standard.PartitionManager; diff --git a/designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java b/designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java new file mode 100644 index 0000000000..6ea52fd764 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java @@ -0,0 +1,117 @@ +package com.fr.design.backup; + +import com.fanruan.carina.Carina; +import com.fanruan.config.realm.ConfigRepositoryFactory; +import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; +import com.fr.design.ConfigHelper; +import com.fr.design.mem.MemConfigBackupManager; +import com.fr.log.FineLoggerFactory; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; + +import java.util.Properties; + +/** + * 切换环境对应的帮助类,主要负责环境切换的备份与环境属性的设置 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/12 + */ +public class EnvBackupHelper { + private static final EnvBackupHelper INSTANCE = new EnvBackupHelper(); + private boolean swtiching = false; + private boolean local = true; + private Properties properties = null; + private String path = null; + private Workspace target; + private Workspace origin; + /** + * 获取单例 + */ + public static EnvBackupHelper getInstance() { + return INSTANCE; + } + + /** + * 备份 + *

切换前需要判断,为什么?——当前的配置框架需要在切换前做好备份,防止切换失败,失败的话要切回备份

+ */ + public void backup() { + FineLoggerFactory.getLogger().info("[EnvBackup] 1.back start..."); + this.swtiching = true; + local = WorkContext.getCurrent().isLocal(); + if (local) { + properties = ConfigHelper.getEnvProperties(); + path = ConfigHelper.getEnvPropertiesPath(); + } + origin = WorkContext.getCurrent(); + } + + /** + * 切换前的准备 + *

设置目标环境

+ *

设置新的工程路径

+ */ + public void prepare4switch(Workspace workspace) { + this.target = workspace; + ((DesignContext) Carina.getApplicationContext()).setDesignWebInfPath(workspace.getPath()); + } + + /** + * 切换 + */ + public void do4Switch4Config() { + FineLoggerFactory.getLogger().info("[EnvBackup] 2.do config switch"); + // 切换环境的时候新配置框架启动前要先reset原来的 + ConfigRepositoryFactory.getInstance().reset(); + if (target.isLocal()) { + //如果目标是本地,就清空然后重新注册新的本地配置 + ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new LocalConfigRepositoryBuilder(ConfigHelper.getEnvProperties(target), ConfigHelper.getEnvPropertiesPath(target))); + } else { + // 如果是切到远程,先暂时用备份的内存配置,成功后再转到新配置,失败则切回原内存配置 + MemConfigBackupManager.getInstance().startSwitch(); + } + } + + /** + * 切换成功后的处理 + */ + public void success() { + FineLoggerFactory.getLogger().info("[EnvBackup] 3.switch all" ); + //切换成功,如果原来是本地,则清空备份,不需要干别的,此时配置走的就是新环境的本地 + if (local) { + properties = null; + path = null; + } else { + // 如果原来是远程,就把内存的新环境配置替换掉原来旧的,然后新配置清空 + MemConfigBackupManager.getInstance().success(); + } + } + + /** + * 切换失败后的处理 + */ + public void failed() { + FineLoggerFactory.getLogger().info("[EnvBackup] 3.handle failed" ); + ((DesignContext) Carina.getApplicationContext()).setDesignWebInfPath(origin.getPath()); + // 切换失败,如果原来是本地,则切回去 + ConfigRepositoryFactory.getInstance().reset(); + if (local) { + ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new LocalConfigRepositoryBuilder(properties, path)); + } else { + // 如果是远程,则新环境的配置全部弃用,直接走老的 + MemConfigBackupManager.getInstance().failed(); + } + + } + + public boolean isSwtiching() { + return swtiching; + } + + public EnvBackupHelper setSwtiching(boolean swtiching) { + this.swtiching = swtiching; + return this; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java b/designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java new file mode 100644 index 0000000000..352e468343 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java @@ -0,0 +1,88 @@ +package com.fr.design.mem; + +import com.fanruan.config.realm.ConfigRepositoryProvider; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 内存配置框架备份管理 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/11 + */ +public class MemConfigBackupManager { + + private static final MemConfigBackupManager INSTANCE = new MemConfigBackupManager(); + + private Map oldEnvConfig = new ConcurrentHashMap<>(); + + private Map newEnvConfig = new ConcurrentHashMap<>(); + + private boolean switching = false; + + /** + * 获取备份 + */ + public static MemConfigBackupManager getInstance() { + return INSTANCE; + } + + /** + * 获取配置 + */ + public ConfigRepositoryProvider get(String namespace) { + if (switching) { + return newEnvConfig.getOrDefault(namespace, null); + } + return oldEnvConfig.getOrDefault(namespace, null); + } + + /** + * 放入配置 + */ + public void put(String namespace, ConfigRepositoryProvider provider) { + if (switching) { + newEnvConfig.put(namespace, provider); + } else { + oldEnvConfig.put(namespace, provider); + } + } + + + /** + * 清理 + */ + public void clear() { + oldEnvConfig.clear(); + newEnvConfig.clear(); + switching = false; + } + + /** + * 切换成功则将切换过程中的配置移动到旧配置,新的切换过程中的配置置空 + */ + public void success() { + oldEnvConfig = new HashMap<>(newEnvConfig); + newEnvConfig.clear(); + switching = false; + } + + public void failed() { + newEnvConfig.clear(); + switching = false; + } + + public boolean isSwitching() { + return switching; + } + + /** + * 开始切换 + */ + public void startSwitch() { + switching = true; + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java b/designer-base/src/main/java/com/fr/design/mem/MemConfigRepository.java similarity index 99% rename from designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java rename to designer-base/src/main/java/com/fr/design/mem/MemConfigRepository.java index c88241794d..4528026741 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java +++ b/designer-base/src/main/java/com/fr/design/mem/MemConfigRepository.java @@ -1,4 +1,4 @@ -package com.fanruan.boot.mem; +package com.fr.design.mem; import com.fanruan.config.event.ConfigListener; import com.fanruan.config.realm.ConfigRepositoryProvider; diff --git a/designer-base/src/main/java/com/fr/design/mem/MemConfigRepositoryBuilder.java b/designer-base/src/main/java/com/fr/design/mem/MemConfigRepositoryBuilder.java new file mode 100644 index 0000000000..63d6ff6814 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mem/MemConfigRepositoryBuilder.java @@ -0,0 +1,30 @@ +package com.fr.design.mem; + +import com.fanruan.config.realm.ConfigRepositoryBuilder; +import com.fanruan.config.realm.ConfigRepositoryProvider; + + + +/** + * 设计器MemConfigRepositoryBuilder + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/5/29 + */ +public class MemConfigRepositoryBuilder implements ConfigRepositoryBuilder { + @Override + public ConfigRepositoryProvider build(String namespace) throws Exception { + ConfigRepositoryProvider provider = MemConfigBackupManager.getInstance().get(namespace); + if (provider != null) { + // 如果备份中有说明就是当前要的配置 + return provider; + } else { + // 如果没有,说明是全新的远程环境,新建一个 + provider = new MemConfigRepository(namespace); + // 备份也得放一个 + MemConfigBackupManager.getInstance().put(namespace, provider); + } + return provider; + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java index 49c3566b70..3a0b195b03 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java @@ -1,7 +1,8 @@ package com.fanruan.boot.env; -import com.fanruan.boot.ConfigHelper; +import com.fr.design.ConfigHelper; import com.fanruan.boot.key.StartupArgsShell; +import com.fr.design.mem.MemConfigRepositoryBuilder; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; @@ -26,7 +27,6 @@ import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.plugin.remind.PluginErrorDesignReminder; import com.fr.env.utils.WorkspaceUtils; import com.fr.event.Event; -import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.event.Null; import com.fr.file.filetree.FileNodes; @@ -36,8 +36,7 @@ import com.fr.report.lock.DefaultLockInfoOperator; import com.fr.report.lock.LocalLockInfoOperator; import com.fr.report.lock.LockInfoOperator; import com.fr.report.lock.ServerLockInfoOperator; -import com.fr.stable.StringUtils; -import com.fr.start.DesignContext; +import com.fr.design.backup.DesignContext; import com.fr.start.module.StartupArgs; import com.fr.value.NotNullLazyValue; import com.fr.workspace.WorkContext; @@ -186,7 +185,6 @@ public class DesignEnvChooseComponent extends ResourceAffiliate { String current = DesignerEnvManager.getEnvManager().getCurEnvName(); workspaceInfo = WorkspaceUtils.getWorkspaceInfo(); ((DesignContext)Carina.getApplicationContext()).setDesignWebInfPath(workspaceInfo.getPath()); - updateConfigPath(workspaceInfo); Workspace workspace = DesignerWorkspaceGenerator.generate(workspaceInfo); boolean checkValid = workspace != null && workspaceInfo.checkValid(); if (!checkValid) { @@ -205,17 +203,14 @@ public class DesignEnvChooseComponent extends ResourceAffiliate { private void updateConfigBuilder() { ConfigRepositoryFactory.getInstance().reset(); - ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new LocalConfigRepositoryBuilder(ConfigHelper.getEnvProperties(), ConfigHelper.getEnvPropertiesPath())); - } - - private void updateConfigPath(DesignerWorkspaceInfo workspaceInfo) { - if (StringUtils.isEmpty(workspaceInfo.getPath())) { - ConfigHelper.setPath(workspaceInfo.getConnection().getUrl()); + if (WorkContext.getCurrent().isLocal()) { + ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new LocalConfigRepositoryBuilder(ConfigHelper.getEnvProperties(), ConfigHelper.getEnvPropertiesPath())); } else { - ConfigHelper.setPath(workspaceInfo.getPath()); + ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new MemConfigRepositoryBuilder()); } } + /** * 注册切换环境前后事件监听 */ diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index dda5c6b80f..7eac572bb0 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -30,7 +30,6 @@ import com.fr.cbb.dialect.security.InsecurityElementFactory; import com.fr.cluster.ClusterBridge; import com.fr.cluster.lock.ClusterLock; import com.fr.config.BaseDBEnv; -import com.fr.config.ConfigContext; import com.fr.config.ConfigEvent; import com.fr.config.FinalPreferenceConfig; import com.fr.config.dao.DaoContext; @@ -46,6 +45,7 @@ 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.design.backup.EnvBackupHelper; import com.fr.env.detect.EnvDetectorCenter; import com.fr.event.EventDispatcher; import com.fr.general.FRLogger; @@ -64,9 +64,7 @@ import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; import com.fr.record.analyzer.AnalyzerConfiguration; -import com.fr.record.analyzer.AnalyzerKey; import com.fr.record.analyzer.AnalyzerMutableGroup; -import com.fr.record.analyzer.Assistant; import com.fr.record.analyzer.DBMetrics; import com.fr.scheduler.QuartzContext; import com.fr.scheduler.SchedulerEvent; @@ -76,7 +74,6 @@ import com.fr.security.encryption.core.EncryptionScaffold; import com.fr.security.encryption.provider.SecuritySeedProvider; import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey; -import com.fr.stable.GraphDrawHelper; import com.fr.stable.StringUtils; import com.fr.stable.db.DBContext; import com.fr.stable.db.properties.FineMicroServicesDBProperties; @@ -84,11 +81,8 @@ import com.fr.stable.db.session.DBSession; import com.fr.stable.project.ProjectConstants; import com.fr.tenant.context.TenantContext; import com.fr.tenant.context.provider.CurrentTenantKey; -import com.fr.third.net.bytebuddy.description.type.TypeDescription; -import com.fr.third.net.bytebuddy.dynamic.DynamicType; import com.fr.third.net.bytebuddy.implementation.MethodDelegation; import com.fr.third.net.bytebuddy.matcher.ElementMatchers; -import com.fr.third.net.bytebuddy.utility.JavaModule; import com.fr.third.org.hibernate.jdbc.AbstractWork; import com.fr.tolerance.FaultTolerance; import com.fr.tolerance.FaultToleranceInterceptor; @@ -102,7 +96,6 @@ import com.fr.workspace.WorkContext; import java.net.URI; import java.sql.Connection; import java.sql.SQLException; -import java.util.Objects; import java.util.Properties; /** @@ -249,7 +242,7 @@ public class DesignEnvComponent { private void startFileServer() throws Exception { if (WorkContext.getCurrent().isLocal()) { // 设计器远程下不需要文件系统,走PublicRepo的接口,本地下走基础的磁盘读写 - LocalFileRepository localFileRepository = LocalFileRepository.getSingleton(); + LocalFileRepository localFileRepository = new LocalFileRepository(ProjectConstants.LOCAL_ENV, ServiceContext.getWebInfPath()); ResourceRepository realRepo = RepositoryFactory.getRepo(); FSProperties fsProperties = Carina.properties(FSProperties.class); FileServer.init( @@ -304,6 +297,10 @@ public class DesignEnvComponent { */ private void startConfConfig() { + if (EnvBackupHelper.getInstance().isSwtiching()) { + // 如果是切换环境触发的start,说明此时读的是新环境的配置 + EnvBackupHelper.getInstance().do4Switch4Config(); + } BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get()); if (!WorkContext.getCurrent().isLocal()) { TransactorFactory.setTransactor(new RemoteTransactor()); diff --git a/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java b/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java deleted file mode 100644 index 83fc978d01..0000000000 --- a/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fanruan.boot.mem; - -import com.fanruan.config.realm.ConfigRepositoryBuilder; -import com.fanruan.config.realm.ConfigRepositoryProvider; - - - -/** - * 设计器MemConfigRepositoryBuilder - * - * @author Destiny.Lin - * @since 11.0 - * Created on 2024/5/29 - */ -public class MemConfigRepositoryBuilder implements ConfigRepositoryBuilder { - @Override - public ConfigRepositoryProvider build(String namespace) throws Exception { - return new MemConfigRepository(namespace); - } -} diff --git a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java index 8f3cdfa09b..21bca14bd0 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java @@ -1,8 +1,7 @@ package com.fanruan.boot.pre; -import com.fanruan.boot.ConfigHelper; +import com.fr.design.ConfigHelper; import com.fanruan.boot.key.StartupArgsShell; -import com.fanruan.boot.mem.MemConfigRepositoryBuilder; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; @@ -15,9 +14,7 @@ import com.fanruan.config.realm.ConfigRepositoryFactory; import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; import com.fanruan.mq.CarinaMQ; import com.fanruan.mq.InternalMQProvider; -import com.fanruan.product.ProductConstants; import com.fr.base.function.UITerminator; -import com.fr.carina.revert.provider.CarinaPluginProvider; import com.fr.carina.util.CarinaResourceUtils; import com.fr.carina.util.provider.CarinaResourceProvider; import com.fr.design.DesignerEnvManager; @@ -36,13 +33,10 @@ import com.fr.general.CommonIOUtils; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.engine.event.LifecycleErrorEvent; -import com.fr.plugin.ExtraClassManager; import com.fr.runtime.FineRuntime; import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonUtils; -import com.fr.stable.fun.ResourcePathTransformer; import com.fr.stable.lifecycle.FineLifecycleFatalError; -import com.fr.stable.plugin.ExtraClassManagerProvider; import com.fr.stable.project.ProjectConstants; import com.fr.stable.resource.ResourceLoader; import com.fr.start.DesignerSubListener; @@ -57,22 +51,13 @@ import com.fr.tenant.context.PlatformScaffoldTenantStarter; import com.fr.tenant.context.TenantContext; import com.fr.tenant.context.provider.CurrentTenantKey; import com.fr.tenant.store.impl.DefaultTenantStorage; -import com.fr.web.controller.common.FileContentModificator; -import com.fr.web.controller.plugin.PluginFileContentModificator; -import com.fr.web.file.FileContentProcessorFactory; import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.servlet.http.HttpServletRequest; import java.io.ByteArrayInputStream; -import java.io.File; import java.io.InputStream; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; import java.util.concurrent.CompletableFuture; /** diff --git a/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java b/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java index ca5f2fc431..3e3f083b69 100644 --- a/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java @@ -7,6 +7,7 @@ import com.fanruan.carina.context.CarinaApplicationContext; import com.fanruan.carina.standard.PartitionManager; import com.fanruan.carina.standard.PartitionManagerImpl; import com.fr.base.StateHubContext; +import com.fr.design.backup.DesignContext; import com.fr.design.carton.SwitchForSwingChecker; import com.fr.log.FineLoggerFactory; diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index d4bb496d33..7dd13d1d7d 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -16,7 +16,7 @@ import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.event.Null; import com.fr.module.Activator; -import com.fr.start.DesignContext; +import com.fr.design.backup.DesignContext; import com.fr.value.NotNullLazyValue; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; From 22bb96bd5e20b98f46bec04256bbf5c4bec05040 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 12 Jul 2024 13:47:36 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-126685=20fbp=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=80=82=E9=85=8D=E2=80=94=E2=80=94=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=AD=98=E5=82=A8=E4=BD=8D=E7=BD=AE=E7=A0=94?= =?UTF-8?q?=E7=A9=B6=20=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mem/MemConfigBackupManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java b/designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java index 352e468343..44d365865d 100644 --- a/designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java +++ b/designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java @@ -70,6 +70,9 @@ public class MemConfigBackupManager { switching = false; } + /** + * 失败处理 + */ public void failed() { newEnvConfig.clear(); switching = false; From 4832989d75ac75bb8896ad4542e4a60f3e6cc053 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 12 Jul 2024 18:16:08 +0800 Subject: [PATCH 6/6] =?UTF-8?q?KERNEL-19047=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E9=80=82=E9=85=8D=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=85=8D=E7=BD=AE=E8=AF=BB=E5=86=99?= =?UTF-8?q?=E5=88=86=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/connect/ConnectionListPane.java | 5 +++-- .../fanruan/boot/env/DesignEnvComponent.java | 5 +++++ .../env/function/DesignDatasourceComponent.java | 17 +++++++++++++++++ .../boot/init/DesignWorkContextComponent.java | 5 ++--- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 18e0ff14f1..fd10c25fdf 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/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 removedConnNames, List 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; diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 7eac572bb0..fcb50ecb49 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -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; diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java index ba9d63055a..c6f277535d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java @@ -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()); } /** diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index e80a294a19..8049690aec 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java +++ b/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()) ); }