From 8fea3f321817e90b959163a1afd0479cb231d340 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 25 Apr 2022 17:23:18 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-70206=20=E5=A4=84=E7=90=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=83=85=E5=86=B5=20=E6=89=8B=E5=8A=A8=E5=88=A0?= =?UTF-8?q?=E9=99=A4prop=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/start/module/DesignerStartup.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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 46218b91a..e2c85ea6f 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 @@ -4,6 +4,7 @@ package com.fr.start.module; import com.fr.base.OptimizeUtil; import com.fr.concurrent.NamedThreadFactory; import com.fr.config.dao.DaoSelectorFactory; +import com.fr.config.dao.PropertiesConstants; import com.fr.decision.webservice.v10.encryption.EncryptionConstants; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; @@ -28,6 +29,7 @@ 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.CommonUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -36,6 +38,7 @@ import com.fr.start.ServerStarter; import com.fr.start.event.LazyStartupEvent; import com.fr.start.server.FineEmbedServer; import com.fr.value.NotNullLazyValue; +import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -157,15 +160,28 @@ public class DesignerStartup extends Activator { if (info.getType() == DesignerWorkspaceType.Remote) { DaoSelectorFactory.registerDaoSelector(() -> false); } else { - String dbConfigPath = StableUtils.pathJoin(WorkspaceUtils.getWorkspaceInfo().getPath(), ProjectConstants.CONFIG_DIRECTORY, + String webInfPath = WorkspaceUtils.getWorkspaceInfo().getPath(); + String dbConfigPath = StableUtils.pathJoin(webInfPath, ProjectConstants.CONFIG_DIRECTORY, EncryptionConstants.PROPERTY_NAME); - // + String entityPath = generatePath(webInfPath, PropertiesConstants.ENTITY_PROP); + String xmlEntityPath = generatePath(webInfPath, PropertiesConstants.XML_ENTITY_PROP); + String classNamePath = generatePath(webInfPath, PropertiesConstants.CLASS_NAME_PROP); + // 校验 平台迁移文件/缓存文件 + boolean existPropCache = new File(entityPath).exists() && new File(xmlEntityPath).exists() && new File(classNamePath).exists(); DaoSelectorFactory.registerDaoSelector(() -> DesignerEnvManager.getEnvManager().isPropertiesUsable() && OptimizeUtil.isOpen() + && existPropCache && !new File(dbConfigPath).exists()); + } } + private String generatePath(String webInfPath, String name) { + return StableUtils.pathJoin(webInfPath, ProjectConstants.EMBED_DB_DIRECTORY, + ProjectConstants.PROPERTIES_CACHE_FOR_CONFIG, name); + } + + @Override public void stop() { // void