From 0a54abe4727ff07eb2ae843eddf0bf140e00374b Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 27 Jan 2021 10:37:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-45901=20=E3=80=9010.0.14=E3=80=91?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=A4=9A=E5=BC=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 6 +++ .../design/fun/DesignerLifecycleMonitor.java | 31 ++++++++++++ .../fr/design/fun/DesignerPortProvider.java | 31 ++++++++++++ .../DesignerLifecycleMonitorContext.java | 47 +++++++++++++++++++ .../com/fr/design/utils/DesignerPort.java | 7 ++- .../main/java/com/fr/exit/DesignerExiter.java | 4 +- .../main/java/com/fr/start/BaseDesigner.java | 2 + .../main/java/com/fr/start/MainDesigner.java | 2 + 8 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 791d679b30..4adcfc1b34 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -15,6 +15,7 @@ import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.fun.DesignerPortProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; @@ -42,6 +43,7 @@ import com.fr.stable.ListMap; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.core.UUID; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; @@ -842,6 +844,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回Jetty服务器的端口号 */ public int getEmbedServerPort() { + DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); + if (portProvider != null) { + return portProvider.embeddedServerPort(); + } return this.jettyServerPort; } diff --git a/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java b/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java new file mode 100644 index 0000000000..812ef8ac67 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/DesignerLifecycleMonitor.java @@ -0,0 +1,31 @@ +package com.fr.design.fun; + +/** + * 设计器生命周期接口 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/1/26 + */ +public interface DesignerLifecycleMonitor { + + String MARK_STRING = "DesignerLifecycleMonitor"; + + int CURRENT_LEVEL = 1; + + /** + * 设计器启动之前 + */ + void beforeStart(); + + /** + * 设计器启动完成 界面出现之后 + */ + void afterStart(); + + /** + * 设计器关闭退出之前 + */ + void beforeStop(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java b/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java new file mode 100644 index 0000000000..2b0178c613 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/DesignerPortProvider.java @@ -0,0 +1,31 @@ +package com.fr.design.fun; + +/** + * 设计器所有端口获取 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/1/18 + */ +public interface DesignerPortProvider { + + String MARK_STRING = "DesignerPortProvider"; + + int CURRENT_LEVEL = 1; + + + /** + * 设计器自身端口 + * + * @return + */ + int messagePort(); + + /** + * 内置服务器端口 + * + * @return + */ + int embeddedServerPort(); + +} diff --git a/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java b/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java new file mode 100644 index 0000000000..a50a048197 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/monitor/DesignerLifecycleMonitorContext.java @@ -0,0 +1,47 @@ +package com.fr.design.monitor; + +import com.fr.design.fun.DesignerLifecycleMonitor; +import com.fr.stable.bridge.StableFactory; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/27 + */ +public class DesignerLifecycleMonitorContext { + + private static DesignerLifecycleMonitor monitor; + + static { + DesignerLifecycleMonitor designerLifecycleMonitor = StableFactory.getMarkedInstanceObjectFromClass(DesignerLifecycleMonitor.MARK_STRING, DesignerLifecycleMonitor.class); + if (designerLifecycleMonitor != null) { + monitor = designerLifecycleMonitor; + } else { + monitor = new EmptyDesignerLifecycleMonitor(); + } + } + + public static DesignerLifecycleMonitor getMonitor() { + return monitor; + } + + static class EmptyDesignerLifecycleMonitor implements DesignerLifecycleMonitor { + + @Override + public void beforeStart() { + + } + + @Override + public void afterStart() { + + } + + @Override + public void beforeStop() { + + } + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 1ad1948bfa..474c29a8f5 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -4,6 +4,7 @@ import com.fr.common.report.ReportState; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.TipDialog; +import com.fr.design.fun.DesignerPortProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; @@ -13,10 +14,10 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; -import com.fr.process.ProcessEventPipe; import com.fr.process.engine.core.CarryMessageEvent; import com.fr.process.engine.core.FineProcessContext; import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLWriter; @@ -58,6 +59,10 @@ public class DesignerPort implements XMLReadable, XMLWriter { private int debugMessagePort = 51463; public int getMessagePort() { + DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); + if (portProvider != null) { + return portProvider.messagePort(); + } return messagePort; } diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java index b9067a22ee..cda2e015b0 100644 --- a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -1,10 +1,9 @@ package com.fr.exit; import com.fr.design.env.DesignerWorkspaceGenerator; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessEngineEvent; -import com.fr.stable.StableUtils; - /** * @author hades @@ -20,6 +19,7 @@ public class DesignerExiter { } public void execute() { + DesignerLifecycleMonitorContext.getMonitor().beforeStop(); beforeExit(); if (FineProcessContext.getParentPipe() != null) { FineProcessContext.getParentPipe().syncFire(FineProcessEngineEvent.DESTROY); diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 7808bd7ecd..5eaab74a52 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -14,6 +14,7 @@ import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.ui.util.UIUtil; import com.fr.event.Event; import com.fr.event.EventDispatcher; @@ -75,6 +76,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { @Override public void on(Event event, Null param) { + DesignerLifecycleMonitorContext.getMonitor().afterStart(); EventDispatcher.stopListen(this); // 启动完成 停止监听 ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index a9a1ccbd15..162a2044f4 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -36,6 +36,7 @@ import com.fr.design.menu.ShortCut; import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartPreStyleAction; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.Event; @@ -102,6 +103,7 @@ public class MainDesigner extends BaseDesigner { StopWatch watch = new StopWatch(); watch.start(); + DesignerLifecycleMonitorContext.getMonitor().beforeStart(); //启动运行时 FineRuntime.start(); DesignerSubListener.getInstance().start(); From 1f5f4613a1f8d589b43e8643f3af04739d763e0d Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 27 Jan 2021 11:40:29 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-45901=20=E3=80=9010.0.14=E3=80=91oem?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=A4=9A=E5=BC=80=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20--=E5=8A=A0=E4=B8=8A=E7=AB=AF=E5=8F=A3=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 7 ++-- .../fr/design/port/DesignerPortContext.java | 32 +++++++++++++++++++ .../com/fr/design/utils/DesignerPort.java | 11 ++++--- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 4adcfc1b34..b8951ea8ba 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -20,6 +20,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; +import com.fr.design.port.DesignerPortContext; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; @@ -844,9 +845,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回Jetty服务器的端口号 */ public int getEmbedServerPort() { - DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); - if (portProvider != null) { - return portProvider.embeddedServerPort(); + int embeddedServerPort = DesignerPortContext.getEmbeddedServerPort(); + if (embeddedServerPort >= DesignerPort.MIN_PORT && embeddedServerPort <= DesignerPort.MAX_PORT) { + return embeddedServerPort; } return this.jettyServerPort; } diff --git a/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java b/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java new file mode 100644 index 0000000000..e1e40ddfb0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java @@ -0,0 +1,32 @@ +package com.fr.design.port; + +import com.fr.design.fun.DesignerPortProvider; +import com.fr.stable.bridge.StableFactory; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/27 + */ +public class DesignerPortContext { + + private static int messagePort = -1; + + private static int embeddedServerPort = -1; + + static { + DesignerPortProvider designerPortProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); + if (designerPortProvider != null) { + messagePort = designerPortProvider.messagePort(); + embeddedServerPort = designerPortProvider.embeddedServerPort(); + } + } + + public static int getMessagePort() { + return messagePort; + } + + public static int getEmbeddedServerPort() { + return embeddedServerPort; + } +} diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 474c29a8f5..28ab5e4c14 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.port.DesignerPortContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; @@ -36,8 +37,8 @@ import java.awt.event.ActionListener; public class DesignerPort implements XMLReadable, XMLWriter { public static final String XML_TAG = "DesignerPort"; - private static final int MIN_PORT = 1024; - private static final int MAX_PORT = 65535; + public static final int MIN_PORT = 1024; + public static final int MAX_PORT = 65535; public static final DesignerPort INSTANCE = new DesignerPort(); @@ -59,9 +60,9 @@ public class DesignerPort implements XMLReadable, XMLWriter { private int debugMessagePort = 51463; public int getMessagePort() { - DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); - if (portProvider != null) { - return portProvider.messagePort(); + int extraMessagePort = DesignerPortContext.getMessagePort(); + if (extraMessagePort >= MIN_PORT && extraMessagePort <= MAX_PORT) { + return extraMessagePort; } return messagePort; } From 8173e27685e900e81f3270ee477c244678f55b6f Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 27 Jan 2021 14:56:27 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-43833=20=E3=80=9010.0.14=E3=80=91?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=A2=9E=E5=8A=A0=E9=94=81=E5=AE=9A=20=E6=BC=8F?= =?UTF-8?q?=E6=8E=89=E4=BA=86=E8=BF=99=E4=B8=AApanel=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E8=A7=A3=E9=94=81=E6=94=BE=E5=88=B0aftercommit()=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/ConnectionComboBoxPanel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index afd65f3e52..d441984c28 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -144,8 +144,6 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { connectionListDialog.setDoOKSucceed(false); return; } - // 关闭定义数据连接页面,为其解锁 - EditLockUtils.unlock(LockItem.CONNECTION); Configurations.modify(new WorkerFacade(ConnectionConfig.class) { @Override public void run() { @@ -161,6 +159,8 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { @Override public void afterCommit() { DesignerContext.getDesignerBean("databasename").refreshBeanElement(); + // 关闭定义数据连接页面,为其解锁 + EditLockUtils.unlock(LockItem.CONNECTION); } }));