|
|
@ -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 { |
|
|
|