Browse Source

REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 修复环境切换功能

mss/2.0
Destiny.Lin 6 months ago
parent
commit
e93e42ee43
  1. 295
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java
  2. 285
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  3. 41
      designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java
  4. 6
      designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java
  5. 243
      designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java
  6. 9
      designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java
  7. 52
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java
  8. 4
      designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java
  9. 118
      designer-realize/src/main/java/com/fanruan/boot/init/PreLoadComponent.java
  10. 23
      designer-realize/src/main/java/com/fanruan/boot/init/XMLableComponent.java
  11. 31
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java
  12. 27
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java
  13. 114
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java
  14. 51
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignTenantComponent.java
  15. 39
      designer-realize/src/main/java/com/fanruan/boot/show/DesignConfConfigComponent.java
  16. 47
      designer-realize/src/main/java/com/fanruan/boot/show/DesignCoreSupplementalComponent.java
  17. 19
      designer-realize/src/main/java/com/fanruan/boot/show/DesignEnvComponent.java
  18. 39
      designer-realize/src/main/java/com/fanruan/boot/show/DesignFsComponent.java
  19. 24
      designer-realize/src/main/java/com/fanruan/boot/show/DesignFunctionComponent.java
  20. 39
      designer-realize/src/main/java/com/fanruan/boot/show/DesignLoggerComponent.java
  21. 19
      designer-realize/src/main/java/com/fanruan/boot/show/DesignUpdateComponent.java
  22. 21
      designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceComponent.java
  23. 19
      designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceRegisterComponent.java
  24. 24
      designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java
  25. 39
      designer-realize/src/main/java/com/fanruan/boot/show/DesignerDaoComponent.java
  26. 43
      designer-realize/src/main/java/com/fanruan/boot/show/DesignerShowComponent.java
  27. 34
      designer-realize/src/main/java/com/fanruan/fs/DesignFileRepository.java
  28. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  29. 23
      designer-realize/src/main/java/com/fr/start/util/DesignerStartupPageUtil.java

295
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java vendored

@ -0,0 +1,295 @@
package com.fanruan.boot.env;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.carina.lifecycle.bootstrap.BootUnit;
import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory;
import com.fr.base.operator.org.OrganizationOperator;
import com.fr.base.rpc.encrypt.EncryptOperator;
import com.fr.decision.service.context.ServiceContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.PluginClassRefreshManager;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.ServerTableDataLockChangeChecker;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.plugin.remind.PluginErrorDesignReminder;
import com.fr.env.utils.WorkspaceUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.file.filetree.FileNodes;
import com.fr.form.share.ShareComponentOperator;
import com.fr.form.share.ShareEmbeddedConverter;
import com.fr.report.lock.DefaultLockInfoOperator;
import com.fr.report.lock.LocalLockInfoOperator;
import com.fr.report.lock.LockInfoOperator;
import com.fr.report.lock.ServerLockInfoOperator;
import com.fr.start.DesignContext;
import com.fr.start.module.StartupArgs;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.base.WorkspaceKey;
import com.fr.workspace.pool.WorkRPCRegister;
import com.fr.workspace.pool.WorkRPCType;
import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.ServerFileNodes;
import com.fr.workspace.server.ServerWorkResource;
import com.fr.workspace.server.authority.AuthorityOperator;
import com.fr.workspace.server.authority.FineAuthorityOperator;
import com.fr.workspace.server.authority.decision.DecisionOperator;
import com.fr.workspace.server.authority.decision.FineDecisionOperator;
import com.fr.workspace.server.authority.organization.OrganizationOperatorImpl;
import com.fr.workspace.server.authority.user.DefaultUserAuthority;
import com.fr.workspace.server.authority.user.LocalUserAuthority;
import com.fr.workspace.server.authority.user.ServerUserAuthority;
import com.fr.workspace.server.authority.user.UserAuthority;
import com.fr.workspace.server.check.TemplateChecker;
import com.fr.workspace.server.check.TemplateCheckerImpl;
import com.fr.workspace.server.check.VersionInfoOperator;
import com.fr.workspace.server.check.VersionInfoOperatorImpl;
import com.fr.workspace.server.connection.DBConnectAuth;
import com.fr.workspace.server.connection.LocalDBConnectAuth;
import com.fr.workspace.server.connection.ServerDBConnectAuth;
import com.fr.workspace.server.database.DataBaseTypeOperator;
import com.fr.workspace.server.database.DefaultDatabaseTypeOperator;
import com.fr.workspace.server.database.LocalDatabaseTypeOperator;
import com.fr.workspace.server.database.ServerDatabaseTypeOperator;
import com.fr.workspace.server.encrypt.FineEncryptOperator;
import com.fr.workspace.server.exporter.LocalExportOperator;
import com.fr.workspace.server.exporter.ServerExportOperator;
import com.fr.workspace.server.exporter.TemplateExportOperator;
import com.fr.workspace.server.lock.LocalTplOperator;
import com.fr.workspace.server.lock.ServerTplOperator;
import com.fr.workspace.server.lock.TplOperator;
import com.fr.workspace.server.lock.editlock.DefaultEditLockOperator;
import com.fr.workspace.server.lock.editlock.EditLockOperator;
import com.fr.workspace.server.lock.editlock.LocalEditLockOperator;
import com.fr.workspace.server.lock.editlock.ServerEditLockOperator;
import com.fr.workspace.server.share.DefaultShareComponentOperator;
import com.fr.workspace.server.share.DefaultShareEmbeddedConverter;
import com.fr.workspace.server.socket.FineSocketInfoOperator;
import com.fr.workspace.server.socket.SocketInfoOperator;
import com.fr.workspace.server.socket.SocketTokenVerifierOperator;
import com.fr.workspace.server.socket.SocketVerifierOperator;
import com.fr.workspace.server.socket.SocketWsidVerifierOperator;
import com.fr.workspace.server.theme.NotSupportThemedCellInnerBorderFeature;
import com.fr.workspace.server.theme.SupportThemedCellInnerBorderFeature;
import com.fr.workspace.server.theme.ThemedCellBorderFeature;
import com.fr.workspace.server.vcs.CompatibleVcsOperator;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.VcsOperatorProxy;
import org.jetbrains.annotations.NotNull;
/**
* 环境选择模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/6/6
*/
@FineComponent(name = "design_env_choose")
public class DesignEnvChooseComponent {
private Listener<Workspace> beforeSwitch4Min = new Listener<Workspace>(Integer.MIN_VALUE) {
@Override
public void on(Event event, Workspace current) {
try {
BootstrapFactory.get().stop("design_env_prepare");
BootstrapFactory.get().resetStatus("design_env_prepare", BootUnit.State.SUPPLEMENTED);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
private Listener<Workspace> afterSwitch4Max = new Listener<Workspace>(Integer.MAX_VALUE) {
@Override
public void on(Event event, Workspace current) {
try {
BootstrapFactory.get().start("design_function");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
private Listener<Workspace> beforeSwitch4Max = new Listener<Workspace>(Integer.MAX_VALUE) {
@Override
public void on(Event event, Workspace workspace) {
PluginClassRefreshManager.getInstance().removePluginListener();
HistoryTemplateListCache.getInstance().stash();
PluginClassRefreshManager.getInstance().fireTabChange();
}
};
private Listener<Workspace> afterSwitch4Min = new Listener<Workspace>(Integer.MIN_VALUE) {
@Override
public void on(Event event, Workspace workspace) {
HistoryTemplateListCache.getInstance().load();
PluginClassRefreshManager.getInstance().addPluginListener();
}
};
private NotNullLazyValue<StartupArgs> startupArgs = new NotNullLazyValue<StartupArgs>() {
@NotNull
@Override
protected StartupArgs compute() {
return Carina.getApplicationContext().singleton(StartupArgsShell.class).get();
}
};
@Start
public void start() {
registerEnvListener();
startEnvChoose();
afterAllStart();
}
@Stop
public void stop() {
editLockCheckerStop();
stopListen();
}
@Supplemental
public void prepare() {
supplemental();
}
/**
* ----------------------------------------private------------------------------------------
*/
private void afterAllStart() {
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE);
}
private void startEnvChoose() {
//检查环境
DesignerEnvManager.checkNameEnvMap();
if (startupArgs.getValue().isDemo()) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
} else {
DesignerWorkspaceInfo workspaceInfo = null;
try {
String current = DesignerEnvManager.getEnvManager().getCurEnvName();
workspaceInfo = WorkspaceUtils.getWorkspaceInfo();
((DesignContext)Carina.getApplicationContext()).setDesignWebInfPath(workspaceInfo.getPath());
Workspace workspace = DesignerWorkspaceGenerator.generate(workspaceInfo);
boolean checkValid = workspace != null && workspaceInfo.checkValid();
if (!checkValid) {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(null, workspaceInfo);
} else {
WorkContext.switchTo(workspace);
}
} catch (Throwable e) {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(e, workspaceInfo);
}
}
pluginErrorRemind();
editLockCheckerStart();
}
/**
* 注册切换环境前后事件监听
*/
private void registerEnvListener() {
/*切换环境前,关闭所有相关模块,最后执行*/
EventDispatcher.listen(WorkspaceEvent.BeforeSwitch, beforeSwitch4Min);
/*切换环境后,重新启动所有相关模块,最先执行*/
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, afterSwitch4Max);
/*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/
EventDispatcher.listen(WorkspaceEvent.BeforeSwitch, beforeSwitch4Max);
/*切换环境后,装载一下打开的所有文件对象,优先级低于默认优先级,要后于 启动相关模块部分 被触发*/
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, afterSwitch4Min);
}
private void editLockCheckerStart() {
ConnectionLockChangeChecker.getInstance().start();
ServerTableDataLockChangeChecker.getInstance().start();
}
private void pluginErrorRemind() {
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null aNull) {
PluginErrorDesignReminder.getInstance().remindStartFailedPlugins();
PluginErrorDesignReminder.getInstance().remindInvalidatePlugins();
}
});
}
private void editLockCheckerStop() {
ConnectionLockChangeChecker.getInstance().stop();
ServerTableDataLockChangeChecker.getInstance().stop();
}
private void supplemental() {
ServiceContext.group(WorkspaceKey.class).addAll(
WorkRPCRegister.wrap(WorkRPCType.Server, FileNodes.class, new ServerFileNodes()),
WorkRPCRegister.wrap(AuthorityOperator.class, new FineAuthorityOperator()),
WorkRPCRegister.wrap(DecisionOperator.class, new FineDecisionOperator()),
WorkRPCRegister.wrap(SocketInfoOperator.class, new FineSocketInfoOperator()),
WorkRPCRegister.wrap(OrganizationOperator.class, new OrganizationOperatorImpl()),
WorkRPCRegister.wrap(WorkRPCType.Server, WorkResource.class, ServerWorkResource.getInstance()),
WorkRPCRegister.wrap(WorkRPCType.Server, TplOperator.class, ServerTplOperator.getInstance()),
WorkRPCRegister.wrap(WorkRPCType.Local, TplOperator.class, new LocalTplOperator()),
WorkRPCRegister.wrap(WorkRPCType.Server, DBConnectAuth.class, new ServerDBConnectAuth()),
WorkRPCRegister.wrap(WorkRPCType.Local, DBConnectAuth.class, new LocalDBConnectAuth()),
WorkRPCRegister.wrap(WorkRPCType.Local, TemplateExportOperator.class, new LocalExportOperator()),
WorkRPCRegister.wrap(WorkRPCType.Server, TemplateExportOperator.class, new ServerExportOperator()),
WorkRPCRegister.wrap(WorkRPCType.Local, EditLockOperator.class, new LocalEditLockOperator()),
WorkRPCRegister.wrap(WorkRPCType.Server, EditLockOperator.class, ServerEditLockOperator.getInstance()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, EditLockOperator.class, new DefaultEditLockOperator()),
WorkRPCRegister.wrap(EncryptOperator.class, new FineEncryptOperator()),
WorkRPCRegister.wrap(VcsOperator.class, new VcsOperatorProxy()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, VcsOperator.class, new CompatibleVcsOperator()),
WorkRPCRegister.wrap(TemplateChecker.class, new TemplateCheckerImpl()),
WorkRPCRegister.wrap(ShareComponentOperator.class, new DefaultShareComponentOperator()),
WorkRPCRegister.wrap(ShareEmbeddedConverter.class, new DefaultShareEmbeddedConverter()),
WorkRPCRegister.wrap(VersionInfoOperator.class, new VersionInfoOperatorImpl()),
WorkRPCRegister.wrap(WorkRPCType.Server, UserAuthority.class, new ServerUserAuthority()),
WorkRPCRegister.wrap(WorkRPCType.Local, UserAuthority.class, new LocalUserAuthority()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, UserAuthority.class, new DefaultUserAuthority()),
WorkRPCRegister.wrap(WorkRPCType.Local, ThemedCellBorderFeature.class, new SupportThemedCellInnerBorderFeature()),
WorkRPCRegister.wrap(WorkRPCType.Server, ThemedCellBorderFeature.class, new SupportThemedCellInnerBorderFeature()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, ThemedCellBorderFeature.class, new NotSupportThemedCellInnerBorderFeature()),
WorkRPCRegister.wrap(WorkRPCType.Server, LockInfoOperator.class, ServerLockInfoOperator.getInstance()),
WorkRPCRegister.wrap(WorkRPCType.Local, LockInfoOperator.class, new LocalLockInfoOperator()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, LockInfoOperator.class, new DefaultLockInfoOperator()),
WorkRPCRegister.wrap(WorkRPCType.Local, DataBaseTypeOperator.class, new LocalDatabaseTypeOperator()),
WorkRPCRegister.wrap(WorkRPCType.Server, DataBaseTypeOperator.class, new ServerDatabaseTypeOperator()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, DataBaseTypeOperator.class, new DefaultDatabaseTypeOperator()),
WorkRPCRegister.wrap(WorkRPCType.Simple, SocketVerifierOperator.class, new SocketWsidVerifierOperator()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, SocketVerifierOperator.class, new SocketTokenVerifierOperator()));
}
private void stopListen() {
EventDispatcher.stopListen(beforeSwitch4Max);
EventDispatcher.stopListen(beforeSwitch4Min);
EventDispatcher.stopListen(afterSwitch4Min);
EventDispatcher.stopListen(afterSwitch4Max);
}
}

285
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -0,0 +1,285 @@
package com.fanruan.boot.env;
import com.fanruan.boot.FSProperties;
import com.fanruan.boot.LoggerProperties;
import com.fanruan.boot.mem.MemConfigRepositoryBuilder;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.JPAEntityScan;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.config.ConfigProviderFactory;
import com.fanruan.config.realm.ConfigRealm;
import com.fanruan.dao.context.DBContextProvider;
import com.fanruan.dao.context.DBContextStarter;
import com.fanruan.dao.encryption.EncryptionInitializationProvider;
import com.fanruan.dao.encryption.singleton.EncryptionInitializationProviderSingleton;
import com.fanruan.dao.property.DBPropertyProvider;
import com.fanruan.dao.shell.DBContextShell;
import com.fanruan.dao.shell.DBPropertyShell;
import com.fanruan.fs.DesignFileRepository;
import com.fanruan.fs.FSConstants;
import com.fanruan.fs.FileServer;
import com.fanruan.fs.RepositoryFactory;
import com.fanruan.fs.repository.local.LocalFileRepository;
import com.fr.cbb.dialect.security.InsecurityElementFactory;
import com.fr.config.BaseDBEnv;
import com.fr.config.ConfigContext;
import com.fr.config.ConfigEvent;
import com.fr.config.FinalPreferenceConfig;
import com.fr.config.dao.DaoContext;
import com.fr.config.dao.impl.BatchSubmitClassHelperDao;
import com.fr.config.dao.impl.BatchSubmitEntityDao;
import com.fr.config.dao.impl.BatchSubmitXmlEntityDao;
import com.fr.config.dao.impl.hibernate.HibernateClassHelperDao;
import com.fr.config.dao.impl.hibernate.HibernateEntityDao;
import com.fr.config.dao.impl.hibernate.HibernateXmlEnityDao;
import com.fr.config.dao.impl.remote.RemoteClassHelperDao;
import com.fr.config.dao.impl.remote.RemoteEntityDao;
import com.fr.config.dao.impl.remote.RemoteXmlEntityDao;
import com.fr.config.impl.ConfConfigProviderImpl;
import com.fr.config.impl.ConfigInsecurityElementProviderImpl;
import com.fr.decision.service.context.ServiceContext;
import com.fr.env.detect.EnvDetectorCenter;
import com.fr.event.EventDispatcher;
import com.fr.general.FRLogger;
import com.fr.general.log.Log4jUtils;
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.properties.encryption.EncryptionInitialization;
import com.fr.security.encryption.core.EncryptionScaffold;
import com.fr.security.encryption.provider.SecuritySeedProvider;
import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey;
import com.fr.stable.CarinaGraphDrawHelper;
import com.fr.stable.CoreGraphDrawServiceImpl;
import com.fr.stable.StringUtils;
import com.fr.stable.db.DBContext;
import com.fr.stable.db.properties.FineMicroServicesDBProperties;
import com.fr.stable.project.ProjectConstants;
import com.fr.transaction.Configurations;
import com.fr.transaction.FineConfigurationHelper;
import com.fr.transaction.HibernateTransactor;
import com.fr.transaction.RemoteTransactor;
import com.fr.transaction.TransactorFactory;
import com.fr.workspace.WorkContext;
import java.net.URI;
import java.util.Objects;
/**
* 设计器env模块环境切换的底层模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/6/7
*/
@FineComponent(name = "design_env_prepare")
@JPAEntityScan("com.fr.config.entity")
public class DesignEnvComponent {
@Supplemental
public void supplemental() {
supplementalCorePrepare();
}
@Start
public void start() throws Exception {
// 1.环境准备
startEnvPrepare();
// 2.core准备
startCorePrepare();
// 3.dao启动
startDao();
// 4.config启动
startConfConfig();
// 5.fileServer启动
startFileServer();
// 6.logger启动
startLogger();
}
@Stop
public void stop() {
stopLogger();
stopFileServer();
stopConfConfig();
stopDao();
stopCorePrepare();
stopEnvPrepare();
}
/**
* -------------------private-------------------
*/
/**
* ----------- logger --------
*/
private void startLogger() {
String realPath = Carina.properties(LoggerProperties.class).getXml();
URI uri = Log4jUtils.buildUserConfigURI(realPath);
FRLogger.getLogger().config(uri);
}
private void stopLogger() {
FRLogger.getLogger().stop();
}
/**
* ----------- file-server --------
*/
private void startFileServer() throws Exception {
if (WorkContext.getCurrent().isLocal()) {
// 设计器远程下不需要文件系统,走PublicRepo的接口,本地下走基础的磁盘读写
LocalFileRepository localFileRepository = LocalFileRepository.getSingleton();
ResourceRepository realRepo = RepositoryFactory.getRepo();
FSProperties fsProperties = Carina.properties(FSProperties.class);
FileServer.init(
new ResourceRepositoryWrapper(localFileRepository, StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo, Carina.getApplicationContext().getMainServletName()),
new ResourceRepositoryWrapper(realRepo, FSConstants.PUBLIC_NAMESPACE),
new ResourceRepositoryWrapper(realRepo.generateTenantsSharedRepo(fsProperties.getTenantsSharedNamespace()), StringUtils.EMPTY));
if (StringUtils.isEmpty(fsProperties.getPath()) && Objects.equals(fsProperties.getType(), FSConstants.LOCAL_ENV)) {
fsProperties.setPath(Carina.getApplicationContext().getWebInfPath());
}
ResourceIOUtils.setUnderlying(FileServer.local());
ResourceIOUtils.setIsolationMode(false);
ResourcePaths.register(ProjectConstants.ASSETS_NAME, true);
ResourcePaths.register(ProjectConstants.SCHEDULE_NAME, false);
} else {
DesignFileRepository repository = new DesignFileRepository();
FSProperties fsProperties = Carina.properties(FSProperties.class);
FileServer.init(repository, repository, repository, repository.generateTenantsSharedRepo(fsProperties.getTenantsSharedNamespace()));
}
}
private void stopFileServer() {
ResourceIOUtils.setUnderlying(FileServer.local());
ResourceIOUtils.setIsolationMode(true);
}
/**
* -----------dao---------
*/
private void startDao() {
if (WorkContext.getCurrent().isLocal()) {
// 类似com.fr.config.activator.BaseDBActivator.start里的逻辑
EncryptionInitializationProvider initializationProvider = Carina.getApplicationContext().singleton(EncryptionInitializationProviderSingleton.class).get();
if (initializationProvider != null) {
initializationProvider.init();
} else {
throw new IllegalStateException("no EncryptionInitializationProvider implementation found, this may cause encryption exception.");
}
DBPropertyProvider dbPropertyProvider = FineMicroServicesDBProperties.getInstance().from(Carina.getApplicationContext().getCarinaApplicationProperties());
DBContextProvider dbContextProvider = new DBContextStarter(dbPropertyProvider).start();
ServiceContext.singleton(DBPropertyShell.class).set(dbPropertyProvider);
ServiceContext.singleton(DBContextShell.class).set(dbContextProvider);
// 这里等另外的模块DBPropertyComponent启动,并且注入后这里的api实例才能安排
FineLoggerFactory.getLogger().info("[StateServiceCommon] dao service common started.");
}
}
private void stopDao() {
FineMicroServicesDBProperties.getInstance().clear();
}
/**
* ---------- confconfig -------
*/
private void startConfConfig() {
BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get());
if (!WorkContext.getCurrent().isLocal()) {
TransactorFactory.setTransactor(new RemoteTransactor());
//远程
DaoContext.setXmlEntityDao(new RemoteXmlEntityDao());
DaoContext.setClassHelperDao(new RemoteClassHelperDao());
DaoContext.setEntityDao(new RemoteEntityDao());
} else {
//本地
TransactorFactory.setTransactor(new HibernateTransactor());
DaoContext.setClassHelperDao(new BatchSubmitClassHelperDao(new HibernateClassHelperDao()));
DaoContext.setEntityDao(new BatchSubmitEntityDao(new HibernateEntityDao()));
DaoContext.setXmlEntityDao(new BatchSubmitXmlEntityDao(new HibernateXmlEnityDao()));
}
ConfConfigProviderImpl confConfigProvider = new ConfConfigProviderImpl();
ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.SERVICE, confConfigProvider);
Configurations.setHelper(new FineConfigurationHelper());
EventDispatcher.fire(ConfigEvent.READY);
// 固化一些配置
FinalPreferenceConfig.solidify();
InsecurityElementFactory.setConfigInsecurityElementProvider(ConfigInsecurityElementProviderImpl.INSTANCE);
}
private void stopConfConfig() {
DaoContext.setClassHelperDao(null);
DaoContext.setEntityDao(null);
DaoContext.setXmlEntityDao(null);
Configurations.setHelper(null);
}
/**
* --------- core-supplemental --------
*/
private void supplementalCorePrepare() {
Carina.getApplicationContext().singleton(EncryptionInitializationProviderSingleton.class).set(EncryptionInitialization.getInstance());
}
private void startCorePrepare() {
EncryptionScaffold.setSecuritySeedProvider(new SecuritySeedProvider() {
@Override
public byte[] getSeed() {
return LoadSeedSecurityKey.getInstance().loadSeedFile();
}
@Override
public void resetSeed() {
LoadSeedSecurityKey.getInstance().reset();
}
});
LoadSeedSecurityKey.getInstance().init();
CarinaGraphDrawHelper.getInstance().registerGraphDrawHelper(new CoreGraphDrawServiceImpl());
}
private void stopCorePrepare() {
EncryptionScaffold.setSecuritySeedProvider(new SecuritySeedProvider() {});
LoadSeedSecurityKey.getInstance().reset();
}
/**
* --------- EnvPrepare ---------
*/
private void stopEnvPrepare() {
EnvDetectorCenter.getInstance().destroy();
}
private void startEnvPrepare() {
EnvDetectorCenter.getInstance().init();
}
}

41
designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java vendored

@ -0,0 +1,41 @@
package com.fanruan.boot.env;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.chart.activator.ChartBaseActivator;
import com.fr.data.DatasourceActivator;
import com.fr.design.chart.ChartDesignerActivator;
import com.fr.design.mainframe.app.DesignerAppActivator;
import com.fr.design.record.analyzer.DesignerAnalyzerActivator;
import com.fr.form.module.FormBaseActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.start.module.DesignerActivator;
import com.fr.start.module.DesignerESDActivator;
import com.fr.start.module.optimized.DesignUpdateActivator;
import com.fr.workspace.server.vcs.VcsFolderManagerActivator;
/**
* 设计器基础功能组件环境切换的上层模块
* <p>主要是图表reportvcsform相关的基础初始化</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/27
*/
@FineComponent(name = "design_function")
@DependsOn(dependencies = {"design_plugin"})
@ActivatorRefer(refer = {
DesignUpdateActivator.class,
DatasourceActivator.class,
ChartBaseActivator.class,
ReportBaseActivator.class,
VcsFolderManagerActivator.class,
FormBaseActivator.class,
DesignerActivator.class,
DesignerAppActivator.class,
ChartDesignerActivator.class,
DesignerESDActivator.class,
DesignerAnalyzerActivator.class})
public class DesignFunctionComponent {
}

6
designer-realize/src/main/java/com/fanruan/boot/show/DesignPluginComponent.java → designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java vendored

@ -1,4 +1,4 @@
package com.fanruan.boot.show;
package com.fanruan.boot.env;
import com.fanruan.boot.PluginComponent;
import com.fanruan.carina.annotions.DependsOn;
@ -8,14 +8,14 @@ import com.fanruan.carina.annotions.Start;
import javax.servlet.ServletContext;
/**
* 设计器插件模块
* 设计器插件模块环境切换的中间模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/17
*/
@FineComponent(name = "design_plugin")
@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config", "design_logger"})
@DependsOn(dependencies = {"design_env_prepare"})
public class DesignPluginComponent extends PluginComponent {
/**

243
designer-realize/src/main/java/com/fanruan/boot/init/DesignerStartupComponent.java → designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java

@ -1,14 +1,20 @@
package com.fanruan.boot.init;
import com.fanruan.boot.ClassFindComponent;
import com.fanruan.boot.ExtraLocaleClassManager;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup;
import com.fanruan.product.BuildContext;
import com.fanruan.product.ProductConstants;
import com.fr.base.OptimizeUtil;
import com.fr.config.dao.DaoSelectorFactory;
import com.fr.config.dao.PropertiesConstants;
import com.fr.decision.service.context.ServiceContext;
import com.fr.decision.webservice.v10.encryption.EncryptionConstants;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
@ -16,53 +22,60 @@ import com.fr.design.dialog.TipDialog;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.file.TemplateResourceManager;
import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.StartupMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.design.utils.DesignUtils;
import com.fr.env.utils.WorkspaceUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.exit.DesignerExiter;
import com.fr.file.TmpFileUtils;
import com.fr.general.CloudCenter;
import com.fr.general.FRLogger;
import com.fr.general.FrontProviderImpl;
import com.fr.general.GeneralContext;
import com.fr.general.I18nActivator;
import com.fr.general.Inter;
import com.fr.general.InterProviderImpl;
import com.fr.invoke.ClassFactory;
import com.fr.license.function.VT4FR;
import com.fr.locale.InterMutableKey;
import com.fr.log.FineLoggerFactory;
import com.fr.measure.DBMeterFactory;
import com.fr.record.DefaultDBMeter;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.StableXMLUtils;
import com.fr.start.DesignerProcessType;
import com.fr.start.ServerStarter;
import com.fr.start.common.DesignerStartupContext;
import com.fr.start.event.LazyStartupEvent;
import com.fr.start.module.StartupArgs;
import com.fr.start.preload.PreLoadService;
import com.fr.start.server.FineEmbedServer;
import com.fr.third.guava.base.Stopwatch;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import javax.servlet.ServletContext;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
/**
* 设计器启动检查模块
* <p>负责设计器启动的前置清理与检查是一切设计器模块的起点</p>
* 设计器启动时的准备加载阶段
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/24
* Created on 2024/6/7
*/
@EnableMetrics
@FineComponent(name = "design_start_up")
public class DesignerStartupComponent {
@FineComponent(name = "design_load")
public class DesignPreLoadComponent {
private NotNullLazyValue<StartupArgs> startupArgsValue = new NotNullLazyValue<StartupArgs>() {
@NotNull
@ -72,6 +85,174 @@ public class DesignerStartupComponent {
}
};
@Supplemental
public void supplemental() {
supplementalI18n();
}
/**
* start
*/
@Start
@Metrics
public void start() {
// 1.清理临时文件+监听
startPreLoad();
// 2.ClassFactory注册finder
startClass();
// 3.国际化
startI18n();
}
/**
* stop
*/
@Stop
public void stop() {
stopClass();
stopLog();
}
/**
* ---------------------private-----------------------
*/
private void startI18n() {
// 扫描默认路径
I18nActivator.registerI18N(new ArrayList<>(ServiceContext.group(InterMutableKey.class).getAll()));
FrontProviderImpl.init(InterProviderImpl.getInstance());
}
private void supplementalI18n() {
// 国际化插件class自定义管理
Carina.getApplicationContext().group(AutonomyClassManagerGroup.class).add(new ExtraLocaleClassManager());
}
private void stopClass() {
ClassFactory.getInstance().clear();
}
private void startClass() {
ClassFactory.getInstance().addFinder(className -> {
File clssesFile = new File(CommonUtils.pathJoin(System.getProperty("carina.home"),
ProjectConstants.CLASSES_NAME));
ClassLoader urlClassLoader;
try {
urlClassLoader = new URLClassLoader(new URL[]{clssesFile.toURI().toURL()}, ClassFindComponent.class.getClassLoader());
} catch (MalformedURLException malformedURLException) {
urlClassLoader = ClassLoader.getSystemClassLoader();
}
return Class.forName(className, true, urlClassLoader);
});
ClassFactory.getInstance().addFinder(className -> {
//再找.
// alex:currentEnv可能是null
String envPath = WorkContext.getCurrent().getPath();
if (envPath == null) {
throw new ClassNotFoundException(className);
}
File clssesFile = new File(StableUtils.pathJoin(envPath, ProjectConstants.CLASSES_NAME));
ClassLoader urlClassLoader;
try {
urlClassLoader = new URLClassLoader(new URL[]{clssesFile.toURI().toURL()}, StableUtils.class.getClassLoader());
} catch (MalformedURLException malformedURLException) {
urlClassLoader = ClassLoader.getSystemClassLoader();
}
return Class.forName(className, true, urlClassLoader);
});
}
@SuppressWarnings("all")
private void startPreLoad() {
try {
beforeAllStart();
//清空临时文件
TmpFileUtils.cleanUpInnerTmpFiles();
RestartHelper.deleteRecordFilesWhenStart();
CloudCenter.getInstance();
// 创建监听服务
DesignUtils.createListeningServer(DesignUtils.getPort(), startFileSuffix());
// 在插件引擎模块起来前 初始化下插件接口监听
TemplateResourceManager.getResource();
initLanguage();
// PreLoadActivator
startBasic();
// DefaultLogActivator
startLog();
} catch (RuntimeException e) {
throw e;
} finally {
//防止还有什么莫名其妙的 bug 影响到注册的启动。
VT4FR.values();
}
}
private void startBasic() {
BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
Inter.getInstance();
StableXMLUtils.load();
checkWebAppName();
checkWebContextName();
}
private void startLog() {
FineLoggerFactory.registerLogger(FRLogger.getLogger());
DBMeterFactory.register(new DefaultDBMeter());
}
private void stopLog() {
FineLoggerFactory.reset();
DBMeterFactory.remove();
}
/**
* war包部署时登录进入平台后才设置com.fr.stable.ProductConstants.WEB_APP_NAME而证书检查在启动时就开始进行
* 此时ProductConstants.WEB_APP_NAME == null LicenseMatchInfo的isAppNameMatch会被设置为false导致war包部署重启证书不生效
*/
private void checkWebAppName() {
ServletContext context = Carina.getApplicationContext().getServletContext();
if (context != null) {
if (ProductConstants.getWebAppName() == null) {
String contextPath = context.getContextPath();
if (StringUtils.isNotEmpty(contextPath)) {
if (contextPath.startsWith("/")) {
contextPath = contextPath.substring(1);
}
ProductConstants.setWebAppName(contextPath);
}
}
}
}
private void checkWebContextName() {
ServletContext context = Carina.getApplicationContext().getServletContext();
if (context != null) {
if (ProductConstants.getWebContextName() == null) {
String contextPath = context.getContextPath();
if (null != contextPath) {
if (contextPath.startsWith("/")) {
contextPath = contextPath.substring(1);
}
ProductConstants.setWebContextName(contextPath);
}
}
}
}
/**
* start准备
*/
@ -121,28 +302,6 @@ public class DesignerStartupComponent {
}
/**
* start
*/
@Start
@Metrics
public void start() {
beforeAllStart();
//清空临时文件
TmpFileUtils.cleanUpInnerTmpFiles();
RestartHelper.deleteRecordFilesWhenStart();
CloudCenter.getInstance();
// 创建监听服务
DesignUtils.createListeningServer(DesignUtils.getPort(), startFileSuffix());
// 在插件引擎模块起来前 初始化下插件接口监听
TemplateResourceManager.getResource();
initLanguage();
}
private void registerDaoSelector() {
// 注入设计器db cache 是否可用
@ -174,13 +333,7 @@ public class DesignerStartupComponent {
}
/**
* stop
*/
@Stop
public void stop() {
// void
}
private void initLanguage() {
//这两句的位置不能随便调换,因为会影响语言切换的问题

9
designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java

@ -4,21 +4,20 @@ package com.fanruan.boot.init;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.json.serialization.JsonSerializationActivator;
import com.fr.register.XMLableActivator;
import com.fr.serialization.SerializationActivator;
/**
* 设计器序列化模块初始化通用+json
* 设计器序列化模块初始化
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/24
*/
@FineComponent(name = "design_serialization")
@DependsOn(dependencies = {"design_start_up", "class"})
@ActivatorRefer(refer = {SerializationActivator.class, JsonSerializationActivator.class})
@DependsOn(dependencies = {"design_load"})
@ActivatorRefer(refer = {SerializationActivator.class, JsonSerializationActivator.class, XMLableActivator.class})
public class DesignSerializationComponent {
}

52
designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

@ -6,15 +6,25 @@ import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup;
import com.fanruan.workplace.http.RepositoryManager;
import com.fanruan.workplace.http.WorkspaceHeartBeatShell;
import com.fanruan.workplace.standard.ServerInfo;
import com.fanruan.workplace.standard.ServerInfoOperator;
import com.fr.base.operator.common.CommonOperator;
import com.fr.data.operator.DataOperator;
import com.fr.data.operator.DataOperatorProvider;
import com.fr.decision.service.context.ServiceContext;
import com.fr.design.env.HttpWorkspaceConnector;
import com.fr.env.operator.CommonOperatorImpl;
import com.fr.file.filetree.FileNodes;
import com.fr.file.filetree.LocalFileNodes;
import com.fr.security.encryption.storage.StorageEncryptors;
import com.fr.security.encryption.storage.StorageTransfer;
import com.fr.stable.StringUtils;
import com.fr.stable.script.ExtraFunctionManager;
import com.fr.web.core.ExtraRequestCMDReceiverManager;
import com.fr.web.core.ExtraServiceManager;
import com.fr.workspace.WorkContext;
import com.fr.workspace.base.WorkspaceKey;
import com.fr.workspace.engine.FineWorkspaceFactory;
@ -27,8 +37,10 @@ import com.fr.workspace.pool.WorkRPCRegister;
import com.fr.workspace.pool.WorkRPCType;
import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fr.workspace.server.repository.connect.RemoteNetworkRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.resource.PublicResourceRepository;
import com.fr.workspace.server.repository.resource.WorkResourceRepository;
import com.fr.workspace.server.repository.system.SystemInfoRepository;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
@ -37,14 +49,14 @@ import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.repository.widget.ShareRepository;
/**
* 设计器工作环境调用类初始化模块主要负责将各个模块注册的方法注入进来
* 设计器工作空间构建模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
* Created on 2024/6/7
*/
@FineComponent(name = "design_workcontext")
@DependsOn(dependencies = {"design_pre_load", "i18n", "class", "design_serialization"})
@FineComponent(name = "design_work_context")
@DependsOn(dependencies = "design_serialization")
public class DesignWorkContextComponent {
private static final String VERSION_NUM = "01";
@ -55,15 +67,11 @@ public class DesignWorkContextComponent {
*/
@Supplemental
public void prepare() {
Carina.getApplicationContext().singleton(WorkspaceHeartBeatShell.class).set(new FineWorkspaceHeartbeat());
ServiceContext.group(WorkspaceKey.class).addAll(
WorkRPCRegister.wrap(ServerInfoOperator.class, new ServerInfo()),
WorkRPCRegister.wrap(WorkRPCType.Local, WorkResource.class, FineWorkResource.getInstance()),
WorkRPCRegister.wrap(WorkspaceHeartbeat.class, new FineWorkspaceHeartbeat()),
WorkRPCRegister.wrap(StorageTransfer.class, new StorageEncryptors())
);
supplementalExtra();
supplementalCommon();
}
/**
* start
*/
@ -78,12 +86,13 @@ public class DesignWorkContextComponent {
RepositoryManager.getInstance().pureRegisterRepo4Start(VcsRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(ShareRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(WorkResourceRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(PublicResourceRepository.getInstance());
RepositoryManager.getInstance().initLocalRepository();
for (WorkRPCRegister<?> workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) {
validate(workRPCRegister.getClazz());
FineObjectPool.getInstance().add(workRPCRegister.getClazz(), workRPCRegister.getType(), workRPCRegister.getObject());
}
CompatibleRegister.registerCompatibleEnv();
WorkContext.setConnector(HttpWorkspaceConnector.getInstance());
WorkContext.setFactory(FineWorkspaceFactory.getInstance());
@ -113,4 +122,23 @@ public class DesignWorkContextComponent {
return;
}
}
private void supplementalCommon() {
Carina.getApplicationContext().singleton(WorkspaceHeartBeatShell.class).set(new FineWorkspaceHeartbeat());
Carina.getApplicationContext().group(WorkspaceKey.class).addAll(
WorkRPCRegister.wrap(ServerInfoOperator.class, new ServerInfo()),
WorkRPCRegister.wrap(WorkRPCType.Local, WorkResource.class, FineWorkResource.getInstance()),
WorkRPCRegister.wrap(WorkspaceHeartbeat.class, new FineWorkspaceHeartbeat()),
WorkRPCRegister.wrap(StorageTransfer.class, new StorageEncryptors()),
WorkRPCRegister.wrap(WorkRPCType.Local, FileNodes.class, new LocalFileNodes()),
WorkRPCRegister.wrap(CommonOperator.class, new CommonOperatorImpl()),
WorkRPCRegister.wrap(DataOperatorProvider.class, new DataOperator())
);
}
private void supplementalExtra() {
Carina.getApplicationContext().group(AutonomyClassManagerGroup.class).add(new ExtraRequestCMDReceiverManager());
Carina.getApplicationContext().group(AutonomyClassManagerGroup.class).add(new ExtraServiceManager());
Carina.getApplicationContext().group(AutonomyClassManagerGroup.class).add(new ExtraFunctionManager());
}
}

4
designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java

@ -9,14 +9,14 @@ import com.fr.start.module.optimized.DesignerStartupPageActivator;
/**
* 设计器界面初始化模块
* <p>负责设计器基础界面初始化+设计器启动页初始化</p>
* <p>设计器启动三个阶段中的第二阶段到该模块加载完表示设计器基础的前置初始化界面国际化等杂七杂八的东西全部结束了后面要正式开始数据与功能模块的初始化</p>
* <p>到该模块加载完表示设计器基础的前置初始化界面国际化等杂七杂八的东西全部结束了后面要正式开始数据与功能模块的初始化</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/27
*/
@FineComponent(name = "design_init")
@DependsOn(dependencies = {"design_start_up", "design_workcontext", "design_xml", "design_serialization"})
@DependsOn(dependencies = {"design_work_context"})
@ActivatorRefer(refer = {
DesignerInitActivator.class,
DesignerStartupPageActivator.class,

118
designer-realize/src/main/java/com/fanruan/boot/init/PreLoadComponent.java

@ -1,118 +0,0 @@
package com.fanruan.boot.init;
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.Stop;
import com.fanruan.product.BuildContext;
import com.fanruan.product.ProductConstants;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.measure.DBMeterFactory;
import com.fr.record.DefaultDBMeter;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.StableXMLUtils;
import com.fr.license.function.VT4FR;
import javax.servlet.ServletContext;
/**
* 设计器preload模块主要负责最开始的环境信息与日志处理
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/24
*/
@FineComponent(name = "design_pre_load")
@DependsOn(dependencies = {"design_start_up", "design_tenant"})
public class PreLoadComponent {
/**
* start
*/
@Start
@SuppressWarnings("all")
public void start() {
try {
// PreLoadActivator
startBasic();
// DefaultLogActivator
startLog();
} catch (RuntimeException e) {
throw e;
} finally {
//防止还有什么莫名其妙的 bug 影响到注册的启动。
VT4FR.values();
}
}
private void startBasic() {
BuildContext.setBuildFilePath("/com/fr/stable/build.properties");
Inter.getInstance();
StableXMLUtils.load();
checkWebAppName();
checkWebContextName();
}
private void startLog() {
FineLoggerFactory.registerLogger(FRLogger.getLogger());
DBMeterFactory.register(new DefaultDBMeter());
}
/**
* stop
*/
@Stop
public void stop() {
stopLog();
}
private void stopLog() {
FineLoggerFactory.reset();
DBMeterFactory.remove();
}
/**
* war包部署时登录进入平台后才设置com.fr.stable.ProductConstants.WEB_APP_NAME而证书检查在启动时就开始进行
* 此时ProductConstants.WEB_APP_NAME == null LicenseMatchInfo的isAppNameMatch会被设置为false导致war包部署重启证书不生效
*/
private void checkWebAppName() {
ServletContext context = Carina.getApplicationContext().getServletContext();
if (context != null) {
if (ProductConstants.getWebAppName() == null) {
String contextPath = context.getContextPath();
if (StringUtils.isNotEmpty(contextPath)) {
if (contextPath.startsWith("/")) {
contextPath = contextPath.substring(1);
}
ProductConstants.setWebAppName(contextPath);
}
}
}
}
private void checkWebContextName() {
ServletContext context = Carina.getApplicationContext().getServletContext();
if (context != null) {
if (ProductConstants.getWebContextName() == null) {
String contextPath = context.getContextPath();
if (null != contextPath) {
if (contextPath.startsWith("/")) {
contextPath = contextPath.substring(1);
}
ProductConstants.setWebContextName(contextPath);
}
}
}
}
}

23
designer-realize/src/main/java/com/fanruan/boot/init/XMLableComponent.java

@ -1,23 +0,0 @@
package com.fanruan.boot.init;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.register.XMLableActivator;
/**
* XML模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/27
*/
@FineComponent(name = "design_xml")
@DependsOn(dependencies = {"design_start_up"})
@ActivatorRefer(refer = {XMLableActivator.class})
public class XMLableComponent {
}

31
designer-realize/src/main/java/com/fanruan/boot/pre/DesignConfigComponent.java

@ -1,31 +0,0 @@
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());
}
}

27
designer-realize/src/main/java/com/fanruan/boot/pre/DesignPluginSupplementComponent.java

@ -1,27 +0,0 @@
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();
}
}

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

@ -1,17 +1,19 @@
package com.fanruan.boot.pre;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.boot.mem.MemConfigRepositoryBuilder;
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.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.fr.base.function.UITerminator;
import com.fr.carina.revert.CarinaRevertManager;
import com.fr.carina.revert.provider.CarinaPluginProvider;
import com.fr.design.DesignerEnvManager;
import com.fr.design.deeplink.DeepLinkManager;
import com.fr.design.fun.OemProcessor;
@ -26,38 +28,58 @@ 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.plugin.ExtraClassManager;
import com.fr.runtime.FineRuntime;
import com.fr.stable.fun.ResourcePathTransformer;
import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.start.DesignContext;
import com.fr.start.DesignLauncher;
import com.fr.stable.plugin.ExtraClassManagerProvider;
import com.fr.stable.resource.ResourceLoader;
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 com.fr.tenant.config.TenantConfigProvider;
import com.fr.tenant.context.PlatformScaffoldTenantStarter;
import com.fr.tenant.context.TenantContext;
import com.fr.tenant.context.provider.CurrentTenantKey;
import com.fr.tenant.store.impl.DefaultTenantStorage;
import com.fr.web.controller.common.FileContentModificator;
import com.fr.web.controller.plugin.PluginFileContentModificator;
import com.fr.web.file.FileContentProcessorFactory;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
/**
* 设计器启动前处理的模块入口
* 设计器启动前准备模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/31
* Created on 2024/6/7
*/
@FineComponent(name = "design_pre_start")
@DependsOn(dependencies = {"design_universal_config", "design_tenant", "design_plugin_supplement"})
public class DesignPreStartComponent {
/**
* start
*/
@Start
public void start() {
// 1.注册ConfigFactory与对应的membuilder
startUniversalConfig();
// 2.start本地租户配置
startTenant();
// 3.pluginPrepare,注册插件的反向依赖
startPluginPrepare();
// 4.正式启动
startPre();
}
private void startPre() {
DesignerEnvManager.getEnvManager();
startPreload0();
@ -85,6 +107,63 @@ public class DesignPreStartComponent {
}
}
private void startPluginPrepare() {
CarinaRevertManager.setCarinaPluginProvider(new CarinaPluginProvider() {
@Override
public InputStream getResourceAsStream(String name, Class<?> caller) {
return ResourceLoader.getResourceAsStream(name, caller);
}
@Override
public String transformPath(String path) {
Set<ResourcePathTransformer> set = getResourcePathTransformers();
for (ResourcePathTransformer transformer : set) {
if (transformer.accept(path)) {
return transformer.transform(path);
}
}
return path;
}
@Override
public String dealWithFileContentModificator(String content, HttpServletRequest req, String path) {
String modifiedContent = FileContentProcessorFactory.getInstance().modify(content, path, req);
FileContentModificator pluginFileContentModificator = new PluginFileContentModificator();
if (pluginFileContentModificator.accept(req, path)) {
return pluginFileContentModificator.modify(modifiedContent, req, path);
}
return modifiedContent;
}
private Set<ResourcePathTransformer> getResourcePathTransformers() {
Set<ResourcePathTransformer> set = new HashSet<>();
ExtraClassManagerProvider provider = ExtraClassManager.getInstance();
if (provider != null) {
Set<ResourcePathTransformer> pluginProvided = provider.getArray(ResourcePathTransformer.MARK_STRING);
set.addAll(pluginProvided);
}
return set;
}
});
}
private void startTenant() {
TenantContext.registerStorage(new DefaultTenantStorage());
TenantContext.registerConfigProvider(new TenantConfigProvider() {
@Override
public boolean isMultiTenantOpen() {
return false;
}
});
PlatformScaffoldTenantStarter.start(new ArrayList<>(Carina.getApplicationContext().group(CurrentTenantKey.class).getAll()));
}
private void startUniversalConfig() {
ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.SHARE, new ShareConfigProviderImpl());
ConfigProviderFactory.getInstance().registerProvider(ConfigRealm.PUBLIC, new PublicConfigProviderImpl());
ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new MemConfigRepositoryBuilder());
}
/**
@ -149,5 +228,4 @@ public class DesignPreStartComponent {
return new SplashCommon();
}
}

51
designer-realize/src/main/java/com/fanruan/boot/pre/DesignTenantComponent.java

@ -1,51 +0,0 @@
package com.fanruan.boot.pre;
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.Stop;
import com.fr.tenant.config.TenantConfigProvider;
import com.fr.tenant.context.PlatformScaffoldTenantStarter;
import com.fr.tenant.context.TenantContext;
import com.fr.tenant.context.provider.CurrentTenantKey;
import com.fr.tenant.store.impl.DefaultTenantStorage;
import java.util.ArrayList;
/**
* 设计器多租户模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/24
*/
@FineComponent(name = "design_tenant")
@DependsOn(dependencies = {})
public class DesignTenantComponent {
/**
* start
*/
@Start
public void start() {
TenantContext.registerStorage(new DefaultTenantStorage());
TenantContext.registerConfigProvider(new TenantConfigProvider() {
@Override
public boolean isMultiTenantOpen() {
return false;
}
});
PlatformScaffoldTenantStarter.start(new ArrayList<>(Carina.getApplicationContext().group(CurrentTenantKey.class).getAll()));
}
/**
* stop
*/
@Stop
public void stop() {
PlatformScaffoldTenantStarter.stop();
}
}

39
designer-realize/src/main/java/com/fanruan/boot/show/DesignConfConfigComponent.java

@ -1,39 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.boot.ConfConfigComponent;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.JPAEntityScan;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
/**
* 设计器Conf_config模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "design_conf_config")
@JPAEntityScan("com.fr.config.entity")
@DependsOn(dependencies = {"design_dao", "design_core_supplemental"})
public class DesignConfConfigComponent extends ConfConfigComponent {
/**
* start
*/
@Start
public void start() {
super.start();
}
/**
* stop
*/
@Stop
public void stop() {
super.stop();
}
}

47
designer-realize/src/main/java/com/fanruan/boot/show/DesignCoreSupplementalComponent.java

@ -1,47 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.boot.CoreSupplementalComponent;
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.carina.annotions.Supplemental;
/**
* 设计器core_supplemental模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "design_core_supplemental")
@DependsOn(dependencies = {"env"})
public class DesignCoreSupplementalComponent extends CoreSupplementalComponent {
/**
* prepare
*/
@Supplemental
public void supplemental() {
super.supplemental();
}
/**
* start
*/
@Start
public void start() {
super.start();
}
/**
* stop
*/
@Stop
public void stop() {
super.stop();
}
}

19
designer-realize/src/main/java/com/fanruan/boot/show/DesignEnvComponent.java

@ -1,19 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.env.EnvPrepare;
import com.fr.start.module.DesignerWorkspaceProvider;
/**
* 设计器基础环境准备组件
* <p>主要负责创建切换工作环境</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "env")
@ActivatorRefer(refer = {DesignerWorkspaceProvider.class, EnvPrepare.class})
public class DesignEnvComponent {
}

39
designer-realize/src/main/java/com/fanruan/boot/show/DesignFsComponent.java

@ -1,39 +0,0 @@
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);
}
}

24
designer-realize/src/main/java/com/fanruan/boot/show/DesignFunctionComponent.java

@ -1,24 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.chart.activator.ChartBaseActivator;
import com.fr.data.DatasourceActivator;
import com.fr.form.module.FormBaseActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.workspace.server.vcs.VcsFolderManagerActivator;
/**
* 设计器基础功能组件
* <p>主要是图表reportvcsform相关的基础初始化</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/27
*/
@FineComponent(name = "design_function")
@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config", "design_update"})
@ActivatorRefer(refer = {DatasourceActivator.class, ChartBaseActivator.class, ReportBaseActivator.class, VcsFolderManagerActivator.class, FormBaseActivator.class})
public class DesignFunctionComponent {
}

39
designer-realize/src/main/java/com/fanruan/boot/show/DesignLoggerComponent.java

@ -1,39 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.boot.LoggerComponent;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
/**
* 设计器日志模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "design_logger")
@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config"})
public class DesignLoggerComponent extends LoggerComponent {
/**
* start
*/
@Start
public void start() {
super.start();
}
/**
* stop
*/
@Stop
public void stop() {
super.stop();
}
}

19
designer-realize/src/main/java/com/fanruan/boot/show/DesignUpdateComponent.java

@ -1,19 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.start.module.optimized.DesignUpdateActivator;
/**
* 设计器更新模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/27
*/
@FineComponent(name = "design_update")
@ActivatorRefer(refer = DesignUpdateActivator.class)
@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config", "design_plugin"})
public class DesignUpdateComponent {
}

21
designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceComponent.java

@ -1,21 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.start.module.DesignerWorkspaceActivator;
/**
* 设计器工作环境组件
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "workspace_after")
@ActivatorRefer(refer = DesignerWorkspaceActivator.class)
@DependsOn(dependencies = "design")
public class DesignWorkspaceComponent {
}

19
designer-realize/src/main/java/com/fanruan/boot/show/DesignWorkspaceRegisterComponent.java

@ -1,19 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.startup.WorkspaceRegister;
/**
* 用于注册工作环境需要的一些额外的方法与类
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "design_register")
@DependsOn(dependencies = "workcontext")
@ActivatorRefer(refer = WorkspaceRegister.class)
public class DesignWorkspaceRegisterComponent {
}

24
designer-realize/src/main/java/com/fanruan/boot/show/DesignerComponent.java

@ -1,24 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fr.design.chart.ChartDesignerActivator;
import com.fr.design.mainframe.app.DesignerAppActivator;
import com.fr.design.record.analyzer.DesignerAnalyzerActivator;
import com.fr.start.module.DesignerActivator;
import com.fr.start.module.DesignerESDActivator;
/**
* 设计器模块
* <p>主要负责设计器的主要功能逻辑初始化</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "design")
@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config","design_fs", "design_function"})
@ActivatorRefer(refer = {DesignerActivator.class, DesignerAppActivator.class, ChartDesignerActivator.class, DesignerESDActivator.class, DesignerAnalyzerActivator.class})
public class DesignerComponent {
}

39
designer-realize/src/main/java/com/fanruan/boot/show/DesignerDaoComponent.java

@ -1,39 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.boot.DAOComponent;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
/**
* 设计器dao层模块
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name ="design_dao")
@DependsOn(dependencies = {"design_core_supplemental"})
public class DesignerDaoComponent extends DAOComponent {
/**
* start
*/
@Start
public void start() {
super.start();
}
/**
* stop
*/
@Stop
public void stop() {
super.stop();
}
}

43
designer-realize/src/main/java/com/fanruan/boot/show/DesignerShowComponent.java

@ -1,43 +0,0 @@
package com.fanruan.boot.show;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.quickeditor.chartquick.BasicChartQuickEditor;
import com.fr.start.DesignerInitial;
import com.fr.start.common.DesignerStartupExecutor;
import com.fr.workspace.WorkContext;
/**
* 设计器启动最后一阶段入口
* <p>从该Component start进去后会从daoconfig初始化基础功能模块初始化完毕后会show设计器面板</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "design_show")
@DependsOn(dependencies = "workspace_after")
public class DesignerShowComponent {
/**
* start
*/
@Start
public void start() {
DesignerInitial.prepare();
DesignerStartupExecutor.getInstance().execute(() -> DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE));
//生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);)
//所以不能在registerCellEditor函数中进行注册
ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor());
if (DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter() && WorkContext.getCurrent().isLocal()) {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter());
}
}
}

34
designer-realize/src/main/java/com/fanruan/fs/DesignFileRepository.java

@ -0,0 +1,34 @@
package com.fanruan.fs;
import com.fanruan.fs.repository.local.LocalFileRepository;
import com.fr.decision.service.context.ServiceContext;
import com.fr.io.repository.FineFileEntry;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.server.entity.resource.ResourceBean;
import com.fr.workspace.server.repository.resource.PublicResourceRepository;
/**
* DesignFileRepository
* <p>设计器需要用的方法在这里重写即可</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/6/6
*/
public class DesignFileRepository extends LocalFileRepository {
public DesignFileRepository() {
super(ProjectConstants.LOCAL_ENV, ServiceContext.getWebInfPath());
}
@Override
public String getWorkRoot() {
return PublicResourceRepository.getInstance().getWorkRoot();
}
@Override
public FineFileEntry[] listEntry(String dir) {
return PublicResourceRepository.getInstance().listEntry(new ResourceBean(dir));
}
}

2
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -204,7 +204,7 @@ public class DesignerActivator extends Activator implements Prepare {
}
}, SupportOSImpl.BBS_USER_LOGIN_PANE);
loadLogAppender();
DesignerSocketIO.update();
//DesignerSocketIO.update();
DesignerWorkspaceLoader.init();
storePassport();
AlphaFineHelper.switchConfig4Locale();

23
designer-realize/src/main/java/com/fr/start/util/DesignerStartupPageUtil.java

@ -1,6 +1,15 @@
package com.fr.start.util;
import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.quickeditor.chartquick.BasicChartQuickEditor;
import com.fr.start.DesignerInitial;
import com.fr.start.common.DesignerStartupExecutor;
import com.fr.workspace.WorkContext;
/**
@ -12,15 +21,25 @@ public class DesignerStartupPageUtil {
* 进入工作目录
*/
public static void enterWorkspace() throws Exception {
BootstrapFactory.get().start("design_show");
BootstrapFactory.get().start("design_env_choose");
BootstrapFactory.get().start("design_function");
DesignerInitial.prepare();
DesignerStartupExecutor.getInstance().execute(() -> DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE));
//生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);)
//所以不能在registerCellEditor函数中进行注册
ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor());
if (DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter() && WorkContext.getCurrent().isLocal()) {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter());
}
}
/**
* 退出工作目录
*/
public static void exitWorkspace() throws Exception {
BootstrapFactory.get().stop("design_show");
BootstrapFactory.get().stop("design_function");
BootstrapFactory.get().stop("design_env_choose");
}
}

Loading…
Cancel
Save