Browse Source

REPORT-70206 处理异常情况 手动删除prop设计器启动失败

feature/x
hades 3 years ago
parent
commit
8fea3f3218
  1. 20
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

20
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.base.OptimizeUtil;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.dao.DaoSelectorFactory; import com.fr.config.dao.DaoSelectorFactory;
import com.fr.config.dao.PropertiesConstants;
import com.fr.decision.webservice.v10.encryption.EncryptionConstants; import com.fr.decision.webservice.v10.encryption.EncryptionConstants;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
@ -28,6 +29,7 @@ import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics; import com.fr.record.analyzer.Metrics;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.BuildContext; import com.fr.stable.BuildContext;
import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; 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.event.LazyStartupEvent;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.value.NotNullLazyValue; import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
@ -157,15 +160,28 @@ public class DesignerStartup extends Activator {
if (info.getType() == DesignerWorkspaceType.Remote) { if (info.getType() == DesignerWorkspaceType.Remote) {
DaoSelectorFactory.registerDaoSelector(() -> false); DaoSelectorFactory.registerDaoSelector(() -> false);
} else { } 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); 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() DaoSelectorFactory.registerDaoSelector(() -> DesignerEnvManager.getEnvManager().isPropertiesUsable()
&& OptimizeUtil.isOpen() && OptimizeUtil.isOpen()
&& existPropCache
&& !new File(dbConfigPath).exists()); && !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 @Override
public void stop() { public void stop() {
// void // void

Loading…
Cancel
Save