Browse Source
Merge in DESIGN/design from ~DESTINY.LIN/design:mss/2.0 to mss/2.0 * commit '98bf268e040906f5e811500dc3fa4f5345923549': REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 代码规范 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 代码规范+设计器文件系统+数据集自测 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 代码规范 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 跑通模板锁定流程,合并部分请求 REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 修复JTemplateAuthChecker REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 移动memconfig REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 设计器启动适配fbp1.0分支与设计器基础远程设计框架适配mss/2.0
58 changed files with 778 additions and 277 deletions
@ -0,0 +1,62 @@ |
|||||||
|
package com.fr.design.env; |
||||||
|
|
||||||
|
import com.fanruan.workplace.http.HttpConstants; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient; |
||||||
|
import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean; |
||||||
|
import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean; |
||||||
|
import com.fr.workspace.connect.WorkspaceClient; |
||||||
|
import com.fr.workspace.connect.WorkspaceConnection; |
||||||
|
import com.fr.workspace.connect.WorkspaceConnectionInfo; |
||||||
|
import com.fr.workspace.connect.WorkspaceConnector; |
||||||
|
import com.fr.workspace.server.repository.connect.RemoteNetworkRepository; |
||||||
|
|
||||||
|
import java.net.InetAddress; |
||||||
|
import java.util.UUID; |
||||||
|
|
||||||
|
/** |
||||||
|
* 远程环境连接器 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/5/24 |
||||||
|
*/ |
||||||
|
public class HttpWorkspaceConnector implements WorkspaceConnector { |
||||||
|
private static final HttpWorkspaceConnector INSTANCE = new HttpWorkspaceConnector(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取单例 |
||||||
|
*/ |
||||||
|
public static HttpWorkspaceConnector getInstance() { |
||||||
|
|
||||||
|
return INSTANCE; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean testConnection(WorkspaceConnectionInfo connectionInfo) throws Exception { |
||||||
|
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); |
||||||
|
return StringUtils.isNotEmpty(bean.getAccessToken()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public WorkspaceClient connect(WorkspaceConnectionInfo connectionInfo) throws Exception { |
||||||
|
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo); |
||||||
|
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); |
||||||
|
WorkspaceConnection connection = new WorkspaceConnection( |
||||||
|
UUID.randomUUID().toString(), |
||||||
|
connectionInfo.getUserName(), |
||||||
|
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(), |
||||||
|
InetAddress.getLocalHost().getHostAddress()); |
||||||
|
client.updateConnection(connection); |
||||||
|
client.startHeartBeat(); |
||||||
|
return client; |
||||||
|
} |
||||||
|
|
||||||
|
private LoginRequestInfoBean createLoginBean(WorkspaceConnectionInfo connectionInfo) { |
||||||
|
LoginRequestInfoBean bean = new LoginRequestInfoBean(); |
||||||
|
bean.setUsername(connectionInfo.getUserName()); |
||||||
|
bean.setPassword(connectionInfo.getPassword()); |
||||||
|
bean.setEncrypted(false); |
||||||
|
return bean; |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.init; |
||||||
|
|
||||||
|
|
||||||
import com.fanruan.carina.annotions.ActivatorRefer; |
import com.fanruan.carina.annotions.ActivatorRefer; |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.init; |
||||||
|
|
||||||
import com.fanruan.carina.Carina; |
import com.fanruan.carina.Carina; |
||||||
import com.fanruan.carina.annotions.FineComponent; |
import com.fanruan.carina.annotions.FineComponent; |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.init; |
||||||
|
|
||||||
import com.fanruan.carina.Carina; |
import com.fanruan.carina.Carina; |
||||||
import com.fanruan.carina.annotions.DependsOn; |
import com.fanruan.carina.annotions.DependsOn; |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.init; |
||||||
|
|
||||||
|
|
||||||
import com.fanruan.carina.annotions.ActivatorRefer; |
import com.fanruan.carina.annotions.ActivatorRefer; |
@ -0,0 +1,91 @@ |
|||||||
|
package com.fanruan.boot.mem; |
||||||
|
|
||||||
|
import com.fanruan.config.event.ConfigListener; |
||||||
|
import com.fanruan.config.realm.ConfigRepositoryProvider; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Collections; |
||||||
|
import java.util.HashSet; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||||
|
|
||||||
|
/** |
||||||
|
* MemConfigRealm |
||||||
|
* |
||||||
|
* @author rinoux |
||||||
|
* @since 11.0 |
||||||
|
* created on 2023-06-08 |
||||||
|
*/ |
||||||
|
public class MemConfigRepository implements ConfigRepositoryProvider { |
||||||
|
|
||||||
|
private final String namespace; |
||||||
|
private final Map<String, Map<String, String>> configValueMap = new ConcurrentHashMap<>(); |
||||||
|
|
||||||
|
private final Map<String, Set<ConfigListener>> configListenerMap = new ConcurrentHashMap<>(); |
||||||
|
|
||||||
|
public MemConfigRepository(String namespace) { |
||||||
|
this.namespace = namespace; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String namespace() { |
||||||
|
return namespace; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String get(String configID, String configItem, String group, boolean cache) throws Exception { |
||||||
|
return configValueMap.computeIfAbsent(configID, k -> new ConcurrentHashMap<>()).get(configItem); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void set(String configID, String configItem, String value, String group) throws Exception { |
||||||
|
configValueMap.computeIfAbsent(configID, k -> new ConcurrentHashMap<>()).put(configItem, value); |
||||||
|
triggerConfigChange(configID); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void remove(String configID, String group) { |
||||||
|
configValueMap.remove(configID); |
||||||
|
triggerConfigChange(configID); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void removeKey(String configID, String key, String group) { |
||||||
|
Map<String, String> configItemMap = configValueMap.get(configID); |
||||||
|
if (configItemMap!= null) { |
||||||
|
configItemMap.remove(key); |
||||||
|
} |
||||||
|
triggerConfigChange(configID); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void watch(String configID, String item, String group, ConfigListener configListener) { |
||||||
|
Set<ConfigListener> configListeners = configListenerMap.computeIfAbsent(configID, k -> Collections.synchronizedSet(new HashSet<>())); |
||||||
|
configListeners.add(configListener); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void unWatch(String configID, String item, String group, ConfigListener configListener) { |
||||||
|
Set<ConfigListener> configListeners = configListenerMap.get(configID); |
||||||
|
if (configListeners != null) { |
||||||
|
configListeners.remove(configListener); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void triggerConfigChange(String configID) { |
||||||
|
Set<ConfigListener> configListeners = configListenerMap.get(configID); |
||||||
|
if (configListeners != null) { |
||||||
|
List<ConfigListener> configListenerList = new ArrayList<>(configListeners); |
||||||
|
for (ConfigListener configListener : configListenerList) { |
||||||
|
try { |
||||||
|
configListener.onConfigChange(); |
||||||
|
} catch (Exception e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.fanruan.boot.mem; |
||||||
|
|
||||||
|
import com.fanruan.config.realm.ConfigRepositoryBuilder; |
||||||
|
import com.fanruan.config.realm.ConfigRepositoryProvider; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 设计器MemConfigRepositoryBuilder |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/5/29 |
||||||
|
*/ |
||||||
|
public class MemConfigRepositoryBuilder implements ConfigRepositoryBuilder { |
||||||
|
@Override |
||||||
|
public ConfigRepositoryProvider build(String namespace) throws Exception { |
||||||
|
return new MemConfigRepository(namespace); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.fanruan.boot.pre; |
||||||
|
|
||||||
|
import com.fanruan.carina.annotions.FineComponent; |
||||||
|
import com.fanruan.carina.annotions.Start; |
||||||
|
import com.fanruan.config.ConfigProviderFactory; |
||||||
|
import com.fanruan.config.impl.PublicConfigProviderImpl; |
||||||
|
import com.fanruan.config.impl.ShareConfigProviderImpl; |
||||||
|
import com.fanruan.config.realm.ConfigRealm; |
||||||
|
import com.fanruan.config.realm.ConfigRepositoryFactory; |
||||||
|
import com.fanruan.boot.mem.MemConfigRepositoryBuilder; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设计器configprovider注册 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/5/29 |
||||||
|
*/ |
||||||
|
@FineComponent(name = "design_universal_config") |
||||||
|
public class DesignConfigComponent { |
||||||
|
|
||||||
|
/** |
||||||
|
* start,注册config并设置基础的memConfigBuilder |
||||||
|
*/ |
||||||
|
@Start |
||||||
|
public void start() { |
||||||
|
ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.SHARE, new ShareConfigProviderImpl()); |
||||||
|
ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.PUBLIC, new PublicConfigProviderImpl()); |
||||||
|
ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new MemConfigRepositoryBuilder()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package com.fanruan.boot.pre; |
||||||
|
|
||||||
|
import com.fanruan.boot.PluginComponent; |
||||||
|
import com.fanruan.carina.annotions.DependsOn; |
||||||
|
import com.fanruan.carina.annotions.FineComponent; |
||||||
|
import com.fanruan.carina.annotions.Start; |
||||||
|
import com.fanruan.carina.annotions.Supplemental; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设计器需要先注册setCarinaPluginProvider,才能做具体的EnvManager的加载 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/5/31 |
||||||
|
*/ |
||||||
|
@FineComponent(name = "design_plugin_supplement") |
||||||
|
@DependsOn(dependencies = {"design_tenant", "design_universal_config"}) |
||||||
|
public class DesignPluginSupplementComponent extends PluginComponent { |
||||||
|
|
||||||
|
/** |
||||||
|
* start |
||||||
|
*/ |
||||||
|
@Start |
||||||
|
public void start() { |
||||||
|
super.prepare(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,153 @@ |
|||||||
|
package com.fanruan.boot.pre; |
||||||
|
|
||||||
|
import com.fanruan.boot.key.StartupArgsShell; |
||||||
|
import com.fanruan.carina.Carina; |
||||||
|
import com.fanruan.carina.annotions.DependsOn; |
||||||
|
import com.fanruan.carina.annotions.FineComponent; |
||||||
|
import com.fanruan.carina.annotions.Start; |
||||||
|
import com.fanruan.carina.annotions.Supplemental; |
||||||
|
import com.fanruan.carina.context.CarinaApplicationContext; |
||||||
|
import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory; |
||||||
|
import com.fanruan.carina.standard.PartitionManager; |
||||||
|
import com.fanruan.carina.standard.PartitionManagerImpl; |
||||||
|
import com.fr.base.StateHubContext; |
||||||
|
import com.fr.base.function.UITerminator; |
||||||
|
import com.fr.design.DesignerEnvManager; |
||||||
|
import com.fr.design.deeplink.DeepLinkManager; |
||||||
|
import com.fr.design.fun.OemProcessor; |
||||||
|
import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; |
||||||
|
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; |
||||||
|
import com.fr.design.monitor.DesignerLifecycleMonitorContext; |
||||||
|
import com.fr.design.ui.util.UIUtil; |
||||||
|
import com.fr.design.utils.DesignUtils; |
||||||
|
import com.fr.design.utils.DesignerPort; |
||||||
|
import com.fr.event.Event; |
||||||
|
import com.fr.event.EventDispatcher; |
||||||
|
import com.fr.event.Listener; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.module.engine.event.LifecycleErrorEvent; |
||||||
|
import com.fr.runtime.FineRuntime; |
||||||
|
import com.fr.stable.lifecycle.FineLifecycleFatalError; |
||||||
|
import com.fr.start.DesignContext; |
||||||
|
import com.fr.start.DesignLauncher; |
||||||
|
import com.fr.start.DesignerSubListener; |
||||||
|
import com.fr.start.EmptyServletContext; |
||||||
|
import com.fr.start.LifecycleFatalErrorHandler; |
||||||
|
import com.fr.start.OemHandler; |
||||||
|
import com.fr.start.SplashContext; |
||||||
|
import com.fr.start.SplashStrategy; |
||||||
|
import com.fr.start.common.SplashCommon; |
||||||
|
import com.fr.start.preload.PreLoadService; |
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设计器启动前处理的模块入口 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/5/31 |
||||||
|
*/ |
||||||
|
@FineComponent(name = "design_pre_start") |
||||||
|
@DependsOn(dependencies = {"design_universal_config", "design_tenant", "design_plugin_supplement"}) |
||||||
|
public class DesignPreStartComponent { |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* start |
||||||
|
*/ |
||||||
|
@Start |
||||||
|
public void start() { |
||||||
|
DesignerEnvManager.getEnvManager(); |
||||||
|
|
||||||
|
startPreload0(); |
||||||
|
|
||||||
|
DesignerLifecycleMonitorContext.getMonitor().beforeStart(); |
||||||
|
//启动运行时
|
||||||
|
FineRuntime.start(); |
||||||
|
//等 FineRuntime 启动后启动
|
||||||
|
DeepLinkManager.getInstance().start(Carina.getApplicationContext().singleton(StartupArgsShell.class).get().get()); |
||||||
|
|
||||||
|
startPreload1(); |
||||||
|
|
||||||
|
DesignerSubListener.getInstance().start(); |
||||||
|
EventDispatcher.listen(LifecycleErrorEvent.SELF, new Listener<FineLifecycleFatalError>() { |
||||||
|
@Override |
||||||
|
public void on(Event event, FineLifecycleFatalError param) { |
||||||
|
LifecycleFatalErrorHandler.getInstance().handle(param); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
try { |
||||||
|
BootstrapFactory.get().start("design_init"); |
||||||
|
} catch (Exception e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 在 {@link FineRuntime#start()} 运行后 |
||||||
|
*/ |
||||||
|
protected static void startPreload1() { |
||||||
|
|
||||||
|
CompletableFuture<Void> initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel); |
||||||
|
PreLoadService.getInstance().addUIFuture(initLookAndFeel); |
||||||
|
|
||||||
|
showSplash(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 在 {@link FineRuntime#start()} 运行前 |
||||||
|
*/ |
||||||
|
protected static void startPreload0() { |
||||||
|
|
||||||
|
PreLoadService.getInstance().addRunnable(() -> { |
||||||
|
if (DesignUtils.isPortOccupied()) { |
||||||
|
UITerminator action = new UITerminator() { |
||||||
|
@Override |
||||||
|
protected void doRun() { |
||||||
|
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.PORT_OCCUPIED.getId(), |
||||||
|
DesignerErrorMessage.PORT_OCCUPIED.getMessage()); |
||||||
|
DesignerPort.getInstance().resetPort(); |
||||||
|
} |
||||||
|
}; |
||||||
|
action.run(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private static void showSplash() { |
||||||
|
|
||||||
|
// 快快显示启动画面
|
||||||
|
// vito: 这里必须用 wait, 不然会导致莫名其妙的问题
|
||||||
|
UIUtil.invokeAndWaitIfNeeded(new Runnable() { |
||||||
|
@Override |
||||||
|
public void run() { |
||||||
|
SplashContext.getInstance().registerSplash(createSplash()); |
||||||
|
SplashContext.getInstance().show(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private static SplashStrategy createSplash() { |
||||||
|
|
||||||
|
OemProcessor oemProcessor = OemHandler.findOem(); |
||||||
|
if (oemProcessor != null) { |
||||||
|
SplashStrategy splashStrategy = null; |
||||||
|
try { |
||||||
|
splashStrategy = oemProcessor.createSplashStrategy(); |
||||||
|
} catch (Throwable e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
if (splashStrategy != null) { |
||||||
|
return splashStrategy; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return new SplashCommon(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.show; |
||||||
|
|
||||||
import com.fanruan.carina.annotions.ActivatorRefer; |
import com.fanruan.carina.annotions.ActivatorRefer; |
||||||
import com.fanruan.carina.annotions.FineComponent; |
import com.fanruan.carina.annotions.FineComponent; |
@ -0,0 +1,39 @@ |
|||||||
|
package com.fanruan.boot.show; |
||||||
|
|
||||||
|
import com.fanruan.boot.FileServerComponent; |
||||||
|
import com.fanruan.carina.annotions.DependsOn; |
||||||
|
import com.fanruan.carina.annotions.FineComponent; |
||||||
|
import com.fanruan.carina.annotions.Start; |
||||||
|
import com.fanruan.carina.annotions.Stop; |
||||||
|
import com.fanruan.fs.FileServer; |
||||||
|
import com.fr.io.utils.ResourceIOUtils; |
||||||
|
|
||||||
|
/** |
||||||
|
* 设计器文件系统初始化 |
||||||
|
* |
||||||
|
* @author Destiny.Lin |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2024/6/4 |
||||||
|
*/ |
||||||
|
@FineComponent(name = "design_fs") |
||||||
|
@DependsOn(dependencies = {"design_conf_config"}) |
||||||
|
public class DesignFsComponent extends FileServerComponent { |
||||||
|
|
||||||
|
/** |
||||||
|
* start |
||||||
|
*/ |
||||||
|
@Start |
||||||
|
public void start() throws Exception { |
||||||
|
super.start(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* start |
||||||
|
*/ |
||||||
|
@Stop |
||||||
|
private void stop() { |
||||||
|
ResourceIOUtils.setUnderlying(FileServer.local()); |
||||||
|
ResourceIOUtils.setIsolationMode(true); |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.show; |
||||||
|
|
||||||
import com.fanruan.carina.annotions.ActivatorRefer; |
import com.fanruan.carina.annotions.ActivatorRefer; |
||||||
import com.fanruan.carina.annotions.DependsOn; |
import com.fanruan.carina.annotions.DependsOn; |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.show; |
||||||
|
|
||||||
import com.fanruan.carina.annotions.ActivatorRefer; |
import com.fanruan.carina.annotions.ActivatorRefer; |
||||||
import com.fanruan.carina.annotions.DependsOn; |
import com.fanruan.carina.annotions.DependsOn; |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.show; |
||||||
|
|
||||||
import com.fanruan.carina.annotions.ActivatorRefer; |
import com.fanruan.carina.annotions.ActivatorRefer; |
||||||
import com.fanruan.carina.annotions.DependsOn; |
import com.fanruan.carina.annotions.DependsOn; |
@ -1,4 +1,4 @@ |
|||||||
package com.fanruan.boot; |
package com.fanruan.boot.show; |
||||||
|
|
||||||
import com.fanruan.carina.annotions.DependsOn; |
import com.fanruan.carina.annotions.DependsOn; |
||||||
import com.fanruan.carina.annotions.FineComponent; |
import com.fanruan.carina.annotions.FineComponent; |
@ -1,58 +1,58 @@ |
|||||||
package com.fr.start.module.optimized; |
//package com.fr.start.module.optimized;
|
||||||
|
//
|
||||||
import com.fanruan.carina.Carina; |
//import com.fanruan.carina.Carina;
|
||||||
import com.fanruan.dao.shell.DBContextShell; |
//import com.fanruan.dao.shell.DBContextShell;
|
||||||
import com.fr.config.BaseDBEnv; |
//import com.fr.config.BaseDBEnv;
|
||||||
import com.fr.config.dao.DaoSelectorFactory; |
//import com.fr.config.dao.DaoSelectorFactory;
|
||||||
import com.fr.config.dao.swicter.DaoSwitcher; |
//import com.fr.config.dao.swicter.DaoSwitcher;
|
||||||
import com.fr.design.DesignerEnvManager; |
//import com.fr.design.DesignerEnvManager;
|
||||||
import com.fr.event.Event; |
//import com.fr.event.Event;
|
||||||
import com.fr.event.EventDispatcher; |
//import com.fr.event.EventDispatcher;
|
||||||
import com.fr.event.Listener; |
//import com.fr.event.Listener;
|
||||||
import com.fr.event.Null; |
//import com.fr.event.Null;
|
||||||
import com.fr.exit.ConfigToPropMigrator; |
//import com.fr.exit.ConfigToPropMigrator;
|
||||||
import com.fr.stable.db.DBContext; |
//import com.fr.stable.db.DBContext;
|
||||||
import com.fr.stable.db.tenant.TenantDBAdapter; |
//import com.fr.stable.db.tenant.TenantDBAdapter;
|
||||||
import com.fr.start.event.LazyStartupEvent; |
//import com.fr.start.event.LazyStartupEvent;
|
||||||
import com.fr.start.server.EmbedServerEvent; |
//import com.fr.start.server.EmbedServerEvent;
|
||||||
|
//
|
||||||
/** |
///**
|
||||||
* @author hades |
// * @author hades
|
||||||
* @version 11.0 |
// * @version 11.0
|
||||||
* Created by hades on 2022/3/7 |
// * Created by hades on 2022/3/7
|
||||||
*/ |
// */
|
||||||
public class TenantDBAdapter4Designer extends TenantDBAdapter { |
//public class TenantDBAdapter4Designer extends TenantDBAdapter {
|
||||||
|
//
|
||||||
@Override |
// @Override
|
||||||
public void start() { |
// public void start() {
|
||||||
BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get()); |
// BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get());
|
||||||
if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { |
// if (DaoSelectorFactory.getDaoSelector().useCacheDao()) {
|
||||||
listenEvent(LazyStartupEvent.INSTANCE, new Listener<Null>() { |
// listenEvent(LazyStartupEvent.INSTANCE, new Listener<Null>() {
|
||||||
@Override |
// @Override
|
||||||
public void on(Event event, Null param) { |
// public void on(Event event, Null param) {
|
||||||
TenantDBAdapter4Designer.super.start(); |
// TenantDBAdapter4Designer.super.start();
|
||||||
afterStart(); |
// afterStart();
|
||||||
} |
// }
|
||||||
}); |
// });
|
||||||
|
//
|
||||||
listenEvent(EmbedServerEvent.BeforeStart, new Listener<Null>() { |
// listenEvent(EmbedServerEvent.BeforeStart, new Listener<Null>() {
|
||||||
@Override |
// @Override
|
||||||
public void on(Event event, Null param) { |
// public void on(Event event, Null param) {
|
||||||
if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { |
// if (DaoSelectorFactory.getDaoSelector().useCacheDao()) {
|
||||||
EventDispatcher.fire(LazyStartupEvent.INSTANCE); |
// EventDispatcher.fire(LazyStartupEvent.INSTANCE);
|
||||||
} |
// }
|
||||||
} |
// }
|
||||||
}); |
// });
|
||||||
|
//
|
||||||
} else { |
// } else {
|
||||||
super.start(); |
// super.start();
|
||||||
} |
// }
|
||||||
} |
// }
|
||||||
|
//
|
||||||
private void afterStart() { |
// private void afterStart() {
|
||||||
DesignerEnvManager.getEnvManager().setPropertiesUsable(false); |
// DesignerEnvManager.getEnvManager().setPropertiesUsable(false);
|
||||||
DaoSwitcher.executeSwitch(); |
// DaoSwitcher.executeSwitch();
|
||||||
ConfigToPropMigrator.getInstance().deletePropertiesCache(); |
// ConfigToPropMigrator.getInstance().deletePropertiesCache();
|
||||||
DesignerEnvManager.getEnvManager().saveXMLFile(); |
// DesignerEnvManager.getEnvManager().saveXMLFile();
|
||||||
} |
// }
|
||||||
} |
//}
|
||||||
|
Loading…
Reference in new issue