Browse Source

REPORT-134503 && REPORT-132845 启动设计器后直接连接远程环境,设计器插件未生效

【问题原因】
1、获取远程插件状态接口发生变化,获取远程插件状态失败。
2、插件引擎之前未考虑远程设计
【改动思路】
1、注册插件repository。修改接口的返回类型。
2、设计器模块启动的时候,单独注册 需要启动的插件同步模块 及 获取插件状态的接口信息
fbp/merge
Leo.Qin 3 months ago
parent
commit
613b0f577e
  1. 11
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  2. 11
      designer-realize/src/main/java/com/fanruan/boot/env/DesignPluginComponent.java
  3. 10
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/PluginRemote.java
  4. 2
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

11
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -28,8 +28,6 @@ import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.report.ReportHelper;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.rpc.Result;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
@ -39,7 +37,7 @@ import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import com.fr.workspace.server.check.VersionInfoOperator;
import java.lang.reflect.Method;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
@ -53,7 +51,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.swing.SwingWorker;
/**
* @author pengda
@ -285,16 +282,14 @@ public class VersionCheckUtils {
public static JSONArray checkLocalAndRemotePlugin() {
JSONArray differentPlugins = new JSONArray();
JSONArray remotePlugins = FRContext.getCommonOperator().getPluginStatus();
List<JSONObject> remotePlugins = FRContext.getCommonOperator().getPluginStatus();
Map<String, PluginContext> localPluginsMap = new HashMap<>();
List<PluginContext> localPlugins = PluginManager.getContexts();
for (PluginContext pluginContext : localPlugins) {
localPluginsMap.put(pluginContext.getID(), pluginContext);
}
JSONObject remotePlugin;
Map<String, String> pluginsNameMap = ReportHelper.getPluginNameMap();
for (int i = 0; i < remotePlugins.size(); i++) {
remotePlugin = remotePlugins.getJSONObject(i);
for (JSONObject remotePlugin : remotePlugins) {
if (isPluginNeedIgnore(remotePlugin)) {
continue;
}

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

@ -9,9 +9,15 @@ import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup;
import com.fanruan.plugin.autonomy.AutonomyClassManagerProvider;
import com.fr.json.JSONObject;
import com.fr.plugin.ExtraClassManager;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.PluginSyncModuleType;
import com.fr.workspace.server.repository.plugin.PluginRepository;
import javax.servlet.ServletContext;
import java.util.List;
import java.util.function.Supplier;
/**
* 设计器插件模块环境切换的中间模块
@ -38,6 +44,11 @@ public class DesignPluginComponent extends PluginComponent {
@Start
public void start() {
ExtraClassManager.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);
super.start();
}

10
designer-realize/src/main/java/com/fanruan/boot/env/function/app/PluginRemote.java vendored

@ -1,7 +1,6 @@
package com.fanruan.boot.env.function.app;
import com.fr.base.FRContext;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
@ -12,6 +11,7 @@ import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@ -57,19 +57,17 @@ public class PluginRemote {
private Map<String, PluginStatus> getRemoteStatus() {
JSONArray statusArray = FRContext.getCommonOperator().getPluginStatus();
JSONObject status;
List<JSONObject> objectList = FRContext.getCommonOperator().getPluginStatus();
String id;
String version;
boolean running;
Map<String, PluginStatus> statusMap = new HashMap<>();
for (int i = 0; i < statusArray.length(); i++) {
for (JSONObject status : objectList) {
try {
status = statusArray.getJSONObject(i);
id = status.getString("id");
version = status.getString("version");
running = status.getBoolean("running");
if(StringUtils.isBlank(id)){
if (StringUtils.isBlank(id)) {
continue;
}
PluginStatus pluginStatus = PluginStatus.create(id, version, running);

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

@ -61,6 +61,7 @@ import com.fr.workspace.server.repository.compatible.register.CompatibleRegister
import com.fanruan.workplace.network.RemoteNetworkRepository;
import com.fr.workspace.server.repository.config.ConfigRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.plugin.PluginRepository;
import com.fr.workspace.server.repository.resource.PublicResourceRepository;
import com.fr.workspace.server.repository.resource.WorkResourceRepository;
import com.fr.workspace.server.repository.system.SystemInfoRepository;
@ -109,6 +110,7 @@ public class DesignWorkContextComponent {
RepositoryManager.getInstance().pureRegisterRepo4Start(WorkResourceRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(PublicResourceRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(ConfigRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(PluginRepository.getInstance());
RepositoryManager.getInstance().initLocalRepository();
CompatibleRegister.registerCompatibleEnv();
for (WorkRPCRegister<?> workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) {

Loading…
Cancel
Save