Destiny.Lin
6 months ago
52 changed files with 1806 additions and 176 deletions
@ -0,0 +1,63 @@
|
||||
package com.fr.design.extra; |
||||
|
||||
|
||||
import com.fanruan.carina.Carina; |
||||
import com.fanruan.plugin.design.loader.PluginResourceLoaderSingletonShell; |
||||
import com.fanruan.plugin.design.loader.UPMResourceLoaderSingletonShell; |
||||
import com.fanruan.plugin.design.store.PluginStoreProvider; |
||||
import com.fanruan.plugin.design.store.PluginStoreSingletonShell; |
||||
import com.fr.decision.webservice.v10.plugin.helper.category.ResourceLoader; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 用于设计器调用插件内部资源 |
||||
* <p>对应的资源需要提前注册进环境里</p> |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/14 |
||||
*/ |
||||
public class PluginHelper { |
||||
private PluginStoreProvider storeProvider; |
||||
private ResourceLoader upmLoader; |
||||
private ResourceLoader pluginLoader; |
||||
private static final PluginHelper INSTANCE = new PluginHelper(); |
||||
|
||||
private PluginHelper() { |
||||
storeProvider = Carina.getApplicationContext().singleton(PluginStoreSingletonShell.class).get(); |
||||
upmLoader = Carina.getApplicationContext().singleton(UPMResourceLoaderSingletonShell.class).get(); |
||||
pluginLoader = Carina.getApplicationContext().singleton(PluginResourceLoaderSingletonShell.class).get(); |
||||
} |
||||
|
||||
/** |
||||
* 获取插件helper单例 |
||||
*/ |
||||
public static PluginHelper getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
public PluginStoreProvider getStoreProvider() { |
||||
return storeProvider; |
||||
} |
||||
|
||||
public void setStoreProvider(PluginStoreProvider storeProvider) { |
||||
this.storeProvider = storeProvider; |
||||
} |
||||
|
||||
public ResourceLoader getUpmLoader() { |
||||
return upmLoader; |
||||
} |
||||
|
||||
public void setUpmLoader(ResourceLoader upmLoader) { |
||||
this.upmLoader = upmLoader; |
||||
} |
||||
|
||||
public ResourceLoader getPluginLoader() { |
||||
return pluginLoader; |
||||
} |
||||
|
||||
public void setPluginLoader(ResourceLoader pluginLoader) { |
||||
this.pluginLoader = pluginLoader; |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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(); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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(); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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 { |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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.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 = {ChartBaseActivator.class, ReportBaseActivator.class, VcsFolderManagerActivator.class, FormBaseActivator.class}) |
||||
public class DesignFunctionComponent { |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
|
||||
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(); |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
|
||||
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.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}) |
||||
public class DesignSerializationComponent { |
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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 = {"design_start_up"}) |
||||
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(); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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 { |
||||
} |
@ -0,0 +1,99 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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; |
||||
import com.fanruan.workplace.standard.ServerInfo; |
||||
import com.fanruan.workplace.standard.ServerInfoOperator; |
||||
import com.fr.decision.service.context.ServiceContext; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.security.encryption.storage.StorageEncryptors; |
||||
import com.fr.security.encryption.storage.StorageTransfer; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.base.WorkspaceAPI; |
||||
import com.fr.workspace.base.WorkspaceKey; |
||||
import com.fr.workspace.engine.FineWorkspaceFactory; |
||||
import com.fr.workspace.engine.base.FineObjectPool; |
||||
import com.fr.workspace.engine.client.FineWorkspaceConnector; |
||||
import com.fr.workspace.engine.client.heartbeart.FineWorkspaceHeartbeat; |
||||
import com.fr.workspace.engine.client.heartbeart.WorkspaceHeartbeat; |
||||
import com.fr.workspace.engine.resource.FineWorkResource; |
||||
import com.fr.workspace.engine.resource.FineWorkResourceAdaptor; |
||||
import com.fr.workspace.pool.WorkRPCRegister; |
||||
import com.fr.workspace.pool.WorkRPCType; |
||||
import com.fr.workspace.resource.WorkResource; |
||||
|
||||
/** |
||||
* 设计器工作环境调用类初始化模块,主要负责将各个模块注册的方法注入进来 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/28 |
||||
*/ |
||||
@FineComponent(name = "design_workcontext") |
||||
@DependsOn(dependencies = {"design_start_up", "i18n", "class", "design_serialization"}) |
||||
public class DesignWorkContextComponent { |
||||
|
||||
private static final String VERSION_NUM = "01"; |
||||
|
||||
|
||||
/** |
||||
* prepare |
||||
*/ |
||||
@Supplemental |
||||
public void prepare() { |
||||
// 纯启动部分的代码不涉及Repository的更改,下一批提交会改掉
|
||||
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()) |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* start |
||||
*/ |
||||
@Start |
||||
public void start() { |
||||
for (WorkRPCRegister<?> workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) { |
||||
validate(workRPCRegister.getClazz()); |
||||
FineObjectPool.getInstance().add(workRPCRegister.getClazz(), workRPCRegister.getType(), workRPCRegister.getObject()); |
||||
} |
||||
|
||||
|
||||
WorkContext.setConnector(FineWorkspaceConnector.getInstance()); |
||||
WorkContext.setFactory(FineWorkspaceFactory.getInstance()); |
||||
WorkContext.setWorkResource(new FineWorkResourceAdaptor()); |
||||
|
||||
WorkContext.setVersion(VERSION_NUM + "#" + ServiceContext.group(WorkspaceKey.class).getAll().size()); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* stop |
||||
*/ |
||||
@Stop |
||||
public void stop() { |
||||
|
||||
FineObjectPool.getInstance().reset(); |
||||
WorkContext.setConnector(null); |
||||
WorkContext.setFactory(null); |
||||
WorkContext.setWorkResource(null); |
||||
WorkContext.setVersion(StringUtils.EMPTY); |
||||
} |
||||
|
||||
|
||||
private void validate(Class<?> clazz) { |
||||
|
||||
if (clazz == null) { |
||||
return; |
||||
} |
||||
if (clazz.getAnnotation(WorkspaceAPI.class) == null) { |
||||
FineLoggerFactory.getLogger().warn("workspace service {} not annotated with @Workspace.", clazz); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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 { |
||||
|
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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 { |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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_function"}) |
||||
@ActivatorRefer(refer = {DesignerActivator.class, DesignerAppActivator.class, ChartDesignerActivator.class, DesignerESDActivator.class, DesignerAnalyzerActivator.class}) |
||||
public class DesignerComponent { |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
|
||||
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(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
import com.fanruan.carina.annotions.ActivatorRefer; |
||||
import com.fanruan.carina.annotions.DependsOn; |
||||
import com.fanruan.carina.annotions.FineComponent; |
||||
import com.fr.start.module.DesignerInitActivator; |
||||
import com.fr.start.module.optimized.DesignerStartupPageActivator; |
||||
|
||||
/** |
||||
* 设计器界面初始化模块 |
||||
* <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_tenant", "design_workcontext", "design_xml", "design_serialization"}) |
||||
@ActivatorRefer(refer = { |
||||
DesignerInitActivator.class, |
||||
DesignerStartupPageActivator.class, |
||||
}) |
||||
public class DesignerInitComponent { |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,43 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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,194 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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.product.BuildContext; |
||||
import com.fr.base.OptimizeUtil; |
||||
import com.fr.config.dao.DaoSelectorFactory; |
||||
import com.fr.config.dao.PropertiesConstants; |
||||
import com.fr.decision.webservice.v10.encryption.EncryptionConstants; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.RestartHelper; |
||||
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.GeneralContext; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
import com.fr.record.analyzer.Metrics; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.project.ProjectConstants; |
||||
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 org.jetbrains.annotations.NotNull; |
||||
|
||||
import java.io.File; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* 设计器启动检查模块 |
||||
* <p>负责设计器启动的前置清理与检查,是一切设计器模块的起点</p> |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/24 |
||||
*/ |
||||
@EnableMetrics |
||||
@FineComponent(name = "design_start_up") |
||||
public class DesignerStartupComponent { |
||||
|
||||
private NotNullLazyValue<StartupArgs> startupArgsValue = new NotNullLazyValue<StartupArgs>() { |
||||
@NotNull |
||||
@Override |
||||
protected StartupArgs compute() { |
||||
return Carina.getApplicationContext().singleton(StartupArgsShell.class).get(); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* start准备 |
||||
*/ |
||||
public void beforeAllStart() { |
||||
|
||||
BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); |
||||
|
||||
registerDaoSelector(); |
||||
|
||||
Stopwatch beforeWatch = Stopwatch.createStarted(); |
||||
PreLoadService.getInstance().waitForCommon(); |
||||
FineLoggerFactory.getLogger().debug( "DesignerStartup cost {} ms to wait load", beforeWatch.elapsed(TimeUnit.MILLISECONDS)); |
||||
|
||||
if (DesignUtils.isStarted()) { |
||||
// 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了
|
||||
final String[] args = startupArgsValue.getValue().get(); |
||||
if (ArrayUtils.isNotEmpty(args)) { |
||||
DesignUtils.clientSend(args); |
||||
} |
||||
FineLoggerFactory.getLogger().info("The Designer Has Been Started"); |
||||
if (args.length == 0) { |
||||
TipDialog dialog = new TipDialog(null, |
||||
DesignerProcessType.INSTANCE.obtain(), |
||||
Toolkit.i18nText("Fine-Design_Last_Designer_Process_Not_Exist"), |
||||
Toolkit.i18nText("Fine-Design_End_Occupied_Process"), |
||||
Toolkit.i18nText("Fine-Design_Basic_Cancel")) { |
||||
@Override |
||||
protected void endEvent() { |
||||
dispose(); |
||||
DesignUtils.clientSend(new String[]{"end"}); |
||||
RestartHelper.restart(); |
||||
} |
||||
|
||||
@Override |
||||
protected void cancelEvent() { |
||||
dispose(); |
||||
} |
||||
}; |
||||
dialog.setVisible(true); |
||||
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId(), |
||||
DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage(), |
||||
StringUtils.EMPTY); |
||||
FineLoggerFactory.getLogger().error( "{}: {}", DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getId(), DesignerErrorMessage.DESIGNER_PROCESS_OCCUPIED.getMessage()); |
||||
} |
||||
DesignerExiter.getInstance().execute(); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 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 是否可用
|
||||
DesignerWorkspaceInfo info = WorkspaceUtils.getWorkspaceInfo(); |
||||
if (info.getType() == DesignerWorkspaceType.Remote) { |
||||
DaoSelectorFactory.registerDaoSelector(() -> false); |
||||
} else { |
||||
String webInfPath = WorkspaceUtils.getWorkspaceInfo().getPath(); |
||||
String dbConfigPath = StableUtils.pathJoin(webInfPath, ProjectConstants.CONFIG_DIRECTORY, |
||||
EncryptionConstants.PROPERTY_NAME); |
||||
String entityPath = generatePath(webInfPath, PropertiesConstants.ENTITY_PROP); |
||||
String xmlEntityPath = generatePath(webInfPath, PropertiesConstants.XML_ENTITY_PROP); |
||||
String classNamePath = generatePath(webInfPath, PropertiesConstants.CLASS_NAME_PROP); |
||||
// 校验 平台迁移文件/缓存文件
|
||||
boolean existPropCache = new File(entityPath).exists() && new File(xmlEntityPath).exists() && new File(classNamePath).exists(); |
||||
DaoSelectorFactory.registerDaoSelector(() -> DesignerEnvManager.getEnvManager().isPropertiesUsable() |
||||
&& OptimizeUtil.isOpen() |
||||
&& existPropCache |
||||
// demo启动时 前后目录可能会不一致 造成读取缓存失败
|
||||
&& !startupArgsValue.getValue().isDemo() |
||||
&& !new File(dbConfigPath).exists()); |
||||
|
||||
} |
||||
} |
||||
|
||||
private String generatePath(String webInfPath, String name) { |
||||
return StableUtils.pathJoin(webInfPath, ProjectConstants.EMBED_DB_DIRECTORY, |
||||
ProjectConstants.PROPERTIES_CACHE_FOR_CONFIG, name); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* stop |
||||
*/ |
||||
@Stop |
||||
public void stop() { |
||||
// void
|
||||
} |
||||
|
||||
private void initLanguage() { |
||||
//这两句的位置不能随便调换,因为会影响语言切换的问题
|
||||
GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLanguage()); |
||||
} |
||||
|
||||
private String[] startFileSuffix() { |
||||
|
||||
return new String[]{".cpt", ".xls", ".xlsx", ".frm", ".form", ".cht", ".chart"}; |
||||
} |
||||
} |
@ -0,0 +1,118 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fanruan.boot; |
||||
|
||||
|
||||
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 { |
||||
|
||||
|
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fanruan.boot.key; |
||||
|
||||
import com.fr.decision.service.context.MutableGroup; |
||||
import com.fr.module.engine.base.ActivatorContext; |
||||
|
||||
/** |
||||
* 传输启动器上下文的group |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/27 |
||||
*/ |
||||
public class ActivatorContextGroup extends MutableGroup<ActivatorContext> { |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fanruan.boot.key; |
||||
|
||||
import com.fr.decision.service.context.SingletonShell; |
||||
import com.fr.start.module.StartupArgs; |
||||
|
||||
/** |
||||
* StartupArgsShell |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/24 |
||||
*/ |
||||
public class StartupArgsShell extends SingletonShell<StartupArgs> { |
||||
} |
@ -0,0 +1,83 @@
|
||||
package com.fr.start; |
||||
|
||||
import com.fanruan.boot.key.StartupArgsShell; |
||||
import com.fanruan.carina.Carina; |
||||
import com.fanruan.carina.context.CarinaApplicationContext; |
||||
import com.fanruan.carina.standard.PartitionManager; |
||||
import com.fanruan.carina.standard.PartitionManagerImpl; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.carton.SwitchForSwingChecker; |
||||
import com.fr.design.deeplink.DeepLinkManager; |
||||
import com.fr.design.monitor.DesignerLifecycleMonitorContext; |
||||
import com.fr.event.Event; |
||||
import com.fr.event.EventDispatcher; |
||||
import com.fr.event.Listener; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.module.engine.event.LifecycleErrorEvent; |
||||
import com.fr.runtime.FineRuntime; |
||||
import com.fr.stable.lifecycle.FineLifecycleFatalError; |
||||
import com.fr.start.common.DesignerStartupContext; |
||||
import com.fr.start.module.StartupArgs; |
||||
import com.fr.workspace.WorkContext; |
||||
|
||||
import java.util.Properties; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
/** |
||||
* Designer |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/14 |
||||
*/ |
||||
public class CarinaDesigner extends MainDesigner{ |
||||
|
||||
public CarinaDesigner(String[] args) { |
||||
super(args); |
||||
} |
||||
|
||||
/** |
||||
* main |
||||
*/ |
||||
public static void main(String[] args) { |
||||
|
||||
DesignerStartupContext.getRecorder().start(); |
||||
PartitionManager manager = new PartitionManagerImpl(); |
||||
CarinaApplicationContext carinaApplicationContext = new DesignContext(new EmptyServletContext(), manager, new Properties()); |
||||
Carina.setApplicationContext(carinaApplicationContext); |
||||
Carina.setPartitionManager(manager); |
||||
DesignLauncher.setContext(carinaApplicationContext); |
||||
DesignerEnvManager.getEnvManager(); |
||||
|
||||
startPreload0(); |
||||
|
||||
DesignerLifecycleMonitorContext.getMonitor().beforeStart(); |
||||
//启动运行时
|
||||
FineRuntime.start(); |
||||
//等 FineRuntime 启动后启动
|
||||
DeepLinkManager.getInstance().start(args); |
||||
|
||||
startPreload1(); |
||||
|
||||
DesignerSubListener.getInstance().start(); |
||||
EventDispatcher.listen(LifecycleErrorEvent.SELF, new Listener<FineLifecycleFatalError>() { |
||||
@Override |
||||
public void on(Event event, FineLifecycleFatalError param) { |
||||
LifecycleFatalErrorHandler.getInstance().handle(param); |
||||
} |
||||
}); |
||||
DesignLauncher launch = new DesignLauncher("/com/fr/config/starter/designer-startup-carina.xml"); |
||||
try { |
||||
FineLoggerFactory.getLogger().debug("Designer prepared.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); |
||||
Carina.getApplicationContext().singleton(StartupArgsShell.class).set(new StartupArgs(args)); |
||||
launch.launch(); |
||||
} catch (Exception e) { |
||||
throw new RuntimeException(e); |
||||
} |
||||
|
||||
FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); |
||||
|
||||
SwitchForSwingChecker.initThreadMonitoring(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.start; |
||||
|
||||
import com.fanruan.carina.context.CarinaApplicationContext; |
||||
import com.fanruan.carina.standard.PartitionManager; |
||||
import com.fanruan.carina.standard.PartitionManagerImpl; |
||||
|
||||
import javax.servlet.ServletContext; |
||||
|
||||
import java.util.Properties; |
||||
|
||||
/** |
||||
* 设计器上下文环境 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/14 |
||||
*/ |
||||
public class DesignContext extends CarinaApplicationContext { |
||||
private String designWebInfPath; |
||||
|
||||
public DesignContext() { |
||||
super(new EmptyServletContext(), new PartitionManagerImpl(), new Properties()); |
||||
} |
||||
|
||||
public DesignContext(ServletContext servletContext, PartitionManager manager, Properties carinaApplicationProperties) { |
||||
super(servletContext, manager, carinaApplicationProperties); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String getWebInfPath() { |
||||
return designWebInfPath; |
||||
} |
||||
|
||||
public String getDesignWebInfPath() { |
||||
return designWebInfPath; |
||||
} |
||||
|
||||
public void setDesignWebInfPath(String designWebInfPath) { |
||||
this.designWebInfPath = designWebInfPath; |
||||
} |
||||
} |
@ -0,0 +1,88 @@
|
||||
package com.fr.start; |
||||
|
||||
import com.fanruan.boot.DiscoveryProperties; |
||||
import com.fanruan.carina.Carina; |
||||
import com.fanruan.carina.context.CarinaApplicationContext; |
||||
import com.fanruan.carina.exceptions.CarinaException; |
||||
import com.fanruan.carina.launch.XmlCarinaLauncher; |
||||
import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory; |
||||
import com.fanruan.discovery.DiscoveryFactory; |
||||
|
||||
import javax.servlet.ServletContext; |
||||
import java.util.Properties; |
||||
|
||||
/** |
||||
* 设计器启动的launcher,用来自定义具体的launcher逻辑 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/27 |
||||
*/ |
||||
public class DesignLauncher extends XmlCarinaLauncher { |
||||
private static CarinaApplicationContext context; |
||||
public DesignLauncher(String path) { |
||||
super(context.getPartitionManager(), context.getServletContext(), context.getCarinaApplicationProperties(), path); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean validate(Class<?> clz) { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected CarinaApplicationContext createApplicationContext(ServletContext servletContext, Properties carinaApplicationProperties) { |
||||
return context; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void initServiceDiscovery() throws CarinaException { |
||||
try { |
||||
Carina.properties(DiscoveryProperties.class).setServer("local"); |
||||
// 服务发现初始化
|
||||
DiscoveryFactory.initialize(); |
||||
} catch (Exception e) { |
||||
throw new CarinaException(e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void initializeSpring() throws CarinaException { |
||||
// do nothing
|
||||
} |
||||
|
||||
@Override |
||||
protected void startListening() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected void setGlobalInformation() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected void startComponentsAndServices() throws CarinaException { |
||||
try { |
||||
BootstrapFactory.get().supplement(); |
||||
BootstrapFactory.get().start("design_init"); |
||||
} catch (Exception e) { |
||||
throw new RuntimeException(e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取context |
||||
*/ |
||||
public static CarinaApplicationContext getContext() { |
||||
return context; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置context |
||||
*/ |
||||
public static void setContext(CarinaApplicationContext context) { |
||||
DesignLauncher.context = context; |
||||
} |
||||
} |
@ -0,0 +1,290 @@
|
||||
package com.fr.start; |
||||
|
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.servlet.Filter; |
||||
import javax.servlet.FilterRegistration; |
||||
import javax.servlet.RequestDispatcher; |
||||
import javax.servlet.Servlet; |
||||
import javax.servlet.ServletContext; |
||||
import javax.servlet.ServletException; |
||||
import javax.servlet.ServletRegistration; |
||||
import javax.servlet.SessionCookieConfig; |
||||
import javax.servlet.SessionTrackingMode; |
||||
import javax.servlet.descriptor.JspConfigDescriptor; |
||||
import java.io.InputStream; |
||||
import java.net.MalformedURLException; |
||||
import java.net.URL; |
||||
import java.util.Enumeration; |
||||
import java.util.EventListener; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* EmptyServletContext |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/5/15 |
||||
*/ |
||||
public class EmptyServletContext implements ServletContext { |
||||
@Override |
||||
public String getContextPath() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public ServletContext getContext(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public int getMajorVersion() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int getMinorVersion() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int getEffectiveMajorVersion() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public int getEffectiveMinorVersion() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public String getMimeType(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Set<String> getResourcePaths(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public URL getResource(String s) throws MalformedURLException { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public InputStream getResourceAsStream(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public RequestDispatcher getRequestDispatcher(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public RequestDispatcher getNamedDispatcher(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Servlet getServlet(String s) throws ServletException { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Enumeration<Servlet> getServlets() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Enumeration<String> getServletNames() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void log(String s) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void log(Exception e, String s) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void log(String s, Throwable throwable) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getRealPath(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String getServerInfo() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String getInitParameter(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Enumeration<String> getInitParameterNames() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public boolean setInitParameter(String s, String s1) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public Object getAttribute(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Enumeration<String> getAttributeNames() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void setAttribute(String s, Object o) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void removeAttribute(String s) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getServletContextName() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ServletRegistration.Dynamic addServlet(String s, String s1) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ServletRegistration.Dynamic addServlet(String s, Servlet servlet) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ServletRegistration.Dynamic addServlet(String s, Class<? extends Servlet> aClass) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public <T extends Servlet> T createServlet(Class<T> aClass) throws ServletException { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ServletRegistration getServletRegistration(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Map<String, ? extends ServletRegistration> getServletRegistrations() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public FilterRegistration.Dynamic addFilter(String s, String s1) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public FilterRegistration.Dynamic addFilter(String s, Filter filter) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public FilterRegistration.Dynamic addFilter(String s, Class<? extends Filter> aClass) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public <T extends Filter> T createFilter(Class<T> aClass) throws ServletException { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public FilterRegistration getFilterRegistration(String s) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Map<String, ? extends FilterRegistration> getFilterRegistrations() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public SessionCookieConfig getSessionCookieConfig() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void setSessionTrackingModes(Set<SessionTrackingMode> set) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void addListener(String s) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public <T extends EventListener> void addListener(T t) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void addListener(Class<? extends EventListener> aClass) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public <T extends EventListener> T createListener(Class<T> aClass) throws ServletException { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public JspConfigDescriptor getJspConfigDescriptor() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public ClassLoader getClassLoader() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void declareRoles(String... strings) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getVirtualServerName() { |
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue