Destiny.Lin
6 months ago
29 changed files with 1020 additions and 710 deletions
@ -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); |
||||
} |
||||
|
||||
} |
@ -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(); |
||||
} |
||||
} |
@ -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>主要是图表、report、vcs、form相关的基础初始化</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 { |
||||
} |
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -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 { |
||||
|
||||
|
||||
} |
@ -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()); |
||||
} |
||||
} |
@ -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(); |
||||
} |
||||
} |
@ -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(); |
||||
} |
||||
} |
@ -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(); |
||||
} |
||||
} |
@ -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(); |
||||
} |
||||
} |
@ -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 { |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -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>主要是图表、report、vcs、form相关的基础初始化</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 { |
||||
} |
@ -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(); |
||||
} |
||||
} |
@ -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 { |
||||
} |
@ -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 { |
||||
|
||||
|
||||
} |
@ -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 { |
||||
} |
@ -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 { |
||||
} |
@ -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(); |
||||
} |
||||
|
||||
} |
@ -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进去后会从dao、config初始化,基础功能模块初始化完毕后会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()); |
||||
} |
||||
} |
||||
} |
@ -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)); |
||||
} |
||||
} |
Loading…
Reference in new issue