Browse Source

Merge pull request #15461 in DESIGN/design from fbp/feature to fbp/release

* commit '5e0b3139982af82662be0f56bc8a1b1d5f60cfe7':
  REPORT-128071 插件引擎适配微服务-适配支持特定服务
  无jira任务,修复打包
  feat: REPORT-136751 FR&FVS数据中心取数第二期-过滤优化
  无JIRA:修复打包
fbp/merge
superman 1 month ago
parent
commit
2f72d20ee7
  1. 98
      designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js
  2. 2
      designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java
  3. 42
      designer-realize/src/main/java/com/fanruan/boot/env/DesignCorePluginComponent.java
  4. 2
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  5. 88
      designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java
  6. 31
      designer-realize/src/main/java/com/fanruan/boot/env/DesignVersionComponent.java
  7. 2
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java
  8. 3
      designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java

98
designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js

File diff suppressed because one or more lines are too long

2
designer-realize/src/main/java/com/fanruan/boot/adaptation/ReportAdaptationComponent.java

@ -12,9 +12,9 @@ import com.fr.decision.ExtraDecisionClassManager;
import com.fr.decision.base.VirtualFilterChain;
import com.fr.decision.fun.EmbedRequestFilterProvider;
import com.fr.decision.fun.GlobalRequestFilterProvider;
import com.fr.decision.fun.PluginPortalModuleDevice;
import com.fr.decision.fun.SystemOptionProvider;
import com.fr.decision.plugin.PluginControllerManager;
import com.fr.decision.portal.PluginPortalModuleDevice;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;

42
designer-realize/src/main/java/com/fanruan/boot/env/DesignCorePluginComponent.java vendored

@ -1,42 +0,0 @@
package com.fanruan.boot.env;
import com.fanruan.boot.CorePluginComponent;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup;
import com.fanruan.plugin.autonomy.AutonomyClassManagerProvider;
import com.fr.plugin.ExtraClassManager;
/**
* DesignCorePluginComponent
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/8/9
*/
@FineComponent(name = "design_plugin_core")
@DependsOn(dependencies = {"design_plugin"})
public class DesignCorePluginComponent extends CorePluginComponent {
/**
* prepare
*/
@Supplemental
public void supportFunctionDef() {
super.supportFunctionDef();
}
/**
* start
*/
@Start
public void start() {
/// 插件下沉不能直接调用fbp的逻辑,此时内置服务器未启动,一部分逻辑要拆到内置服务器启动的时候再做
// super.start();
}
}

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

@ -250,7 +250,7 @@ public class DesignEnvComponent {
// 获取本地的日志级别配置
Level localLogPreferLevel = Log4jConfig.getInstance().getRootLevel();
// 刷新到本地配置
Log4jConfigFactory.getInstance().setRootLevel(localLogPreferLevel);
Log4jConfigFactory.getInstance().updateConfigLoggerLevel(localLogPreferLevel.name());
URI uri = Log4jUtils.buildUserConfigURI(StringUtils.EMPTY);
FRLogger.getLogger().config(uri);
// 刷新到carina的配置,防止 portal service 启动的时候覆盖了

88
designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java vendored

@ -7,15 +7,34 @@ import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.plugin.autonomy.AutonomyClassManagerFactory;
import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup;
import com.fanruan.plugin.autonomy.AutonomyClassManagerProvider;
import com.fr.config.ConfigContext;
import com.fr.invoke.ClassFactory;
import com.fr.json.JSONObject;
import com.fr.plugin.ExtraClassManager;
import com.fr.plugin.beforeload.embed.PluginEmbedInfo;
import com.fr.plugin.config.PluginConfigContext;
import com.fr.plugin.injectable.PluginInjectionFilter;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.PluginSyncModuleType;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.plugin.validate.PluginValidator;
import com.fr.stable.CommonUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.resource.ResourceLoader;
import com.fr.startup.web.annotation.MappingJackson2HttpMessageConverter;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.plugin.PluginRepository;
import javax.servlet.ServletContext;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collection;
import java.util.List;
import java.util.function.Supplier;
@ -27,7 +46,7 @@ import java.util.function.Supplier;
* Created on 2024/5/17
*/
@FineComponent(name = "design_plugin")
@DependsOn(dependencies = {"design_env_prepare"})
@DependsOn(dependencies = {"design_version"})
public class DesignPluginComponent extends PluginComponent {
@ -43,13 +62,35 @@ public class DesignPluginComponent extends PluginComponent {
*/
@Start
public void start() {
ExtraClassManager.getInstance().registerAutonomyClassManager(Carina.getApplicationContext().group(AutonomyClassManagerGroup.class).getAll().toArray(new AutonomyClassManagerProvider[0]));
//收集插件对象的过滤器
Collection<PluginInjectionFilter> filters = Carina.getApplicationContext().group(PluginInjectionFilter.GroupKey.class).getAll();
for (PluginInjectionFilter filter: filters) {
PluginManager.addInjectionFilter(filter);
}
//装备外部的验证器
assembleValidator();
// 注册内置插件信息
registerEmbedPluginInfo();
// 注册插件配置类Provider
registerPluginConfigProvider();
AutonomyClassManagerFactory.getInstance().registerAutonomyClassManager(Carina.getApplicationContext().group(AutonomyClassManagerGroup.class).getAll().toArray(new AutonomyClassManagerProvider[0]));
Supplier<List<JSONObject>> supplier = () -> PluginRepository.getInstance().getPluginStatus();
PluginManager.registerRemotePluginSupplier(supplier);
PluginManager.setSyncModuleType(PluginSyncModuleType.DESIGN);
//PluginManager要在环境切换和模块启动之前初始化
PluginManager.startEngine();
super.start();
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
MappingJackson2HttpMessageConverter.KEY.refreshObjectMapper();
}
});
registerPluginClassFinder();
}
@Override
@ -57,6 +98,45 @@ public class DesignPluginComponent extends PluginComponent {
// do nothing
}
private void registerEmbedPluginInfo() {
Collection<PluginEmbedInfo> pluginEmbedInfos = Carina.getApplicationContext().group(PluginEmbedInfo.class).getAll();
PluginManager.getPluginEmbedManager().addPluginEmbedInfos(pluginEmbedInfos);
}
private void registerPluginConfigProvider() {
ConfigContext.setPluginConfigContextProvider(new PluginConfigContext());
}
private void assembleValidator() {
PluginManager.getValidatorManager().register(Carina.getApplicationContext().group(PluginValidator.GroupKey.class).getAll());
}
private void registerPluginClassFinder() {
ClassFactory.getInstance().addFinder(className -> {
//再找.
// alex:currentEnv可能是null
String envPath = WorkContext.getCurrent().getPath();
if (envPath == null) {
throw new ClassNotFoundException(className);
}
File clssesFile = new File(CommonUtils.pathJoin(envPath, ProjectConstants.CLASSES_NAME));
ClassLoader urlClassLoader;
try {
urlClassLoader = new URLClassLoader(new URL[]{clssesFile.toURI().toURL()}, CommonUtils.class.getClassLoader());
} catch (MalformedURLException malformedURLException) {
urlClassLoader = ClassLoader.getSystemClassLoader();
}
return Class.forName(className, true, urlClassLoader);
});
//从插件中拿
ClassFactory.getInstance().addFinder(ResourceLoader::classForName);
//从插件引擎中拿
ClassFactory.getInstance().addFinder(className -> Class.forName(className, true, PluginManager.getController().getClass().getClassLoader()));
}
/**
* stop
*/

31
designer-realize/src/main/java/com/fanruan/boot/env/DesignVersionComponent.java vendored

@ -0,0 +1,31 @@
package com.fanruan.boot.env;
import com.fanruan.boot.VersionComponent;
import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
import com.fanruan.version.ServiceVersion;
import com.fanruan.version.VersionCenter;
import com.fanruan.version.VersionConstants;
/**
* 设计器版本模块
*
* @author Leo.Qin
* @since 11.0
* Created on 2024/11/11
*/
@FineComponent(name = "design_version")
@DependsOn(dependencies = {"design_env_prepare"})
public class DesignVersionComponent extends VersionComponent {
@Start
@Override
public void start() {
super.start();
ServiceVersion serviceVersion = VersionCenter.getInstance().getServiceVersion();
serviceVersion.setName(VersionConstants.SERVICE_NAME_FR);
VersionCenter.getInstance().register(serviceVersion);
}
}

2
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java vendored

@ -38,7 +38,7 @@ import java.util.List;
* Created on 2024/7/2
*/
@FineComponent(name = "design_function_update")
@DependsOn(dependencies = "design_plugin_core")
@DependsOn(dependencies = "design_plugin")
public class DesignUpdateComponent {
/**

3
designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java

@ -1,6 +1,5 @@
package com.fanruan.boot.init;
import com.fanruan.boot.ClassFindComponent;
import com.fanruan.boot.ExtraLocaleClassManager;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina;
@ -205,7 +204,7 @@ public class DesignPreLoadComponent {
ProjectConstants.CLASSES_NAME));
ClassLoader urlClassLoader;
try {
urlClassLoader = new URLClassLoader(new URL[]{clssesFile.toURI().toURL()}, ClassFindComponent.class.getClassLoader());
urlClassLoader = new URLClassLoader(new URL[]{clssesFile.toURI().toURL()}, DesignPreLoadComponent.class.getClassLoader());
} catch (MalformedURLException malformedURLException) {
urlClassLoader = ClassLoader.getSystemClassLoader();
}

Loading…
Cancel
Save