Browse Source

REPORT-114392 FR-FBP版本本地设计适配 修复国际化

mss/2.0
Destiny.Lin 6 months ago
parent
commit
e17feb7436
  1. 5
      designer-base/src/main/java/com/fr/design/ConfigHelper.java
  2. 2
      designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java
  3. 49
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java

5
designer-base/src/main/java/com/fr/design/ConfigHelper.java

@ -94,7 +94,10 @@ public class ConfigHelper {
return properties; return properties;
} }
private static boolean createFile(File file) throws ResourceIOException { /**
* 创建配置文件
*/
public static boolean createFile(File file) throws ResourceIOException {
String parent = file.getParent(); String parent = file.getParent();
if (StringUtils.isNotEmpty(parent)) { if (StringUtils.isNotEmpty(parent)) {
createDirectory(parent); createDirectory(parent);

2
designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java

@ -45,6 +45,7 @@ import com.fr.locale.InterMutableKey;
import com.fr.locale.LocaleMarker; import com.fr.locale.LocaleMarker;
import com.fr.locale.LocaleScope; import com.fr.locale.LocaleScope;
import com.fr.locale.LocaleUtils; import com.fr.locale.LocaleUtils;
import com.fr.locale.international.InternationalLocaleManager;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.measure.DBMeterFactory; import com.fr.measure.DBMeterFactory;
import com.fr.record.DefaultDBMeter; import com.fr.record.DefaultDBMeter;
@ -146,6 +147,7 @@ public class DesignPreLoadComponent {
} }
FrontProviderImpl.init(InterProviderImpl.getInstance()); FrontProviderImpl.init(InterProviderImpl.getInstance());
InternationalLocaleManager.getInstance().init();
} }

49
designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java

@ -1,5 +1,10 @@
package com.fanruan.boot.pre; package com.fanruan.boot.pre;
import com.fanruan.boot.FSProperties;
import com.fanruan.fs.FileServer;
import com.fanruan.fs.RepositoryFactory;
import com.fanruan.fs.repository.local.LocalFileRepository;
import com.fanruan.product.ProductConstants;
import com.fr.design.ConfigHelper; import com.fr.design.ConfigHelper;
import com.fanruan.boot.key.StartupArgsShell; import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina; import com.fanruan.carina.Carina;
@ -31,11 +36,17 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.general.CommonIOUtils; import com.fr.general.CommonIOUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.io.base.ResourcePaths;
import com.fr.io.repository.ResourceRepository;
import com.fr.io.repository.ResourceRepositoryWrapper;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.engine.event.LifecycleErrorEvent; import com.fr.module.engine.event.LifecycleErrorEvent;
import com.fr.runtime.FineRuntime; import com.fr.runtime.FineRuntime;
import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonCodeUtils;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.lifecycle.FineLifecycleFatalError; import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.resource.ResourceLoader; import com.fr.stable.resource.ResourceLoader;
@ -56,6 +67,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -72,6 +84,9 @@ public class DesignPreStartComponent {
private static final String SEPARATOR = "/"; private static final String SEPARATOR = "/";
private static final String CPT = ".cpt"; private static final String CPT = ".cpt";
private static final String XML = ".xml"; private static final String XML = ".xml";
private static final String PRE_FILE_ROOT = ProductConstants.getEnvHome() + File.separator + "prefile";
private static final String PRE_FILE = PRE_FILE_ROOT + File.separator + "check";
/** /**
* 启动 * 启动
@ -84,10 +99,38 @@ public class DesignPreStartComponent {
startTenant(); startTenant();
// 3.pluginPrepare,注册插件的反向依赖 // 3.pluginPrepare,注册插件的反向依赖
startPluginPrepare(); startPluginPrepare();
// 4.正式启动 // 4.mq
startPre();
// 5.mq
startMq(); startMq();
// 5.基础fs
startBasicFs();
// 6.正式启动
startPre();
}
private void startBasicFs() throws Exception {
// 启动的时候无关环境信息的写缓存里
checkFile(PRE_FILE);
LocalFileRepository.getSingleton().setWorkRoot(PRE_FILE_ROOT);
ResourceRepository realRepo = RepositoryFactory.getRepo();
FSProperties fsProperties = Carina.properties(FSProperties.class);
FileServer.init(
new ResourceRepositoryWrapper(LocalFileRepository.getSingleton(), StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo.generateTenantsSharedRepo(fsProperties.getTenantsSharedNamespace()), StringUtils.EMPTY));
ResourceIOUtils.setUnderlying(FileServer.local());
ResourceIOUtils.setIsolationMode(false);
ResourcePaths.register(ProjectConstants.ASSETS_NAME, true);
ResourcePaths.register(ProjectConstants.SCHEDULE_NAME, false);
}
private void checkFile(String path) {
File file = new File(path);
if (!file.exists()) {
ConfigHelper.createFile(file);
}
} }
private void startMq() throws Exception { private void startMq() throws Exception {

Loading…
Cancel
Save