From 62d9909ce6a4f4d5acd97eb18190ee51d499c977 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 31 May 2024 16:24:21 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E9=80=82=E9=85=8Dfbp1.0=E5=88=86?= =?UTF-8?q?=E6=94=AF=E4=B8=8E=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=A1=86=E6=9E=B6=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignModelAdapter.java | 27 +++- .../alphafine/AlphaFineConfigManager.java | 3 +- .../fr/design/data/datapane/ChoosePane.java | 3 +- .../TableDataPreviewDesensitizeManager.java | 10 +- .../preview/sql/PreviewPerformedSqlPane.java | 14 +- .../tabledata/wrapper/TableDataFactory.java | 9 +- .../editlock/EditLockChangeChecker.java | 10 +- .../com/fr/design/editlock/EditLockUtils.java | 22 ++- .../env/DesignerWorkspaceGenerator.java | 2 - .../fr/design/env/HttpWorkspaceConnector.java | 59 +++++++ .../com/fr/design/env/RemoteWorkspace.java | 14 +- .../com/fr/design/file/NodeAuthProcessor.java | 9 +- .../com/fr/design/file/TemplateTreePane.java | 3 +- .../gui/itree/filetree/TemplateDirTree.java | 6 +- .../gui/itree/filetree/TemplateFileTree.java | 13 +- .../com/fr/design/mainframe/JTemplate.java | 22 ++- .../versioncheck/VersionCheckUtils.java | 33 ++-- .../java/com/fr/file/FILEChooserPane.java | 3 +- .../main/java/com/fr/file/FileNodeFILE.java | 25 +-- .../chart/map/designer/type/WMSLayerPane.java | 5 +- .../share/ui/local/LocalWidgetRepoPane.java | 29 +++- .../DesignSerializationComponent.java | 2 +- .../DesignWorkContextComponent.java | 35 ++-- .../{ => init}/DesignerInitComponent.java | 6 +- .../{ => init}/DesignerStartupComponent.java | 2 +- .../boot/{ => init}/PreLoadComponent.java | 2 +- .../boot/{ => init}/XMLableComponent.java | 2 +- .../boot/pre/DesignConfigComponent.java | 28 ++++ .../pre/DesignPluginSupplementComponent.java | 24 +++ .../boot/pre/DesignPreStartComponent.java | 151 ++++++++++++++++++ .../boot/{ => pre}/DesignTenantComponent.java | 14 +- .../{ => show}/DesignConfConfigComponent.java | 5 +- .../DesignCoreSupplementalComponent.java | 5 +- .../boot/{ => show}/DesignEnvComponent.java | 2 +- .../{ => show}/DesignFunctionComponent.java | 5 +- .../{ => show}/DesignLoggerComponent.java | 5 +- .../{ => show}/DesignPluginComponent.java | 5 +- .../{ => show}/DesignUpdateComponent.java | 2 +- .../{ => show}/DesignWorkspaceComponent.java | 2 +- .../DesignWorkspaceRegisterComponent.java | 2 +- .../boot/{ => show}/DesignerComponent.java | 2 +- .../boot/{ => show}/DesignerDaoComponent.java | 5 +- .../{ => show}/DesignerShowComponent.java | 2 +- .../mainframe/InformationCollector.java | 3 +- .../fr/design/report/ReportEnginePane.java | 4 +- .../java/com/fr/start/CarinaDesigner.java | 37 +---- .../java/com/fr/start/DesignLauncher.java | 2 +- .../main/java/com/fr/start/SplashContext.java | 3 +- .../DesignerStartupPageActivator.java | 4 +- .../optimized/TenantDBAdapter4Designer.java | 116 +++++++------- 50 files changed, 556 insertions(+), 242 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java rename designer-realize/src/main/java/com/fanruan/boot/{ => init}/DesignSerializationComponent.java (95%) rename designer-realize/src/main/java/com/fanruan/boot/{ => init}/DesignWorkContextComponent.java (62%) rename designer-realize/src/main/java/com/fanruan/boot/{ => init}/DesignerInitComponent.java (79%) rename designer-realize/src/main/java/com/fanruan/boot/{ => init}/DesignerStartupComponent.java (99%) rename designer-realize/src/main/java/com/fanruan/boot/{ => init}/PreLoadComponent.java (99%) rename designer-realize/src/main/java/com/fanruan/boot/{ => init}/XMLableComponent.java (93%) create mode 100644 designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java rename designer-realize/src/main/java/com/fanruan/boot/{ => pre}/DesignTenantComponent.java (76%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignConfConfigComponent.java (90%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignCoreSupplementalComponent.java (89%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignEnvComponent.java (94%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignFunctionComponent.java (75%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignLoggerComponent.java (82%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignPluginComponent.java (82%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignUpdateComponent.java (94%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignWorkspaceComponent.java (94%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignWorkspaceRegisterComponent.java (94%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignerComponent.java (96%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignerDaoComponent.java (81%) rename designer-realize/src/main/java/com/fanruan/boot/{ => show}/DesignerShowComponent.java (98%) diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index bd4130a853..de81a8c258 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -16,9 +16,11 @@ import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.script.Calculator; import com.fr.stable.Filter; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; +import com.fr.stable.collections.CollectionUtils; import com.fr.stable.js.WidgetName; import com.fr.util.ParameterApplyHelper; @@ -285,7 +287,7 @@ public abstract class DesignModelAdapter tableDatas) { + if (CollectionUtils.isEmpty(tableDatas)) { + return new ParameterProvider[0][]; + } + List parameterProviders = new ArrayList<>(); + for (TableData tableData : tableDatas) { + ParameterProvider[] tableDataParameters = this.getTableDataParameters(tableData); + parameterProviders.add(tableDataParameters); + } + return parameterProviders.toArray(new ParameterProvider[parameterProviders.size()][]); + } + + + private ParameterProvider[] getTableDataParameters(TableData tableData) { + + ParameterProvider[] res = null; + if (tableData != null) { + res = tableData.getParameters(Calculator.createCalculator()); + } + + return res == null ? new ParameterProvider[0] : res; + } + protected void updateTableDataParameters(String oldName, String tdName, TableData tableData, diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index 7d02c03864..ecf179e4c0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -136,7 +136,8 @@ public class AlphaFineConfigManager implements XMLable { public static boolean isALPHALicAvailable() { - return VT4FR.AlphaFine.isSupport(); + // todo lic相关的被拆分了,需要再适配一下lic的api + return true; } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index dc819c558b..09503086f8 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -336,7 +336,8 @@ public class ChoosePane extends BasicBeanPane implements Refresha private List getHasAuthConnections() { List authConnections = new ArrayList<>(); Set allConnections = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet(); - Collection noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); + // todo 待实现 + Collection noAuthConnections = new ArrayList<>(); if (noAuthConnections == null) { return authConnections; } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/TableDataPreviewDesensitizeManager.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/TableDataPreviewDesensitizeManager.java index abd5a4d166..b0ca14250e 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/TableDataPreviewDesensitizeManager.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/TableDataPreviewDesensitizeManager.java @@ -8,18 +8,12 @@ import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.TableDataDesensitizationItem; import com.fr.data.desensitize.manage.DesensitizationManager; import com.fr.data.desensitize.util.DesentizationUtils; -import com.fr.decision.webservice.bean.user.DepartmentPostBean; -import com.fr.decision.webservice.bean.user.RoleBean; -import com.fr.decision.webservice.utils.DecisionServiceConstants; -import com.fr.decision.webservice.v10.user.CustomRoleService; -import com.fr.decision.webservice.v10.user.PositionService; + import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.preview.PreviewTableModel; import com.fr.design.data.datapane.preview.desensitization.model.DesensitizedPreviewTableModel; import com.fr.esd.query.StrategicTableData; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; + import java.util.Arrays; import java.util.Collection; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java index c0239c8fad..f76ec5a4a2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.preview.sql; +import com.fanruan.carina.Carina; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.base.ParameterMapNameSpace; @@ -19,6 +20,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; +import com.fr.platform.scaffold.provider.config.PreventSqlInjConfigProvider; import com.fr.plugin.injectable.PluginModule; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; @@ -189,7 +191,9 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { Parameter[] paras = processParameters(tableData, calculator); // 所有被转义参数的集合 refreshEscapeSqlHelper(); - Set specialCharParam = EscapeSqlHelper.getInstance().getSpecialCharParam(paras); + // todo 待实现[check]EscapeSqlHelper.getInstance().getSpecialCharParam(paras); + Set specialCharParam = new HashSet<>(); + // 将参数转义等 Set tableDataProviders = getTableDataProviders(); for (TableDataProvider provider : tableDataProviders) { @@ -223,15 +227,13 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { // 埋点方法 private static void showSpecialCharSqlPane(String sql, List specialCharParamIndex, boolean highlight) { - PreviewPerformedSqlPane pane = new PreviewPerformedSqlPane(DesignerContext.getDesignerFrame(), sql, specialCharParamIndex, ConfigService.getInstance().getPSIConfig().getSelectedSpecialChar(), highlight); + PreviewPerformedSqlPane pane = new PreviewPerformedSqlPane(DesignerContext.getDesignerFrame(), sql, specialCharParamIndex, Carina.config(PreventSqlInjConfigProvider.class).getSpecialChars(), highlight); pane.setVisible(true); } private static void refreshEscapeSqlHelper() { - EscapeSqlHelper.getInstance().setUseForbidWord(ConfigService.getInstance().getPSIConfig().isUseForbidWord()); - EscapeSqlHelper.getInstance().setSelectedForbidWord(ConfigService.getInstance().getPSIConfig().getSelectedForbidWord()); - EscapeSqlHelper.getInstance().setUseEscapeSpecialChar(ConfigService.getInstance().getPSIConfig().isUseEscapeSpecialChar()); - EscapeSqlHelper.getInstance().setSelectedSpecialChar(ConfigService.getInstance().getPSIConfig().getSelectedSpecialChar()); + EscapeSqlHelper.getInstance().setUseForbidWord(Carina.config(PreventSqlInjConfigProvider.class).isUseForbidWord()); + EscapeSqlHelper.getInstance().setUseEscapeSpecialChar(Carina.config(PreventSqlInjConfigProvider.class).isUseEscapeSpecialChar()); } private static boolean isShowSpecialCharSqlPane(List specialCharParamIndex) { diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index e716547e6b..ab652177e4 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -8,7 +8,7 @@ import com.fr.data.impl.DBTableData; import com.fr.data.impl.DecoratedTableData; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.FileTableData; -import com.fr.data.impl.MultiFieldTableData; +//import com.fr.data.impl.MultiFieldTableData; import com.fr.data.impl.MultiTDTableData; import com.fr.data.impl.RecursionTableData; import com.fr.data.impl.storeproc.StoreProcedure; @@ -28,6 +28,7 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.user.UserAuthority; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -63,7 +64,8 @@ public abstract class TableDataFactory { defaultMap.put(MultiTDTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/multi_normal.svg", MultiTDTableData.class, MultiTDTableDataPane.class)); defaultMap.put(FileTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/file_normal.svg", FileTableData.class, FileTableDataPane.class)); defaultMap.put(RecursionTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/tree_normal.svg", RecursionTableData.class, TreeTableDataPane.class)); - defaultMap.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/database_normal.svg", MultiFieldTableData.class, null)); + // todo 待实现 + //defaultMap.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/database_normal.svg", MultiFieldTableData.class, null)); map.putAll(defaultMap); } @@ -177,8 +179,7 @@ public abstract class TableDataFactory { public static String[] getSortOfChineseNameOfServerData() { clearAll(); try { - UserAuthority userAuthority = WorkContext.getCurrent().get(UserAuthority.class); - Iterator nameIt = userAuthority.getAuthServerDataSetNames().iterator(); + Iterator nameIt = TableDataRepository.getInstance().getAllNames(StringUtils.EMPTY).iterator(); while (nameIt.hasNext()) { String name = nameIt.next(); addName(name, TableDataConfigProviderFactory.getInstance().getTableData(name)); diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java index d45c4c1813..5a8004fbce 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java @@ -6,6 +6,8 @@ import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.editlock.EditLockOperator; import com.fr.report.LockItem; +import com.fr.workspace.server.repository.connection.ConnectionRepository; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import java.util.ArrayList; import java.util.List; @@ -38,8 +40,12 @@ public abstract class EditLockChangeChecker { // 判断是否为远程设计环境 if (!WorkContext.getCurrent().isLocal()) { try { - EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class); - boolean locked = operator.isLocked(lockItem); + boolean locked = false; + if (lockItem == LockItem.CONNECTION) { + locked = ConnectionRepository.getInstance().isLock(lockItem.getDescription()); + } else { + locked = TableDataRepository.getInstance().isLock(lockItem.getDescription()); + } if (isLocked() != locked) { setLocked(locked); fireChange(); diff --git a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java index 49b1a85ce4..87ca587f5f 100644 --- a/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java +++ b/designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java @@ -9,6 +9,8 @@ import com.fr.general.IOUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.editlock.EditLockOperator; import com.fr.report.LockItem; +import com.fr.workspace.server.repository.connection.ConnectionRepository; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; @@ -72,16 +74,26 @@ public class EditLockUtils { } public static boolean lock(LockItem lockItem) { - return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem); + if (lockItem == LockItem.CONNECTION) { + return ConnectionRepository.getInstance().lock(lockItem.getDescription()); + } else { + return TableDataRepository.getInstance().lock(lockItem.getDescription()); + } } public static boolean unlock(LockItem lockItem) { - return WorkContext.getCurrent().get(EditLockOperator.class).unlock(lockItem); + if (lockItem == LockItem.CONNECTION) { + return ConnectionRepository.getInstance().unlock(lockItem.getDescription()); + } else { + return TableDataRepository.getInstance().unlock(lockItem.getDescription()); + } } public static boolean isLocked(LockItem lockItem) { - EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class); - // 启动过程中UILockButton初始化的时候会调用这个方法,但是此时workObjectPool中还没有对象,会报npe - return operator != null && operator.isLocked(lockItem); + if (lockItem == LockItem.CONNECTION) { + return ConnectionRepository.getInstance().isLock(lockItem.getDescription()); + } else { + return TableDataRepository.getInstance().isLock(lockItem.getDescription()); + } } } diff --git a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java index 15b0e191e0..4ef8eab8b4 100644 --- a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java +++ b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java @@ -2,14 +2,12 @@ package com.fr.design.env; import com.fr.common.report.ReportState; import com.fr.concurrent.NamedThreadFactory; -import com.fr.design.EnvChangeEntrance; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; -import com.fr.process.ProcessEventPipe; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StringUtils; diff --git a/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java b/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java new file mode 100644 index 0000000000..4326ea366d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java @@ -0,0 +1,59 @@ +package com.fr.design.env; + +import com.fanruan.workplace.http.HttpConstants; +import com.fr.stable.StringUtils; +import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient; +import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean; +import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean; +import com.fr.workspace.connect.WorkspaceClient; +import com.fr.workspace.connect.WorkspaceConnection; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.connect.WorkspaceConnector; +import com.fr.workspace.server.repository.connect.RemoteNetworkRepository; + +import java.net.InetAddress; +import java.util.UUID; + +/** + * 远程环境连接器 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/5/24 + */ +public class HttpWorkspaceConnector implements WorkspaceConnector { + private static final HttpWorkspaceConnector INSTANCE = new HttpWorkspaceConnector(); + + public static HttpWorkspaceConnector getInstance() { + + return INSTANCE; + } + + @Override + public boolean testConnection(WorkspaceConnectionInfo connectionInfo) throws Exception { + LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); + return StringUtils.isNotEmpty(bean.getAccessToken()); + } + + @Override + public WorkspaceClient connect(WorkspaceConnectionInfo connectionInfo) throws Exception { + FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo); + LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); + WorkspaceConnection connection = new WorkspaceConnection( + UUID.randomUUID().toString(), + connectionInfo.getUserName(), + HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(), + InetAddress.getLocalHost().getHostAddress()); + client.updateConnection(connection); + client.startHeartBeat(); + return client; + } + + private LoginRequestInfoBean createLoginBean(WorkspaceConnectionInfo connectionInfo) { + LoginRequestInfoBean bean = new LoginRequestInfoBean(); + bean.setUsername(connectionInfo.getUserName()); + bean.setPassword(connectionInfo.getPassword()); + bean.setEncrypted(false); + return bean; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java index 6619c11c11..ca070219e5 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java @@ -13,6 +13,8 @@ import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.server.authority.decision.DecisionOperator; import com.fr.workspace.pool.WorkObjectPool; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; + import javax.swing.SwingWorker; /** @@ -63,15 +65,7 @@ public class RemoteWorkspace implements Workspace { @Override public boolean isWarDeploy() { - if (warDeploy == null) { - warDeploy = WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler() { - @Override - public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { - return false; - } - }).isWarDeploy(); - } - return warDeploy; + return false; } @Override @@ -86,7 +80,7 @@ public class RemoteWorkspace implements Workspace { if (isRoot == null) { synchronized (this) { if (isRoot == null) { - isRoot = WorkContext.getCurrent().get(DecisionOperator.class).isRoot(getConnection().getUserName()); + isRoot = RemoteAuthorityRepository.getInstance().isRoot(getConnection().getUserName()); } } } diff --git a/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java b/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java index c3b8d3e4d5..43da357c40 100644 --- a/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java +++ b/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java @@ -12,6 +12,7 @@ import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.AuthorityOperator; import com.fr.workspace.server.authority.decision.DecisionOperator; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.lang.reflect.UndeclaredThrowableException; import java.util.ArrayList; @@ -43,13 +44,7 @@ public class NodeAuthProcessor { try { String userName = WorkContext.getCurrent().getConnection().getUserName(); DesignAuthority[] authorities = null; - try { - String userId = WorkContext.getCurrent().get(DecisionOperator.class).getUserIdByName(userName); - authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(userId); - } catch(UndeclaredThrowableException e) { - // 兼容旧版本的服务器 - authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(); - } + authorities = RemoteAuthorityRepository.getInstance().getAuthorities(WorkContext.getCurrent().getConnection().getUserName()); // 远程设计获取设计成员的权限列表 DesignAuthority authority = null; diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index d985595f5f..36de6a75e3 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -61,6 +61,7 @@ import java.util.Observer; import java.util.Set; import java.util.stream.Collectors; +import com.fr.workspace.server.repository.template.TemplateRepository; import org.jetbrains.annotations.Nullable; @@ -212,7 +213,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { * 刷新 */ public void refreshDockingView() { - reportletsTree.setFileNodeFilter(new IOFileNodeFilter(FRContext.getFileNodes().getSupportedTypes())); + reportletsTree.setFileNodeFilter(new IOFileNodeFilter(TemplateRepository.getInstance().getSupportedTypes())); reportletsTree.refreshEnv(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java index c4c5b7bf55..82f7bc3269 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateDirTree.java @@ -4,6 +4,8 @@ import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.mainframe.manager.search.TemplateDirTreeSearchManager; import com.fr.file.filetree.FileNode; +import com.fr.workspace.server.entity.template.TemplateListBean; +import com.fr.workspace.server.repository.template.TemplateRepository; import java.util.Arrays; import java.util.Map; @@ -26,7 +28,9 @@ public class TemplateDirTree extends TemplateFileTree { * @return */ public FileNode[] listFile(String path) { - return Arrays.stream(FRContext.getFileNodes().list(path)).filter(FileNode::isDirectory).toArray(FileNode[]::new); + TemplateListBean bean = new TemplateListBean(); + bean.setTargetPath(path); + return Arrays.stream(TemplateRepository.getInstance().list(bean)).filter(FileNode::isDirectory).toArray(FileNode[]::new); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java index b87a70b5b6..ad36be8cd4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -13,6 +13,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.StableUtils; import com.fr.stable.collections.CollectionUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.server.entity.template.TemplateListBean; +import com.fr.workspace.server.repository.template.TemplateRepository; import javax.swing.text.Position; import javax.swing.tree.DefaultTreeModel; @@ -142,10 +144,13 @@ public class TemplateFileTree extends EnvFileTree { public FileNode[] listFile(String path) { // 支持插件扩展, 先从env的filter拿, 再从插件拿 Set supportTypes = createFileExtensionFilter(); - return FRContext.getFileNodes().list( - path, - supportTypes.toArray(new FileExtension[supportTypes.size()]), false, true - ); + TemplateListBean bean = new TemplateListBean(); + bean.setFilter( supportTypes.toArray(new FileExtension[supportTypes.size()])); + bean.setCheckLock(true); + bean.setRecurse(false); + bean.setTargetPath(path); + + return TemplateRepository.getInstance().list(bean); } private Set createFileExtensionFilter() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 3a0a2deefd..74ec97605f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -14,7 +14,6 @@ import com.fr.base.theme.TemplateThemeCompatible; import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.ThemedTemplate; import com.fr.base.vcs.DesignerMode; -import com.fr.decision.config.FSConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -99,6 +98,7 @@ import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; +import com.fr.workspace.server.repository.template.TemplateRepository; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -1044,15 +1044,9 @@ public abstract class JTemplate> } protected void checkBeforeSave() throws Exception { - // 保存前校验下未解锁 - if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) { - throw new UnLockedException(); - } // 过滤掉本地文件 boolean localFile = getEditingFILE() instanceof FileFILE; - boolean inconsistent = !localFile && getEditingFILE().exists() - && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath()); - if (inconsistent) { + if (!localFile && getEditingFILE().exists()) { throw new InconsistentLockException(); } } @@ -1728,6 +1722,7 @@ public abstract class JTemplate> if (editingFILE == null || editingFILE instanceof MemFILE) { return false; } + // 锁的check在服务器做 checkBeforeSave(); export(); this.editingFILE = editingFILE; @@ -1738,9 +1733,10 @@ public abstract class JTemplate> } private boolean checkJTemplateAuthority() { - if (!FSConfig.getInstance().getAuthorizeAttr().isDataConnectionAuthority()) { - return true; - } + // todo:微服务待调整 + //if (!FSConfig.getInstance().getAuthorizeAttr().isDataConnectionAuthority()) { + // return true; + //} JTemplateAuthorityChecker jTemplateAuthorityChecker = new JTemplateAuthorityChecker(this); if (jTemplateAuthorityChecker.isAuthority()) { return true; @@ -1806,12 +1802,12 @@ public abstract class JTemplate> // 目标本地文件 !editingFILE.isEnvFile() || // 目标远程文件 - WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + TemplateRepository.getInstance().saveAs(editingFILE.getPath()); if (lockedTarget) { boolean saved = saveNewRealFile(editingFILE, oldName); // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); + TemplateRepository.getInstance().close(sourceFile.getPath()); } return saved; } else { diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index a6a2d7896a..77c5cc6229 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -198,22 +198,23 @@ public class VersionCheckUtils { public static String getRemoteBranch(DesignerWorkspaceInfo selectedEnv) { String remoteBranch; - remoteBranch = WorkContext.getCurrent().get(VersionInfoOperator.class, new ExceptionHandler() { - @Override - public String callHandler(RPCInvokerExceptionInfo exceptionInfo) { - WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); - String remoteBranch = StringUtils.EMPTY; - try { - remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); - } catch (WorkspaceConnectionException e) { - remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(GeneralUtils.readFullBuildNO()); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return remoteBranch; - } - }).getFullBuildNO(); - return remoteBranch; + // todo 微服务的branch还不确定,后面适配 + //remoteBranch = WorkContext.getCurrent().get(VersionInfoOperator.class, new ExceptionHandler() { + // @Override + // public String callHandler(RPCInvokerExceptionInfo exceptionInfo) { + // WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); + // String remoteBranch = StringUtils.EMPTY; + // try { + // remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); + // } catch (WorkspaceConnectionException e) { + // remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(GeneralUtils.readFullBuildNO()); + // } catch (Exception e) { + // FineLoggerFactory.getLogger().error(e.getMessage(), e); + // } + // return remoteBranch; + // } + //}).getFullBuildNO(); + return StringUtils.EMPTY; } /** diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 2160bffbd5..fb3ad45240 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -1,5 +1,6 @@ package com.fr.file; +import com.fr.workspace.server.repository.system.WorkspaceSystemInfo; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; @@ -1497,7 +1498,7 @@ public class FILEChooserPane extends BasicPane { if (!path.endsWith("/") && !path.endsWith("\\") && !StringUtils.isBlank(path)) { path = path + "/"; } - String webAppName = GeneralContext.getCurrentAppNameOfEnv(); + String webAppName = WorkspaceSystemInfo.getINSTANCE().getAppName(); if (StringUtils.isBlank(path) && isWebAppNamePath) { this.buttonList.add(createBlankButton(new SetDirectoryAction(webAppName + '/'))); } diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index d0fd628969..0c3d33bcc0 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -1,6 +1,5 @@ package com.fr.file; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.svg.IconUtils; import com.fr.design.file.TemplateResourceManager; @@ -23,7 +22,10 @@ import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; -import com.fr.workspace.resource.WorkResourceTempRenameStream; +import com.fr.workspace.server.entity.WorkResourceTempRenameStream; +import com.fr.workspace.server.entity.template.TemplateListBean; +import com.fr.workspace.server.repository.system.WorkspaceSystemInfo; +import com.fr.workspace.server.repository.template.TemplateRepository; import javax.swing.*; import java.io.InputStream; @@ -33,15 +35,15 @@ import java.util.Arrays; public class FileNodeFILE implements FILE { - public static String webRootPath = FRContext.getCommonOperator().getWebRootPath(); - private static String[] supportTypes = FRContext.getFileNodes().getSupportedTypes(); + public static String webRootPath = WorkspaceSystemInfo.getINSTANCE().getWebRootPath(); + private static String[] supportTypes = TemplateRepository.getInstance().getSupportedTypes(); static { EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { @Override public void on(Event event, Workspace workspace) { - webRootPath = FRContext.getCommonOperator().getWebRootPath(); - supportTypes = FRContext.getFileNodes().getSupportedTypes(); + webRootPath = WorkspaceSystemInfo.getINSTANCE().getWebRootPath(); + supportTypes = TemplateRepository.getInstance().getSupportedTypes(); } }); } @@ -256,11 +258,10 @@ public class FileNodeFILE implements FILE { private FileNode[] listFile(String rootFilePath) { try { - if (ComparatorUtils.equals(envPath, webRootPath)) { - return FRContext.getFileNodes().listWebRootFile(rootFilePath); - } else { - return FRContext.getFileNodes().list(rootFilePath); - } + TemplateListBean bean = new TemplateListBean(); + bean.setTargetPath(rootFilePath); + bean.setListWebroot(ComparatorUtils.equals(envPath, webRootPath)); + return TemplateRepository.getInstance().list(bean); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -324,7 +325,7 @@ public class FileNodeFILE implements FILE { } try { - return TemplateResourceManager.getResource().exist(node.getEnvPath()); + return TemplateRepository.getInstance().exists(node.getEnvPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java index 67369d826f..66b906ee52 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -1,6 +1,6 @@ package com.fr.van.chart.map.designer.type; -import com.fr.decision.webservice.v10.map.MapEditService; + import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -88,7 +88,8 @@ public class WMSLayerPane extends JPanel implements UIObserver { @Override protected Void doInBackground() { - List wmsNames = MapEditService.getInstance().getWMSNames(wmsUrl.getText()); + // todo 待实现[check]MapEditService.getInstance().getWMSNames(wmsUrl.getText()); + List wmsNames = new ArrayList<>(); list.clear(); for (String layer : wmsNames) { list.add(new WMSLayer(layer, false)); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java index f344d59b06..7d579068e4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java @@ -9,21 +9,24 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormWidgetDetailPane; +import com.fr.design.mainframe.reuse.SnapChatKeys; import com.fr.design.mainframe.share.sort.WidgetSortType; import com.fr.design.mainframe.share.ui.base.DownloadProgressPane; import com.fr.design.mainframe.share.ui.base.MouseClickListener; import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock; import com.fr.design.mainframe.share.ui.block.LocalWidgetUpdater; import com.fr.design.mainframe.share.ui.widgetfilter.LocalWidgetFilter; -import com.fr.design.mainframe.share.util.InstallComponentHelper; import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.theme.edit.ui.LabelUtils; +import com.fr.design.notification.SnapChat; +import com.fr.design.notification.SnapChatFactory; import com.fr.form.share.Group; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.bean.OnlineShareWidget; import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.workspace.server.repository.widget.ShareRepository; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -76,7 +79,9 @@ public class LocalWidgetRepoPane extends BasicPane { private LocalWidgetRepoPane() { initializePane(this); //新用户预装组件 - InstallComponentHelper.installPreComponent(); + if (needPreInstallComponent()) { + ShareRepository.getInstance().installPreComponent(); + } doRefresh(); } @@ -88,6 +93,20 @@ public class LocalWidgetRepoPane extends BasicPane { return keyWord4Searching; } + + + private static boolean needPreInstallComponent() { + try { + //老用户或者组件库里已有组件,不预装组件 + SnapChat snapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); + return !snapChat.hasRead() ; + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return false; + } + + private void initializePane(Container container) { container.setLayout(new BorderLayout()); @@ -353,11 +372,7 @@ public class LocalWidgetRepoPane extends BasicPane { @Override protected Boolean doInBackground() throws Exception { if (isRefreshing.compareAndSet(false, true)) { - boolean isRefresh = DefaultShareGroupManager.getInstance().refresh(); - if (isRefresh) { - ShareComponentUtils.checkReadMe(); - } - return isRefresh; + return ShareRepository.getInstance().refresh(); } return false; } diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignSerializationComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java similarity index 95% rename from designer-realize/src/main/java/com/fanruan/boot/DesignSerializationComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java index d73d2f92f1..8a2d2fe118 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignSerializationComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.init; import com.fanruan.carina.annotions.ActivatorRefer; diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignWorkContextComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java similarity index 62% rename from designer-realize/src/main/java/com/fanruan/boot/DesignWorkContextComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java index 191cb6262a..e0fb016396 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignWorkContextComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java @@ -1,23 +1,24 @@ -package com.fanruan.boot; +package com.fanruan.boot.init; +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.workplace.http.RepositoryManager; +import com.fanruan.workplace.http.WorkspaceHeartBeatShell; import com.fanruan.workplace.standard.ServerInfo; import com.fanruan.workplace.standard.ServerInfoOperator; import com.fr.decision.service.context.ServiceContext; -import com.fr.log.FineLoggerFactory; +import com.fr.design.env.HttpWorkspaceConnector; import com.fr.security.encryption.storage.StorageEncryptors; import com.fr.security.encryption.storage.StorageTransfer; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.base.WorkspaceAPI; import com.fr.workspace.base.WorkspaceKey; import com.fr.workspace.engine.FineWorkspaceFactory; import com.fr.workspace.engine.base.FineObjectPool; -import com.fr.workspace.engine.client.FineWorkspaceConnector; import com.fr.workspace.engine.client.heartbeart.FineWorkspaceHeartbeat; import com.fr.workspace.engine.client.heartbeart.WorkspaceHeartbeat; import com.fr.workspace.engine.resource.FineWorkResource; @@ -25,6 +26,14 @@ import com.fr.workspace.engine.resource.FineWorkResourceAdaptor; 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.connect.RemoteNetworkRepository; +import com.fr.workspace.server.repository.connection.ConnectionRepository; +import com.fr.workspace.server.repository.system.SystemInfoRepository; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; +import com.fr.workspace.server.repository.template.TemplateRepository; +import com.fr.workspace.server.repository.vcs.VcsRepository; +import com.fr.workspace.server.repository.widget.ShareRepository; /** * 设计器工作环境调用类初始化模块,主要负责将各个模块注册的方法注入进来 @@ -34,7 +43,7 @@ import com.fr.workspace.resource.WorkResource; * Created on 2024/5/28 */ @FineComponent(name = "design_workcontext") -@DependsOn(dependencies = {"design_start_up", "i18n", "class", "design_serialization"}) +@DependsOn(dependencies = {"design_pre_load", "i18n", "class", "design_serialization"}) public class DesignWorkContextComponent { private static final String VERSION_NUM = "01"; @@ -45,7 +54,7 @@ public class DesignWorkContextComponent { */ @Supplemental public void prepare() { - // 纯启动部分的代码不涉及Repository的更改,下一批提交会改掉 + Carina.getApplicationContext().singleton(WorkspaceHeartBeatShell.class).set(new FineWorkspaceHeartbeat()); ServiceContext.group(WorkspaceKey.class).addAll( WorkRPCRegister.wrap(ServerInfoOperator.class, new ServerInfo()), WorkRPCRegister.wrap(WorkRPCType.Local, WorkResource.class, FineWorkResource.getInstance()), @@ -59,13 +68,22 @@ public class DesignWorkContextComponent { */ @Start public void start() { + RepositoryManager.getInstance().pureRegisterRepo4Start(ConnectionRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(RemoteAuthorityRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(RemoteNetworkRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(SystemInfoRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(TableDataRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(TemplateRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(VcsRepository.getInstance()); + RepositoryManager.getInstance().pureRegisterRepo4Start(ShareRepository.getInstance()); + for (WorkRPCRegister workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) { validate(workRPCRegister.getClazz()); FineObjectPool.getInstance().add(workRPCRegister.getClazz(), workRPCRegister.getType(), workRPCRegister.getObject()); } - WorkContext.setConnector(FineWorkspaceConnector.getInstance()); + WorkContext.setConnector(HttpWorkspaceConnector.getInstance()); WorkContext.setFactory(FineWorkspaceFactory.getInstance()); WorkContext.setWorkResource(new FineWorkResourceAdaptor()); @@ -92,8 +110,5 @@ public class DesignWorkContextComponent { if (clazz == null) { return; } - if (clazz.getAnnotation(WorkspaceAPI.class) == null) { - FineLoggerFactory.getLogger().warn("workspace service {} not annotated with @Workspace.", clazz); - } } } diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignerInitComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java similarity index 79% rename from designer-realize/src/main/java/com/fanruan/boot/DesignerInitComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java index ab4448b07a..c3e7b58209 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignerInitComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.init; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; @@ -9,14 +9,14 @@ import com.fr.start.module.optimized.DesignerStartupPageActivator; /** * 设计器界面初始化模块 *

负责设计器基础界面初始化+设计器启动页初始化

- *

设计器启动两个阶段中的第一阶段,到该模块加载完表示设计器基础的前置初始化(界面、国际化等杂七杂八的东西)全部结束了,后面要正式开始数据与功能模块的初始化

+ *

设计器启动三个阶段中的第二阶段,到该模块加载完表示设计器基础的前置初始化(界面、国际化等杂七杂八的东西)全部结束了,后面要正式开始数据与功能模块的初始化

* * @author Destiny.Lin * @since 11.0 * Created on 2024/5/27 */ @FineComponent(name = "design_init") -@DependsOn(dependencies = {"design_start_up", "design_tenant", "design_workcontext", "design_xml", "design_serialization"}) +@DependsOn(dependencies = {"design_start_up", "design_workcontext", "design_xml", "design_serialization"}) @ActivatorRefer(refer = { DesignerInitActivator.class, DesignerStartupPageActivator.class, diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignerStartupComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerStartupComponent.java similarity index 99% rename from designer-realize/src/main/java/com/fanruan/boot/DesignerStartupComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/init/DesignerStartupComponent.java index 2223938988..fc48f1e7ed 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignerStartupComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerStartupComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.init; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.FineComponent; diff --git a/designer-realize/src/main/java/com/fanruan/boot/PreLoadComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/PreLoadComponent.java similarity index 99% rename from designer-realize/src/main/java/com/fanruan/boot/PreLoadComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/init/PreLoadComponent.java index 3fbc401f78..58ad495620 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/PreLoadComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/PreLoadComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.init; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; diff --git a/designer-realize/src/main/java/com/fanruan/boot/XMLableComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/XMLableComponent.java similarity index 93% rename from designer-realize/src/main/java/com/fanruan/boot/XMLableComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/init/XMLableComponent.java index e9f237b802..0ce231b34b 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/XMLableComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/XMLableComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.init; import com.fanruan.carina.annotions.ActivatorRefer; diff --git a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java new file mode 100644 index 0000000000..17b05094db --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java @@ -0,0 +1,28 @@ +package com.fanruan.boot.pre; + +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.config.ConfigProviderFactory; +import com.fanruan.config.impl.PublicConfigProviderImpl; +import com.fanruan.config.impl.ShareConfigProviderImpl; +import com.fanruan.config.realm.ConfigRealm; +import com.fanruan.config.realm.ConfigRepositoryFactory; +import com.fanruan.config.realm.mem.MemConfigRepositoryBuilder; + +/** + * 类解释注释 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/5/29 + */ +@FineComponent(name = "design_universal_config") +public class DesignConfigComponent { + + @Start + public void start() { + ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.SHARE, new ShareConfigProviderImpl()); + ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.PUBLIC, new PublicConfigProviderImpl()); + ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new MemConfigRepositoryBuilder()); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java new file mode 100644 index 0000000000..1eae91ade1 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java @@ -0,0 +1,24 @@ +package com.fanruan.boot.pre; + +import com.fanruan.boot.PluginComponent; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Supplemental; + +/** + * 类解释注释 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/5/31 + */ +@FineComponent(name = "design_plugin_supplement") +@DependsOn(dependencies = {"design_tenant", "design_universal_config"}) +public class DesignPluginSupplementComponent extends PluginComponent { + + @Start + public void start() { + super.prepare(); + } +} 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 new file mode 100644 index 0000000000..d837682521 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java @@ -0,0 +1,151 @@ +package com.fanruan.boot.pre; + +import com.fanruan.boot.key.StartupArgsShell; +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.Supplemental; +import com.fanruan.carina.context.CarinaApplicationContext; +import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory; +import com.fanruan.carina.standard.PartitionManager; +import com.fanruan.carina.standard.PartitionManagerImpl; +import com.fr.base.StateHubContext; +import com.fr.base.function.UITerminator; +import com.fr.design.DesignerEnvManager; +import com.fr.design.deeplink.DeepLinkManager; +import com.fr.design.fun.OemProcessor; +import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; +import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; +import com.fr.design.ui.util.UIUtil; +import com.fr.design.utils.DesignUtils; +import com.fr.design.utils.DesignerPort; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.log.FineLoggerFactory; +import com.fr.module.engine.event.LifecycleErrorEvent; +import com.fr.runtime.FineRuntime; +import com.fr.stable.lifecycle.FineLifecycleFatalError; +import com.fr.start.DesignContext; +import com.fr.start.DesignLauncher; +import com.fr.start.DesignerSubListener; +import com.fr.start.EmptyServletContext; +import com.fr.start.LifecycleFatalErrorHandler; +import com.fr.start.OemHandler; +import com.fr.start.SplashContext; +import com.fr.start.SplashStrategy; +import com.fr.start.common.SplashCommon; +import com.fr.start.preload.PreLoadService; + +import java.util.concurrent.CompletableFuture; + +/** + * 设计器启动前处理的模块入口 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/5/31 + */ +@FineComponent(name = "design_pre_start") +@DependsOn(dependencies = {"design_universal_config", "design_tenant", "design_plugin_supplement"}) +public class DesignPreStartComponent { + + + + @Start + public void start() { + DesignerEnvManager.getEnvManager(); + + startPreload0(); + + DesignerLifecycleMonitorContext.getMonitor().beforeStart(); + //启动运行时 + FineRuntime.start(); + //等 FineRuntime 启动后启动 + DeepLinkManager.getInstance().start(Carina.getApplicationContext().singleton(StartupArgsShell.class).get().get()); + + startPreload1(); + + DesignerSubListener.getInstance().start(); + EventDispatcher.listen(LifecycleErrorEvent.SELF, new Listener() { + @Override + public void on(Event event, FineLifecycleFatalError param) { + LifecycleFatalErrorHandler.getInstance().handle(param); + } + }); + + try { + BootstrapFactory.get().start("design_init"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + + + /** + * 在 {@link FineRuntime#start()} 运行后 + */ + protected static void startPreload1() { + + CompletableFuture initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel); + PreLoadService.getInstance().addUIFuture(initLookAndFeel); + + showSplash(); + } + + /** + * 在 {@link FineRuntime#start()} 运行前 + */ + protected static void startPreload0() { + + PreLoadService.getInstance().addRunnable(() -> { + if (DesignUtils.isPortOccupied()) { + UITerminator action = new UITerminator() { + @Override + protected void doRun() { + StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.PORT_OCCUPIED.getId(), + DesignerErrorMessage.PORT_OCCUPIED.getMessage()); + DesignerPort.getInstance().resetPort(); + } + }; + action.run(); + } + }); + } + + + private static void showSplash() { + + // 快快显示启动画面 + // vito: 这里必须用 wait, 不然会导致莫名其妙的问题 + UIUtil.invokeAndWaitIfNeeded(new Runnable() { + @Override + public void run() { + SplashContext.getInstance().registerSplash(createSplash()); + SplashContext.getInstance().show(); + } + }); + } + + private static SplashStrategy createSplash() { + + OemProcessor oemProcessor = OemHandler.findOem(); + if (oemProcessor != null) { + SplashStrategy splashStrategy = null; + try { + splashStrategy = oemProcessor.createSplashStrategy(); + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (splashStrategy != null) { + return splashStrategy; + } + } + + return new SplashCommon(); + } + +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignTenantComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignTenantComponent.java similarity index 76% rename from designer-realize/src/main/java/com/fanruan/boot/DesignTenantComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/pre/DesignTenantComponent.java index 1f8c1d8f2e..fa38d30d3c 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignTenantComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignTenantComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.pre; import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; @@ -21,7 +21,7 @@ import java.util.ArrayList; * Created on 2024/5/24 */ @FineComponent(name = "design_tenant") -@DependsOn(dependencies = {"design_start_up"}) +@DependsOn(dependencies = {}) public class DesignTenantComponent { /** @@ -31,12 +31,12 @@ public class DesignTenantComponent { public void start() { TenantContext.registerStorage(new DefaultTenantStorage()); TenantContext.registerConfigProvider(new TenantConfigProvider() { - @Override - public boolean isMultiTenantOpen() { - return false; - } + @Override + public boolean isMultiTenantOpen() { + return false; + } }); - PlatformScaffoldTenantStarter.start(new ArrayList<>(Carina.getApplicationContext().group(CurrentTenantKey.class).getAll())); + PlatformScaffoldTenantStarter.start(new ArrayList<>(Carina.getApplicationContext().group(CurrentTenantKey.class).getAll())); } diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignConfConfigComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignConfConfigComponent.java similarity index 90% rename from designer-realize/src/main/java/com/fanruan/boot/DesignConfConfigComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignConfConfigComponent.java index 9df155744a..83fbf29743 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignConfConfigComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignConfConfigComponent.java @@ -1,5 +1,6 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; +import com.fanruan.boot.ConfConfigComponent; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.JPAEntityScan; @@ -16,7 +17,7 @@ import com.fanruan.carina.annotions.Stop; @FineComponent(name = "design_conf_config") @JPAEntityScan("com.fr.config.entity") @DependsOn(dependencies = {"design_dao", "design_core_supplemental"}) -public class DesignConfConfigComponent extends ConfConfigComponent{ +public class DesignConfConfigComponent extends ConfConfigComponent { /** diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignCoreSupplementalComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignCoreSupplementalComponent.java similarity index 89% rename from designer-realize/src/main/java/com/fanruan/boot/DesignCoreSupplementalComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignCoreSupplementalComponent.java index 46724cf582..e6679d43ef 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignCoreSupplementalComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignCoreSupplementalComponent.java @@ -1,5 +1,6 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; +import com.fanruan.boot.CoreSupplementalComponent; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; @@ -16,7 +17,7 @@ import com.fanruan.carina.annotions.Supplemental; */ @FineComponent(name = "design_core_supplemental") @DependsOn(dependencies = {"env"}) -public class DesignCoreSupplementalComponent extends CoreSupplementalComponent{ +public class DesignCoreSupplementalComponent extends CoreSupplementalComponent { /** diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignEnvComponent.java similarity index 94% rename from designer-realize/src/main/java/com/fanruan/boot/DesignEnvComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignEnvComponent.java index 86f9c7cbb8..bc1313d978 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignEnvComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.FineComponent; diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignFunctionComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignFunctionComponent.java similarity index 75% rename from designer-realize/src/main/java/com/fanruan/boot/DesignFunctionComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignFunctionComponent.java index 3e83d1ddd7..379d507c51 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignFunctionComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignFunctionComponent.java @@ -1,9 +1,10 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fr.chart.activator.ChartBaseActivator; +import com.fr.data.DatasourceActivator; import com.fr.form.module.FormBaseActivator; import com.fr.report.module.ReportBaseActivator; import com.fr.workspace.server.vcs.VcsFolderManagerActivator; @@ -18,6 +19,6 @@ import com.fr.workspace.server.vcs.VcsFolderManagerActivator; */ @FineComponent(name = "design_function") @DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config", "design_update"}) -@ActivatorRefer(refer = {ChartBaseActivator.class, ReportBaseActivator.class, VcsFolderManagerActivator.class, FormBaseActivator.class}) +@ActivatorRefer(refer = {DatasourceActivator.class, ChartBaseActivator.class, ReportBaseActivator.class, VcsFolderManagerActivator.class, FormBaseActivator.class}) public class DesignFunctionComponent { } diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignLoggerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignLoggerComponent.java similarity index 82% rename from designer-realize/src/main/java/com/fanruan/boot/DesignLoggerComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignLoggerComponent.java index 875dab5c2d..c7842f6a53 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignLoggerComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignLoggerComponent.java @@ -1,6 +1,7 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; +import com.fanruan.boot.LoggerComponent; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; @@ -16,7 +17,7 @@ import com.fanruan.carina.annotions.Stop; */ @FineComponent(name = "design_logger") @DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config"}) -public class DesignLoggerComponent extends LoggerComponent{ +public class DesignLoggerComponent extends LoggerComponent { /** diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignPluginComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignPluginComponent.java similarity index 82% rename from designer-realize/src/main/java/com/fanruan/boot/DesignPluginComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignPluginComponent.java index 0fe65faa72..2b09d85c3f 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignPluginComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignPluginComponent.java @@ -1,5 +1,6 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; +import com.fanruan.boot.PluginComponent; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; @@ -15,7 +16,7 @@ import javax.servlet.ServletContext; */ @FineComponent(name = "design_plugin") @DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config", "design_logger"}) -public class DesignPluginComponent extends PluginComponent{ +public class DesignPluginComponent extends PluginComponent { /** * start diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignUpdateComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignUpdateComponent.java similarity index 94% rename from designer-realize/src/main/java/com/fanruan/boot/DesignUpdateComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignUpdateComponent.java index 7fbba69867..764e6c54a6 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignUpdateComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignUpdateComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceComponent.java similarity index 94% rename from designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceComponent.java index ddf48a7ba6..4f7b447d33 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceRegisterComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceRegisterComponent.java similarity index 94% rename from designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceRegisterComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceRegisterComponent.java index 047fd259f1..af9b62b737 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceRegisterComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceRegisterComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java similarity index 96% rename from designer-realize/src/main/java/com/fanruan/boot/DesignerComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java index 31a4d0c7f7..72dfb30253 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignerComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignerDaoComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerDaoComponent.java similarity index 81% rename from designer-realize/src/main/java/com/fanruan/boot/DesignerDaoComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignerDaoComponent.java index 62f250a6fa..fad7dfd14e 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignerDaoComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerDaoComponent.java @@ -1,6 +1,7 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; +import com.fanruan.boot.DAOComponent; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; @@ -16,7 +17,7 @@ import com.fanruan.carina.annotions.Stop; */ @FineComponent(name ="design_dao") @DependsOn(dependencies = {"design_core_supplemental"}) -public class DesignerDaoComponent extends DAOComponent{ +public class DesignerDaoComponent extends DAOComponent { /** diff --git a/designer-realize/src/main/java/com/fanruan/boot/DesignerShowComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerShowComponent.java similarity index 98% rename from designer-realize/src/main/java/com/fanruan/boot/DesignerShowComponent.java rename to designer-realize/src/main/java/com/fanruan/boot/show/DesignerShowComponent.java index a30c636053..f9789f2964 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/DesignerShowComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerShowComponent.java @@ -1,4 +1,4 @@ -package com.fanruan.boot; +package com.fanruan.boot.show; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 978e9b01af..e1a6914b04 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -143,7 +143,8 @@ public class InformationCollector implements XMLReadable, XMLWriter { */ public void collectStartTime() { this.current.setStartDate(dateToString()); - sendInfo(); + // todo 收集信息先关掉,后面再适配 + //sendInfo(); } private void sendInfo() { diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java b/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java index a3d6c4ec64..ef24b16004 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java @@ -1,5 +1,6 @@ package com.fr.design.report; +import com.fanruan.cloud.FanruanCloud; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editor.editor.IntegerEditor; @@ -13,7 +14,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.widget.FRWidgetFactory; -import com.fr.general.SiteCenter; import com.fr.log.FineLoggerFactory; import com.fr.report.core.ReportUtils; import com.fr.report.stable.LayerReportAttr; @@ -203,7 +203,7 @@ public class ReportEnginePane extends BasicBeanPane { @Override public void mouseClicked(MouseEvent e) { try { - Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("standard.doc", ProductConstants.WEBSITE_URL))); + Desktop.getDesktop().browse(new URI(FanruanCloud.siteCenter().acquireUrlByKind("standard.doc", ProductConstants.WEBSITE_URL))); } catch (IOException | URISyntaxException ex) { FineLoggerFactory.getLogger().error("io exception or not find website", ex); } 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 57baaa2f92..138c23993b 100644 --- a/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java @@ -5,20 +5,13 @@ import com.fanruan.carina.Carina; import com.fanruan.carina.context.CarinaApplicationContext; import com.fanruan.carina.standard.PartitionManager; import com.fanruan.carina.standard.PartitionManagerImpl; -import com.fr.design.DesignerEnvManager; +import com.fr.base.StateHubContext; import com.fr.design.carton.SwitchForSwingChecker; -import com.fr.design.deeplink.DeepLinkManager; -import com.fr.design.monitor.DesignerLifecycleMonitorContext; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; + import com.fr.log.FineLoggerFactory; -import com.fr.module.engine.event.LifecycleErrorEvent; -import com.fr.runtime.FineRuntime; -import com.fr.stable.lifecycle.FineLifecycleFatalError; + import com.fr.start.common.DesignerStartupContext; import com.fr.start.module.StartupArgs; -import com.fr.workspace.WorkContext; import java.util.Properties; import java.util.concurrent.TimeUnit; @@ -40,36 +33,18 @@ public class CarinaDesigner extends MainDesigner{ * main */ public static void main(String[] args) { - DesignerStartupContext.getRecorder().start(); PartitionManager manager = new PartitionManagerImpl(); + StateHubContext.setReady(false); CarinaApplicationContext carinaApplicationContext = new DesignContext(new EmptyServletContext(), manager, new Properties()); Carina.setApplicationContext(carinaApplicationContext); Carina.setPartitionManager(manager); DesignLauncher.setContext(carinaApplicationContext); - DesignerEnvManager.getEnvManager(); - - startPreload0(); - - DesignerLifecycleMonitorContext.getMonitor().beforeStart(); - //启动运行时 - FineRuntime.start(); - //等 FineRuntime 启动后启动 - DeepLinkManager.getInstance().start(args); - - startPreload1(); - - DesignerSubListener.getInstance().start(); - EventDispatcher.listen(LifecycleErrorEvent.SELF, new Listener() { - @Override - public void on(Event event, FineLifecycleFatalError param) { - LifecycleFatalErrorHandler.getInstance().handle(param); - } - }); + Carina.getApplicationContext().singleton(StartupArgsShell.class).set(new StartupArgs(args)); DesignLauncher launch = new DesignLauncher("/com/fr/config/starter/designer-startup-carina.xml"); try { FineLoggerFactory.getLogger().debug("Designer prepared.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); - Carina.getApplicationContext().singleton(StartupArgsShell.class).set(new StartupArgs(args)); + launch.launch(); } catch (Exception e) { throw new RuntimeException(e); diff --git a/designer-realize/src/main/java/com/fr/start/DesignLauncher.java b/designer-realize/src/main/java/com/fr/start/DesignLauncher.java index e2f776231b..b3b9ce0778 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignLauncher.java +++ b/designer-realize/src/main/java/com/fr/start/DesignLauncher.java @@ -65,7 +65,7 @@ public class DesignLauncher extends XmlCarinaLauncher { protected void startComponentsAndServices() throws CarinaException { try { BootstrapFactory.get().supplement(); - BootstrapFactory.get().start("design_init"); + BootstrapFactory.get().start("design_pre_start"); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 7fc909c5f3..e89d3eb51a 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -152,7 +152,8 @@ public class SplashContext { */ private void showThanks() { if (shouldShowThanks() && !hasShowThanks) { - tryFetchOnline(); + // todo 涉及到云中心的都先放着 + //tryFetchOnline(); if (StringUtils.isNotEmpty(guest)) { updateThanksLog(THANKS + guest); hasShowThanks = true; diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java index 6a5035015b..9dde7e0a86 100644 --- a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java @@ -55,8 +55,8 @@ public class DesignerStartupPageActivator extends Activator { DesignerStartupContext context = DesignerStartupContext.getInstance(); context.setStartupArgs(startupArgsValue.getValue()); - - if (context.isShowStartupPage()) { + // 目前先只支持启动页 + if (true) { showDesignerStartupPage(context); } else { startNonStartupPage(); diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/TenantDBAdapter4Designer.java b/designer-realize/src/main/java/com/fr/start/module/optimized/TenantDBAdapter4Designer.java index e6d4bb1fd6..de83a83d07 100644 --- a/designer-realize/src/main/java/com/fr/start/module/optimized/TenantDBAdapter4Designer.java +++ b/designer-realize/src/main/java/com/fr/start/module/optimized/TenantDBAdapter4Designer.java @@ -1,58 +1,58 @@ -package com.fr.start.module.optimized; - -import com.fanruan.carina.Carina; -import com.fanruan.dao.shell.DBContextShell; -import com.fr.config.BaseDBEnv; -import com.fr.config.dao.DaoSelectorFactory; -import com.fr.config.dao.swicter.DaoSwitcher; -import com.fr.design.DesignerEnvManager; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; -import com.fr.event.Null; -import com.fr.exit.ConfigToPropMigrator; -import com.fr.stable.db.DBContext; -import com.fr.stable.db.tenant.TenantDBAdapter; -import com.fr.start.event.LazyStartupEvent; -import com.fr.start.server.EmbedServerEvent; - -/** - * @author hades - * @version 11.0 - * Created by hades on 2022/3/7 - */ -public class TenantDBAdapter4Designer extends TenantDBAdapter { - - @Override - public void start() { - BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get()); - if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { - listenEvent(LazyStartupEvent.INSTANCE, new Listener() { - @Override - public void on(Event event, Null param) { - TenantDBAdapter4Designer.super.start(); - afterStart(); - } - }); - - listenEvent(EmbedServerEvent.BeforeStart, new Listener() { - @Override - public void on(Event event, Null param) { - if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { - EventDispatcher.fire(LazyStartupEvent.INSTANCE); - } - } - }); - - } else { - super.start(); - } - } - - private void afterStart() { - DesignerEnvManager.getEnvManager().setPropertiesUsable(false); - DaoSwitcher.executeSwitch(); - ConfigToPropMigrator.getInstance().deletePropertiesCache(); - DesignerEnvManager.getEnvManager().saveXMLFile(); - } -} +//package com.fr.start.module.optimized; +// +//import com.fanruan.carina.Carina; +//import com.fanruan.dao.shell.DBContextShell; +//import com.fr.config.BaseDBEnv; +//import com.fr.config.dao.DaoSelectorFactory; +//import com.fr.config.dao.swicter.DaoSwitcher; +//import com.fr.design.DesignerEnvManager; +//import com.fr.event.Event; +//import com.fr.event.EventDispatcher; +//import com.fr.event.Listener; +//import com.fr.event.Null; +//import com.fr.exit.ConfigToPropMigrator; +//import com.fr.stable.db.DBContext; +//import com.fr.stable.db.tenant.TenantDBAdapter; +//import com.fr.start.event.LazyStartupEvent; +//import com.fr.start.server.EmbedServerEvent; +// +///** +// * @author hades +// * @version 11.0 +// * Created by hades on 2022/3/7 +// */ +//public class TenantDBAdapter4Designer extends TenantDBAdapter { +// +// @Override +// public void start() { +// BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get()); +// if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { +// listenEvent(LazyStartupEvent.INSTANCE, new Listener() { +// @Override +// public void on(Event event, Null param) { +// TenantDBAdapter4Designer.super.start(); +// afterStart(); +// } +// }); +// +// listenEvent(EmbedServerEvent.BeforeStart, new Listener() { +// @Override +// public void on(Event event, Null param) { +// if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { +// EventDispatcher.fire(LazyStartupEvent.INSTANCE); +// } +// } +// }); +// +// } else { +// super.start(); +// } +// } +// +// private void afterStart() { +// DesignerEnvManager.getEnvManager().setPropertiesUsable(false); +// DaoSwitcher.executeSwitch(); +// ConfigToPropMigrator.getInstance().deletePropertiesCache(); +// DesignerEnvManager.getEnvManager().saveXMLFile(); +// } +//} From c713d09675fded6f93bf66746e42b0ac89c97dd8 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 31 May 2024 23:26:33 +0800 Subject: [PATCH 2/7] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E7=A7=BB=E5=8A=A8memcon?= =?UTF-8?q?fig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/boot/mem/MemConfigRepository.java | 90 +++++++++++++++++++ .../boot/mem/MemConfigRepositoryBuilder.java | 20 +++++ .../boot/pre/DesignConfigComponent.java | 4 +- 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java diff --git a/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java b/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java new file mode 100644 index 0000000000..23059ea214 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java @@ -0,0 +1,90 @@ +package com.fanruan.boot.mem; + +import com.fanruan.config.event.ConfigListener; +import com.fanruan.config.realm.ConfigRepositoryProvider; +import com.fr.log.FineLoggerFactory; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +/** + * MemConfigRealm + * + * @author rinoux + * created on 2023-06-08 + */ +public class MemConfigRepository implements ConfigRepositoryProvider { + + private final String namespace; + private final Map> configValueMap = new ConcurrentHashMap<>(); + + private final Map> configListenerMap = new ConcurrentHashMap<>(); + + public MemConfigRepository(String namespace) { + this.namespace = namespace; + } + + @Override + public String namespace() { + return namespace; + } + + @Override + public String get(String configID, String configItem, String group, boolean cache) throws Exception { + return configValueMap.computeIfAbsent(configID, k -> new ConcurrentHashMap<>()).get(configItem); + } + + @Override + public void set(String configID, String configItem, String value, String group) throws Exception { + configValueMap.computeIfAbsent(configID, k -> new ConcurrentHashMap<>()).put(configItem, value); + triggerConfigChange(configID); + } + + @Override + public void remove(String configID, String group) { + configValueMap.remove(configID); + triggerConfigChange(configID); + } + + @Override + public void removeKey(String configID, String key, String group) { + Map configItemMap = configValueMap.get(configID); + if (configItemMap!= null) { + configItemMap.remove(key); + } + triggerConfigChange(configID); + } + + @Override + public void watch(String configID, String item, String group, ConfigListener configListener) { + Set configListeners = configListenerMap.computeIfAbsent(configID, k -> Collections.synchronizedSet(new HashSet<>())); + configListeners.add(configListener); + } + + @Override + public void unWatch(String configID, String item, String group, ConfigListener configListener) { + Set configListeners = configListenerMap.get(configID); + if (configListeners != null) { + configListeners.remove(configListener); + } + } + + private void triggerConfigChange(String configID) { + Set configListeners = configListenerMap.get(configID); + if (configListeners != null) { + List configListenerList = new ArrayList<>(configListeners); + for (ConfigListener configListener : configListenerList) { + try { + configListener.onConfigChange(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + } +} 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 new file mode 100644 index 0000000000..83fc978d01 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java @@ -0,0 +1,20 @@ +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/DesignConfigComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java index 17b05094db..8b58aa2549 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java @@ -7,10 +7,10 @@ import com.fanruan.config.impl.PublicConfigProviderImpl; import com.fanruan.config.impl.ShareConfigProviderImpl; import com.fanruan.config.realm.ConfigRealm; import com.fanruan.config.realm.ConfigRepositoryFactory; -import com.fanruan.config.realm.mem.MemConfigRepositoryBuilder; +import com.fanruan.boot.mem.MemConfigRepositoryBuilder; /** - * 类解释注释 + * 设计器configprovider注册 * * @author Destiny.Lin * @since 11.0 From 7c1253e07af4a6c592e1bf0531746530a521aff4 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Sat, 1 Jun 2024 19:04:45 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E4=BF=AE=E5=A4=8DJTempl?= =?UTF-8?q?ateAuthChecker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/authority/JTemplateAuthorityChecker.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java index 7308859137..a0ed56876d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.log.FineLoggerFactory; import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.user.UserAuthority; +import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import java.util.ArrayList; @@ -53,8 +54,7 @@ public class JTemplateAuthorityChecker { allConnectionNames = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet(); - UserAuthority templateAuthority = WorkContext.getCurrent().get(UserAuthority.class); - Map> authNamesMap = templateAuthority.getAuthServerDataSetAndConnectionNames(); + Map> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName()); if (authNamesMap != null) { //有权限的数据连接名称 authConnectionNames = authNamesMap.get(UserAuthority.AUTH_CONNECTION_NAMES); From fa1398307f633ba845d9dc6e4bbd4bd6dfc79f62 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Jun 2024 14:50:03 +0800 Subject: [PATCH 4/7] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E8=B7=91=E9=80=9A?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E9=94=81=E5=AE=9A=E6=B5=81=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E9=83=A8=E5=88=86=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/TemplateTreePane.java | 27 +++++++++---------- .../file/impl/DefaultTemplateResource.java | 18 ++++++++++--- .../DesignerFrameFileDealerPane.java | 5 ++-- .../com/fr/design/mainframe/JTemplate.java | 6 +---- .../java/com/fr/env/TestConnectionResult.java | 7 +++-- .../main/java/com/fr/file/FileNodeFILE.java | 6 ++--- 6 files changed, 37 insertions(+), 32 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 36de6a75e3..306ce0f886 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -236,21 +236,20 @@ public class TemplateTreePane extends JPanel implements FileOperations { String reportPath = reportletsTree.getSelectedTemplatePath(); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); String lock = node.getLock(); - boolean showLockInfo = LockInfoUtils.isCompatibleOperator() - || LockInfoUtils.unableGetLockInfo() - || WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath) - ? (lock != null && !lock.equals(node.getUserID())) - : WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath); - if (showLockInfo) { - UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); - node.setLock(UUID.randomUUID().toString()); - // 对于开发者预览占位锁定 定位到tab中 - checkDevelopForBiddenTemplate(selectedFilePath); - LockInfoDialog.show(userInfo); - return; - } else { - node.setLock(null); + + if (!LockInfoUtils.unableGetLockInfo()) { + // 这边额外的请求数量缩减到一个,但是还是可以再合并,后续再看看怎么合并,现在先这样 + UserInfo info = TemplateRepository.getInstance().showLockInfo(selectedFilePath); + boolean showLockInfo = info.getTplUnLocked() ? (lock != null && !lock.equals(node.getUserID())) : info.getTplLocked(); + if (showLockInfo) { + node.setLock(UUID.randomUUID().toString()); + // 对于开发者预览占位锁定 定位到tab中 + checkDevelopForBiddenTemplate(selectedFilePath); + LockInfoDialog.show(info); + return; + } } + node.setLock(null); DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); } diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java index 8c54cc8cc3..96f01f231f 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java @@ -3,9 +3,16 @@ package com.fr.design.file.impl; import com.fr.file.FILE; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; +import com.fr.workspace.server.repository.template.TemplateRepository; + import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +import static com.fr.workspace.server.repository.template.AbstractTemplateSource.FROM_KEY; +import static com.fr.workspace.server.repository.template.AbstractTemplateSource.TO_KEY; /** * @author hades @@ -16,7 +23,7 @@ public class DefaultTemplateResource extends AbstractTemplateResource { @Override public InputStream readTemplate(String path) throws Exception { - return new ByteArrayInputStream(WorkContext.getCurrent().get(TplOperator.class).readAndLockFile(path)); + return new ByteArrayInputStream(TemplateRepository.getInstance().open(path)); } @Override @@ -26,17 +33,20 @@ public class DefaultTemplateResource extends AbstractTemplateResource { @Override public boolean closeTemplate(String path) { - return WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); + return TemplateRepository.getInstance().close(path); } @Override public boolean delete(FILE file) { - return WorkContext.getCurrent().get(TplOperator.class).delete(file.getPath()); + return TemplateRepository.getInstance().delete(file.getPath()); } @Override public boolean rename(String from, String to) { - return WorkContext.getCurrent().get(TplOperator.class).rename(from, to); + Map fromTo = new HashMap<>(); + fromTo.put(FROM_KEY, from); + fromTo.put(TO_KEY, to); + return TemplateRepository.getInstance().rename(fromTo); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 8cfd263421..f3ab77cf4d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -62,6 +62,8 @@ import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.report.lock.LockInfoOperator; +import com.fr.workspace.server.repository.template.TemplateRepository; + import javax.swing.BorderFactory; import javax.swing.JDialog; import javax.swing.JOptionPane; @@ -622,8 +624,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt && !ComparatorUtils.equals(fileNode.getLock(), fileNode.getUserID()); boolean visible = locked && WorkContext.getCurrent().isRoot() - && WorkContext.getCurrent().get(LockInfoOperator.class).isUnLockable() - && !WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(fileNode.getEnvPath()); + && TemplateRepository.getInstance().isRootUnlockAble(fileNode.getEnvPath()); rightToolBar.setVisible(visible); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 74ec97605f..24c543a00a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -1044,11 +1044,7 @@ public abstract class JTemplate> } protected void checkBeforeSave() throws Exception { - // 过滤掉本地文件 - boolean localFile = getEditingFILE() instanceof FileFILE; - if (!localFile && getEditingFILE().exists()) { - throw new InconsistentLockException(); - } + // 判断需要再看下 } public byte[] exportData() throws Exception { diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 1dee557980..b7a0ba795b 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -1,7 +1,5 @@ package com.fr.env; -import com.fr.decision.webservice.exception.login.UserLoginLockException; -import com.fr.decision.webservice.exception.login.UserPasswordNeedUpdateException; import com.fr.decision.webservice.exception.user.UserPasswordStrengthLimitException; import com.fr.design.i18n.Toolkit; import com.fr.exception.RemoteDesignPermissionDeniedException; @@ -100,7 +98,7 @@ public enum TestConnectionResult { @Override public String errorCode() { - return UserLoginLockException.ERROR_CODE; + return "UserLoginLockException.ERROR_CODE"; } @Override @@ -175,7 +173,8 @@ public enum TestConnectionResult { @Override public String errorCode() { - return UserPasswordNeedUpdateException.ERROR_CODE; + // todo result具体逻辑需要同产品确认 + return "UserPasswordNeedUpdateException.ERROR_CODE"; } @Override diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index 0c3d33bcc0..438e9c6b17 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -428,9 +428,9 @@ public class FileNodeFILE implements FILE { if (!envPath.startsWith(ProjectConstants.REPORTLETS_NAME)) { return; } - - FRContext.getCommonOperator().unlockTemplate( - envPath.substring(ProjectConstants.REPORTLETS_NAME.length() + 1)); + // 看上去好像没用了 + //FRContext.getCommonOperator().unlockTemplate( + // envPath.substring(ProjectConstants.REPORTLETS_NAME.length() + 1)); } /** From daa4524e6871535eb220ffcf3f3c181ec0565dc4 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Jun 2024 14:52:20 +0800 Subject: [PATCH 5/7] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/boot/pre/DesignPluginSupplementComponent.java | 5 ++++- .../java/com/fanruan/boot/pre/DesignPreStartComponent.java | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java index 1eae91ade1..62cd3eca3d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java @@ -7,7 +7,7 @@ import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Supplemental; /** - * 类解释注释 + * 设计器需要先注册setCarinaPluginProvider,才能做具体的EnvManager的加载 * * @author Destiny.Lin * @since 11.0 @@ -17,6 +17,9 @@ import com.fanruan.carina.annotions.Supplemental; @DependsOn(dependencies = {"design_tenant", "design_universal_config"}) public class DesignPluginSupplementComponent extends PluginComponent { + /** + * start + */ @Start public void start() { super.prepare(); 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 d837682521..ede19bfe1d 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 @@ -53,7 +53,9 @@ import java.util.concurrent.CompletableFuture; public class DesignPreStartComponent { - + /** + * start + */ @Start public void start() { DesignerEnvManager.getEnvManager(); From 92dc5f350d5f6be1d0ff6b8f50029861e8b6c2fe Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Jun 2024 19:45:31 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83+=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=B3=BB=E7=BB=9F+=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E8=87=AA=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConfigManager.java | 2 +- .../design/data/DesignTableDataManager.java | 22 ++++++++++- .../fr/design/data/datapane/ChoosePane.java | 2 +- .../preview/sql/PreviewPerformedSqlPane.java | 3 +- .../tabledata/wrapper/TableDataFactory.java | 3 +- .../fr/design/env/HttpWorkspaceConnector.java | 3 ++ .../versioncheck/VersionCheckUtils.java | 2 +- .../java/com/fr/env/TestConnectionResult.java | 2 +- .../chart/map/designer/type/WMSLayerPane.java | 3 +- .../fanruan/boot/mem/MemConfigRepository.java | 1 + .../boot/pre/DesignConfigComponent.java | 3 ++ .../fanruan/boot/show/DesignFsComponent.java | 39 +++++++++++++++++++ .../fanruan/boot/show/DesignerComponent.java | 2 +- .../mainframe/InformationCollector.java | 2 +- .../main/java/com/fr/start/SplashContext.java | 2 +- 15 files changed, 79 insertions(+), 12 deletions(-) create mode 100644 designer-realize/src/main/java/com/fanruan/boot/show/DesignFsComponent.java diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index ecf179e4c0..0fbea9b6f6 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -136,7 +136,7 @@ public class AlphaFineConfigManager implements XMLable { public static boolean isALPHALicAvailable() { - // todo lic相关的被拆分了,需要再适配一下lic的api + // lic相关的被拆分了,需要再适配一下lic的api return true; } diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 5a13ce2adc..9bde927d8f 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -39,6 +39,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import com.fr.stable.xml.XMLPrintWriter; +import com.fr.workspace.server.entity.tabledata.PreviewDataBean; +import com.fr.workspace.server.repository.tabledata.TableDataRepository; import javax.swing.JFrame; import javax.swing.event.ChangeEvent; @@ -570,7 +572,12 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount); + PreviewDataBean bean = new PreviewDataBean(); + TableDataSource source = TableDataSourceTailor.extractTableData(tableDataSource); + bean.setDataSource(source); + bean.setDataName(getTableDataName(source, tabledata)); + bean.setParameterMap(parameterMap); + return (EmbeddedTableData) TableDataRepository.getInstance().previewTableData(bean).getTableData(); } catch (Exception e) { throw new TableDataException(e.getMessage(), e); } finally { @@ -692,4 +699,17 @@ public abstract class DesignTableDataManager { public static boolean isGlobalTableData(String tableDataName) { return globalDsCache.containsKey(tableDataName); } + + private static String getTableDataName(TableDataSource source, TableData data) { + Iterator tableDataNameIterator = source.getTableDataNameIterator(); + while (tableDataNameIterator.hasNext()) { + String tableDataName = (String) tableDataNameIterator.next(); + TableData tableData = source.getTableData(tableDataName); + if (tableData.equals(data)) { + return tableDataName; + } + } + + return StringUtils.EMPTY; + } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index 09503086f8..8ab88bbf99 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -336,7 +336,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha private List getHasAuthConnections() { List authConnections = new ArrayList<>(); Set allConnections = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet(); - // todo 待实现 + // 待实现 Collection noAuthConnections = new ArrayList<>(); if (noAuthConnections == null) { return authConnections; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java index f76ec5a4a2..72ed0808b9 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java @@ -191,7 +191,8 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { Parameter[] paras = processParameters(tableData, calculator); // 所有被转义参数的集合 refreshEscapeSqlHelper(); - // todo 待实现[check]EscapeSqlHelper.getInstance().getSpecialCharParam(paras); + // 待实现 + // [check]EscapeSqlHelper.getInstance().getSpecialCharParam(paras); Set specialCharParam = new HashSet<>(); // 将参数转义等 diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index ab652177e4..d9b03ba7f1 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -8,7 +8,6 @@ import com.fr.data.impl.DBTableData; import com.fr.data.impl.DecoratedTableData; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.FileTableData; -//import com.fr.data.impl.MultiFieldTableData; import com.fr.data.impl.MultiTDTableData; import com.fr.data.impl.RecursionTableData; import com.fr.data.impl.storeproc.StoreProcedure; @@ -64,7 +63,7 @@ public abstract class TableDataFactory { defaultMap.put(MultiTDTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/multi_normal.svg", MultiTDTableData.class, MultiTDTableDataPane.class)); defaultMap.put(FileTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/file_normal.svg", FileTableData.class, FileTableDataPane.class)); defaultMap.put(RecursionTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/tree_normal.svg", RecursionTableData.class, TreeTableDataPane.class)); - // todo 待实现 + // 待实现 //defaultMap.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/database_normal.svg", MultiFieldTableData.class, null)); map.putAll(defaultMap); } diff --git a/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java b/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java index 4326ea366d..d2a708e390 100644 --- a/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java +++ b/designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java @@ -24,6 +24,9 @@ import java.util.UUID; public class HttpWorkspaceConnector implements WorkspaceConnector { private static final HttpWorkspaceConnector INSTANCE = new HttpWorkspaceConnector(); + /** + * 获取单例 + */ public static HttpWorkspaceConnector getInstance() { return INSTANCE; diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index 77c5cc6229..07bd8dd0cc 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -198,7 +198,7 @@ public class VersionCheckUtils { public static String getRemoteBranch(DesignerWorkspaceInfo selectedEnv) { String remoteBranch; - // todo 微服务的branch还不确定,后面适配 + // 微服务的branch还不确定,后面适配 //remoteBranch = WorkContext.getCurrent().get(VersionInfoOperator.class, new ExceptionHandler() { // @Override // public String callHandler(RPCInvokerExceptionInfo exceptionInfo) { diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index b7a0ba795b..564039a254 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -173,7 +173,7 @@ public enum TestConnectionResult { @Override public String errorCode() { - // todo result具体逻辑需要同产品确认 + // result具体逻辑需要同产品确认 return "UserPasswordNeedUpdateException.ERROR_CODE"; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java index 66b906ee52..aa5ce8ed50 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -88,7 +88,8 @@ public class WMSLayerPane extends JPanel implements UIObserver { @Override protected Void doInBackground() { - // todo 待实现[check]MapEditService.getInstance().getWMSNames(wmsUrl.getText()); + // 待实现 + // MapEditService.getInstance().getWMSNames(wmsUrl.getText()); List wmsNames = new ArrayList<>(); list.clear(); for (String layer : wmsNames) { diff --git a/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java b/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java index 23059ea214..c88241794d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java +++ b/designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java @@ -16,6 +16,7 @@ import java.util.concurrent.ConcurrentHashMap; * MemConfigRealm * * @author rinoux + * @since 11.0 * created on 2023-06-08 */ public class MemConfigRepository implements ConfigRepositoryProvider { diff --git a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java index 8b58aa2549..6282d0c85b 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java @@ -19,6 +19,9 @@ import com.fanruan.boot.mem.MemConfigRepositoryBuilder; @FineComponent(name = "design_universal_config") public class DesignConfigComponent { + /** + * start,注册config并设置基础的memConfigBuilder + */ @Start public void start() { ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.SHARE, new ShareConfigProviderImpl()); diff --git a/designer-realize/src/main/java/com/fanruan/boot/show/DesignFsComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignFsComponent.java new file mode 100644 index 0000000000..43555a7fbb --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignFsComponent.java @@ -0,0 +1,39 @@ +package com.fanruan.boot.show; + +import com.fanruan.boot.FileServerComponent; +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.fs.FileServer; +import com.fr.io.utils.ResourceIOUtils; + +/** + * 设计器文件系统初始化 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/6/4 + */ +@FineComponent(name = "design_fs") +@DependsOn(dependencies = {"design_conf_config"}) +public class DesignFsComponent extends FileServerComponent { + + /** + * start + */ + @Start + public void start() throws Exception { + super.start(); + } + + + /** + * start + */ + @Stop + private void stop() { + ResourceIOUtils.setUnderlying(FileServer.local()); + ResourceIOUtils.setIsolationMode(true); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java index 72dfb30253..db3659e5b4 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java @@ -18,7 +18,7 @@ import com.fr.start.module.DesignerESDActivator; * Created on 2024/5/28 */ @FineComponent(name = "design") -@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config", "design_function"}) +@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config","design_fs", "design_function"}) @ActivatorRefer(refer = {DesignerActivator.class, DesignerAppActivator.class, ChartDesignerActivator.class, DesignerESDActivator.class, DesignerAnalyzerActivator.class}) public class DesignerComponent { } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index e1a6914b04..faf01f9f30 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -143,7 +143,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { */ public void collectStartTime() { this.current.setStartDate(dateToString()); - // todo 收集信息先关掉,后面再适配 + // 收集信息先关掉,后面再适配 //sendInfo(); } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index e89d3eb51a..bda4f4f783 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -152,7 +152,7 @@ public class SplashContext { */ private void showThanks() { if (shouldShowThanks() && !hasShowThanks) { - // todo 涉及到云中心的都先放着 + // 涉及到云中心的都先放着 //tryFetchOnline(); if (StringUtils.isNotEmpty(guest)) { updateThanksLog(THANKS + guest); From 98bf268e040906f5e811500dc3fa4f5345923549 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Jun 2024 19:51:33 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-114391=20=E3=80=90=E5=BE=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=80=82=E9=85=8D=E3=80=91=E8=BF=9C=E7=A8=8B&?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=83=BD=E5=A4=9F?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=90=AF=E5=8A=A8=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/preview/sql/PreviewPerformedSqlPane.java | 2 +- .../com/fr/design/data/tabledata/wrapper/TableDataFactory.java | 2 +- .../main/java/com/fr/design/versioncheck/VersionCheckUtils.java | 2 +- .../java/com/fr/van/chart/map/designer/type/WMSLayerPane.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java index 72ed0808b9..7ee2a1dfdd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java @@ -191,7 +191,7 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener { Parameter[] paras = processParameters(tableData, calculator); // 所有被转义参数的集合 refreshEscapeSqlHelper(); - // 待实现 + /// 待实现 // [check]EscapeSqlHelper.getInstance().getSpecialCharParam(paras); Set specialCharParam = new HashSet<>(); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index d9b03ba7f1..92936f0094 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -63,7 +63,7 @@ public abstract class TableDataFactory { defaultMap.put(MultiTDTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/multi_normal.svg", MultiTDTableData.class, MultiTDTableDataPane.class)); defaultMap.put(FileTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/file_normal.svg", FileTableData.class, FileTableDataPane.class)); defaultMap.put(RecursionTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/tree_normal.svg", RecursionTableData.class, TreeTableDataPane.class)); - // 待实现 + /// 待实现 //defaultMap.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/database_normal.svg", MultiFieldTableData.class, null)); map.putAll(defaultMap); } diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index 07bd8dd0cc..e66d5923f8 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -198,7 +198,7 @@ public class VersionCheckUtils { public static String getRemoteBranch(DesignerWorkspaceInfo selectedEnv) { String remoteBranch; - // 微服务的branch还不确定,后面适配 + /// 微服务的branch还不确定,后面适配 //remoteBranch = WorkContext.getCurrent().get(VersionInfoOperator.class, new ExceptionHandler() { // @Override // public String callHandler(RPCInvokerExceptionInfo exceptionInfo) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java index aa5ce8ed50..218dd02294 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -88,7 +88,7 @@ public class WMSLayerPane extends JPanel implements UIObserver { @Override protected Void doInBackground() { - // 待实现 + /// 待实现 // MapEditService.getInstance().getWMSNames(wmsUrl.getText()); List wmsNames = new ArrayList<>(); list.clear();