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 3f37d87515..1905a6c5d8 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -444,12 +444,35 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private static File envFile = null; private File getEnvFile() { + checkDebugStart(); if (envFile == null) { envFile = new File(ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env.xml"); } return envFile; } + /** + * 在VM options里加入-Ddebug=true激活 + */ + private static void checkDebugStart() { + + if (ComparatorUtils.equals("true", System.getProperty("debug"))) { + setDebugEnv(); + } + } + + /** + * 端口改一下,环境配置文件改一下。便于启动两个设计器,进行对比调试 + */ + private static void setDebugEnv() { + + DesignUtils.setPort(DesignerPort.getInstance().getDebugMessagePort()); + DesignerEnvManager.setEnvFile(new File(StableUtils.pathJoin( + ProductConstants.getEnvHome(), + ProductConstants.APP_NAME + "Env_debug.xml" + ))); + } + /** * 是否启用了https * @@ -679,8 +702,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } public boolean isPropertiesUsable() { - // todo - return false; + return this.propertiesUsable; } public void setPropertiesUsable(boolean propertiesUsable) { @@ -1911,6 +1933,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); this.setUseOptimizedUPM4Adapter(reader.getAttrAsBoolean("useOptimizedUPM4Adapter", SupportOSImpl.MACOS_12_VERSION_ADAPTER.support())); + this.setPropertiesUsable(reader.getAttrAsBoolean("propertiesUsable", false)); this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true)); this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE)); } @@ -2189,6 +2212,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle()); writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip()); writer.attr("useOptimizedUPM4Adapter", this.isUseOptimizedUPM4Adapter()); + writer.attr("propertiesUsable", this.isPropertiesUsable()); writer.end(); } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java index 646a9a49c2..46218b91af 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java @@ -3,7 +3,6 @@ package com.fr.start.module; import com.fr.base.OptimizeUtil; import com.fr.concurrent.NamedThreadFactory; -import com.fr.config.dao.DaoSelector; import com.fr.config.dao.DaoSelectorFactory; import com.fr.decision.webservice.v10.encryption.EncryptionConstants; import com.fr.design.DesignerEnvManager; @@ -11,7 +10,6 @@ import com.fr.design.RestartHelper; import com.fr.design.dialog.TipDialog; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; -import com.fr.design.fun.OemProcessor; import com.fr.design.fun.impl.GlobalListenerProviderManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; @@ -24,23 +22,17 @@ import com.fr.event.Event; import com.fr.event.Listener; import com.fr.event.Null; import com.fr.exit.DesignerExiter; -import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; -import com.fr.module.extension.Prepare; import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.Metrics; import com.fr.stable.ArrayUtils; import com.fr.stable.BuildContext; -import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import com.fr.start.DesignerProcessType; import com.fr.start.ServerStarter; -import com.fr.start.SplashContext; -import com.fr.start.SplashStrategy; -import com.fr.start.common.SplashCommon; import com.fr.start.event.LazyStartupEvent; import com.fr.start.server.FineEmbedServer; import com.fr.value.NotNullLazyValue; @@ -66,10 +58,6 @@ public class DesignerStartup extends Activator { @Override public void beforeAllStart() { BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); - // 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件 - checkDebugStart(); - // 都是在启动过程中读取,这边提前初始化xml配置 - DesignerEnvManager.getEnvManager(); registerDaoSelector(); @@ -163,16 +151,6 @@ public class DesignerStartup extends Activator { } } - /** - * 在VM options里加入-Ddebug=true激活 - */ - private void checkDebugStart() { - - if (ComparatorUtils.equals("true", System.getProperty("debug"))) { - setDebugEnv(); - } - } - private void registerDaoSelector() { // 注入设计器db cache 是否可用 DesignerWorkspaceInfo info = WorkspaceUtils.getWorkspaceInfo(); @@ -188,18 +166,6 @@ public class DesignerStartup extends Activator { } } - /** - * 端口改一下,环境配置文件改一下。便于启动两个设计器,进行对比调试 - */ - private void setDebugEnv() { - - DesignUtils.setPort(DesignerPort.getInstance().getDebugMessagePort()); - DesignerEnvManager.setEnvFile(new File(StableUtils.pathJoin( - ProductConstants.getEnvHome(), - ProductConstants.APP_NAME + "Env_debug.xml" - ))); - } - @Override public void stop() { // void diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/ReportBaseActivator4Designer.java b/designer-realize/src/main/java/com/fr/start/module/optimized/ReportBaseActivator4Designer.java new file mode 100644 index 0000000000..fcb2260f59 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/start/module/optimized/ReportBaseActivator4Designer.java @@ -0,0 +1,32 @@ +package com.fr.start.module.optimized; + +import com.fr.config.dao.DaoSelectorFactory; +import com.fr.event.Event; +import com.fr.event.Listener; +import com.fr.event.Null; +import com.fr.report.module.ReportBaseActivator; +import com.fr.start.event.LazyStartupEvent; + +/** + * @author hades + * @version 11.0 + * Created by hades on 2022/3/16 + */ +public class ReportBaseActivator4Designer extends ReportBaseActivator { + + @Override + protected void VcsInit() { + if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { + listenEvent(LazyStartupEvent.INSTANCE, new Listener() { + @Override + public void on(Event event, Null param) { + ReportBaseActivator4Designer.super.VcsInit(); + } + }); + } else { + super.VcsInit(); + } + + + } +} 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 25e609ded0..d45913e1aa 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 @@ -34,9 +34,9 @@ public class TenantDBAdapter4Designer extends TenantDBAdapter { } private void afterStart() { + DesignerEnvManager.getEnvManager().setPropertiesUsable(false); DaoSwitcher.executeSwitch(); ConfigToPropMigrator.getInstance().deletePropertiesCache(); - DesignerEnvManager.getEnvManager().setPropertiesUsable(false); DesignerEnvManager.getEnvManager().saveXMLFile(); } }