Browse Source

REPORT-114391 【微服务适配】远程&本地设计器能够正常启动

mss/2.0
Destiny.Lin 6 months ago
parent
commit
1095b7b2ba
  1. 3
      build.gradle
  2. 19
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  3. 6
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  4. 63
      designer-base/src/main/java/com/fr/design/extra/PluginHelper.java
  5. 3
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  6. 14
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  7. 6
      designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java
  8. 2
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  9. 3
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java
  10. 1
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  11. 22
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  12. 2
      designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java
  13. 21
      designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java
  14. 4
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java
  15. 106
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java
  16. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentUploader.java
  17. 38
      designer-realize/src/main/java/com/fanruan/boot/DesignConfConfigComponent.java
  18. 46
      designer-realize/src/main/java/com/fanruan/boot/DesignCoreSupplementalComponent.java
  19. 19
      designer-realize/src/main/java/com/fanruan/boot/DesignEnvComponent.java
  20. 23
      designer-realize/src/main/java/com/fanruan/boot/DesignFunctionComponent.java
  21. 38
      designer-realize/src/main/java/com/fanruan/boot/DesignLoggerComponent.java
  22. 24
      designer-realize/src/main/java/com/fanruan/boot/DesignSerializationComponent.java
  23. 51
      designer-realize/src/main/java/com/fanruan/boot/DesignTenantComponent.java
  24. 19
      designer-realize/src/main/java/com/fanruan/boot/DesignUpdateComponent.java
  25. 99
      designer-realize/src/main/java/com/fanruan/boot/DesignWorkContextComponent.java
  26. 21
      designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceComponent.java
  27. 19
      designer-realize/src/main/java/com/fanruan/boot/DesignWorkspaceRegisterComponent.java
  28. 24
      designer-realize/src/main/java/com/fanruan/boot/DesignerComponent.java
  29. 38
      designer-realize/src/main/java/com/fanruan/boot/DesignerDaoComponent.java
  30. 28
      designer-realize/src/main/java/com/fanruan/boot/DesignerInitComponent.java
  31. 43
      designer-realize/src/main/java/com/fanruan/boot/DesignerShowComponent.java
  32. 194
      designer-realize/src/main/java/com/fanruan/boot/DesignerStartupComponent.java
  33. 118
      designer-realize/src/main/java/com/fanruan/boot/PreLoadComponent.java
  34. 23
      designer-realize/src/main/java/com/fanruan/boot/XMLableComponent.java
  35. 14
      designer-realize/src/main/java/com/fanruan/boot/key/ActivatorContextGroup.java
  36. 14
      designer-realize/src/main/java/com/fanruan/boot/key/StartupArgsShell.java
  37. 2
      designer-realize/src/main/java/com/fr/design/present/CurrencyLinePane.java
  38. 3
      designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java
  39. 83
      designer-realize/src/main/java/com/fr/start/CarinaDesigner.java
  40. 42
      designer-realize/src/main/java/com/fr/start/DesignContext.java
  41. 88
      designer-realize/src/main/java/com/fr/start/DesignLauncher.java
  42. 290
      designer-realize/src/main/java/com/fr/start/EmptyServletContext.java
  43. 4
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  44. 22
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  45. 17
      designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java
  46. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  47. 176
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java
  48. 8
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java
  49. 9
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignerPluginActivator.java
  50. 15
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java
  51. 5
      designer-realize/src/main/java/com/fr/start/module/optimized/TenantDBAdapter4Designer.java
  52. 17
      designer-realize/src/main/java/com/fr/start/util/DesignerStartupPageUtil.java

3
build.gradle

@ -67,6 +67,9 @@ allprojects {
implementation 'com.fr.plugin:fine-plugin-api:' + apiVersion implementation 'com.fr.plugin:fine-plugin-api:' + apiVersion
implementation 'com.fr.workplace:workplace-api:' + apiVersion implementation 'com.fr.workplace:workplace-api:' + apiVersion
implementation 'com.fr.carina:fine-carina:' + apiVersion implementation 'com.fr.carina:fine-carina:' + apiVersion
implementation 'com.fr.auth:fine-auth-api:' + apiVersion
implementation 'com.fr.license:fine-license-api:' + apiVersion
implementation 'com.fr.workplace:workplace:' + apiVersion
implementation 'com.fr.cluster:fine-cluster-api:' + apiVersion implementation 'com.fr.cluster:fine-cluster-api:' + apiVersion
implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.install4j:install4j-runtime:8.0.4'
implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser:6.23'

19
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,6 +1,6 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.cluster.engine.rpc.remote.ClusterOperator; import com.fanruan.workplace.http.HttpWorkspaceProxyPool;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.base.operator.common.CommonOperator; import com.fr.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler; import com.fr.rpc.ExceptionHandler;
@ -12,7 +12,6 @@ import com.fr.workspace.connect.WorkspaceClient;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.authority.decision.DecisionOperator; import com.fr.workspace.server.authority.decision.DecisionOperator;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import com.fr.workspace.pool.WorkObjectPool; import com.fr.workspace.pool.WorkObjectPool;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
@ -96,16 +95,9 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean isCluster() { public boolean isCluster() {
if (cluster == null) { // 集群判断方式放到远程那边一起改
cluster = WorkContext.getCurrent().get(ClusterOperator.class, new ExceptionHandler<Boolean>() {
@Override
public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
return false; return false;
} }
}).isCluster();
}
return cluster;
}
@Override @Override
public WorkspaceConnection getConnection() { public WorkspaceConnection getConnection() {
@ -114,17 +106,20 @@ public class RemoteWorkspace implements Workspace {
} }
@Override @Override
@Deprecated
public <T> T get(Class<T> type) { public <T> T get(Class<T> type) {
return client.getPool().get(type); return client.getPool().get(type);
} }
@Override @Override
@Deprecated
public <T> T get(Class<T> type, ExceptionHandler exceptionHandler){ public <T> T get(Class<T> type, ExceptionHandler exceptionHandler){
if(exceptionHandler != null) { if(exceptionHandler != null) {
WorkObjectPool objectPool = client.getPool(); WorkObjectPool objectPool = client.getPool();
if (objectPool instanceof WorkspaceProxyPool) { // 不再建议这样用啦,这里只是为了保留一定的兼容能力,直接用类似于TemplateRepository.getInstance().xxx()的方式吧
return ((WorkspaceProxyPool) objectPool).get(type, exceptionHandler); if (objectPool instanceof HttpWorkspaceProxyPool) {
return objectPool.get(type, exceptionHandler);
}else { }else {
return client.getPool().get(type); return client.getPool().get(type);
} }

6
designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java

@ -1,7 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fanruan.cloud.FanruanCloud;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.PluginLoginExecutor;
@ -82,7 +82,7 @@ public class LoginWebBridge {
*/ */
public void setMessageCount(int count) { public void setMessageCount(int count) {
if (count == MIN_MESSAGE_COUNT) { if (count == MIN_MESSAGE_COUNT) {
MarketConfig.getInstance().setInShowBBsName(DesignerEnvManager.getEnvManager().getDesignerLoginUsername()); FanruanCloud.marketService().setInShowBBsName(DesignerEnvManager.getEnvManager().getDesignerLoginUsername());
return; return;
} }
this.messageCount = count; this.messageCount = count;
@ -90,7 +90,7 @@ public class LoginWebBridge {
sb.append(StringUtils.BLANK).append(DesignerEnvManager.getEnvManager().getDesignerLoginUsername()) sb.append(StringUtils.BLANK).append(DesignerEnvManager.getEnvManager().getDesignerLoginUsername())
.append("(").append(this.messageCount) .append("(").append(this.messageCount)
.append(")").append(StringUtils.BLANK); .append(")").append(StringUtils.BLANK);
MarketConfig.getInstance().setInShowBBsName(sb.toString()); FanruanCloud.marketService().setInShowBBsName(sb.toString());
} }
public void setQQDialog(UIDialog qqDialog) { public void setQQDialog(UIDialog qqDialog) {

63
designer-base/src/main/java/com/fr/design/extra/PluginHelper.java

@ -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;
}
}

3
designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java

@ -1,5 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fanruan.cloud.FanruanCloud;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
@ -548,7 +549,7 @@ public class PluginWebBridge {
* 清除用户信息 * 清除用户信息
*/ */
public void clearUserInfo() { public void clearUserInfo() {
MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); FanruanCloud.marketService().setInShowBBsName(StringUtils.EMPTY);
} }
public void getPackInfo(final JSObject callback){ public void getPackInfo(final JSObject callback){

14
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -14,8 +14,6 @@ import com.fr.general.IOUtils;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConfig;
import com.fr.plugin.PluginStoreConstants;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fanruan.product.ProductConstants; import com.fanruan.product.ProductConstants;
@ -43,14 +41,14 @@ public class WebViewDlgHelper {
private static final String LATEST = "latest"; private static final String LATEST = "latest";
private static final String SHOP_SCRIPTS = "shop_scripts"; private static final String SHOP_SCRIPTS = "shop_scripts";
private static final int VERSION_8 = 8; private static final int VERSION_8 = 8;
private static String installHome = PluginStoreConstants.getLocalInstallHome(); private static String installHome = PluginHelper.getInstance().getStoreProvider().getLocalInstallHome();
private static final String MAIN_JS_PATH = "/scripts/plugin.html"; private static final String MAIN_JS_PATH = "/scripts/plugin.html";
static { static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() { GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override @Override
public void envChanged() { public void envChanged() {
installHome = PluginStoreConstants.getLocalInstallHome(); installHome = PluginHelper.getInstance().getStoreProvider().getLocalInstallHome();
} }
}); });
} }
@ -73,9 +71,9 @@ public class WebViewDlgHelper {
return; return;
} }
// 检测更新前先刷新一下版本号 // 检测更新前先刷新一下版本号
PluginStoreConstants.refreshProps(); PluginHelper.getInstance().getStoreProvider().refreshProps();
String jarVersion = PluginStoreConfig.getInstance().getEnvVersion(); String jarVersion = PluginHelper.getInstance().getStoreProvider().getEnvVersion();
if (ComparatorUtils.equals(jarVersion, ProductConstants.VERSION)) { if (ComparatorUtils.equals(jarVersion, ProductConstants.VERSION)) {
updateShopScripts(SHOP_SCRIPTS); updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(); showPluginDlg();
@ -264,7 +262,7 @@ public class WebViewDlgHelper {
IOUtils.unzip(scriptZip, installHome); IOUtils.unzip(scriptZip, installHome);
CommonUtils.deleteFile(scriptZip); CommonUtils.deleteFile(scriptZip);
} }
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等 PluginHelper.getInstance().getStoreProvider().refreshProps(); // 下载完刷新一下版本号等
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -284,7 +282,7 @@ public class WebViewDlgHelper {
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update"); String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update");
if (url != null) { if (url != null) {
String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConfig.getInstance().getVersion()); String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginHelper.getInstance().getStoreProvider().getVersion());
JSONObject resultJSONObject = new JSONObject(text); JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result"); String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) { if (!ComparatorUtils.equals(isLatest, LATEST)) {

6
designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java

@ -23,12 +23,15 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.plugin.injectable.PluginModule;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.fun.FunctionDefContainer; import com.fr.stable.fun.FunctionDefContainer;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.plugin.ExtraClassManagerProvider;
import com.fr.stable.script.ExtraFunctionManager;
import com.fr.stable.script.Function; import com.fr.stable.script.Function;
import com.fr.stable.script.FunctionDef; import com.fr.stable.script.FunctionDef;
@ -243,7 +246,8 @@ public final class FunctionConstants {
@Override @Override
public NameAndDescription[] getDescriptions() { public NameAndDescription[] getDescriptions() {
FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); ExtraClassManagerProvider pluginProvider = PluginModule.getAgent(PluginModule.ExtraCore);
FunctionDef[] fs = pluginProvider.autonomy(ExtraFunctionManager.class).getFunctionDef();
int count = fs.length; int count = fs.length;
FunctionDefNAD[] nads = new FunctionDefNAD[count]; FunctionDefNAD[] nads = new FunctionDefNAD[count];
for (int i = 0; i < count; i ++) { for (int i = 0; i < count; i ++) {

2
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -1,5 +1,6 @@
package com.fr.design.gui.date; package com.fr.design.gui.date;
import com.fanruan.product.ProductConstantsBase;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.background.GradientBackground; import com.fr.base.background.GradientBackground;
import com.fr.design.carton.MonthlyCartonFile; import com.fr.design.carton.MonthlyCartonFile;
@ -13,7 +14,6 @@ import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.ProductConstantsBase;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;

3
designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.share.collect; package com.fr.design.mainframe.share.collect;
import com.fanruan.cloud.FanruanCloud;
import com.fr.base.io.XMLReadHelper; import com.fr.base.io.XMLReadHelper;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -529,7 +530,7 @@ public class ComponentCollector implements XMLable {
public String generateTotalInfo() { public String generateTotalInfo() {
collectCmpNumber(); collectCmpNumber();
JSONObject jo = JSONObject.create(); JSONObject jo = JSONObject.create();
jo.put("userId", MarketConfig.getInstance().getBBSAttr().getBbsUid()); jo.put("userId", FanruanCloud.marketService().getBbsUid());
jo.put("uuid", uuid); jo.put("uuid", uuid);
jo.put("cmpBoardClickDaily", cmpBoardClickDaily()); jo.put("cmpBoardClickDaily", cmpBoardClickDaily());
jo.put("pluginVersion", GeneralUtils.getVersion()); jo.put("pluginVersion", GeneralUtils.getVersion());

1
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -1,5 +1,6 @@
package com.fr.design.update.ui.dialog; package com.fr.design.update.ui.dialog;
import com.fanruan.product.ProductConstants;
import com.fr.decision.update.data.UpdateConstants; import com.fr.decision.update.data.UpdateConstants;
import com.fr.decision.update.info.UpdateCallBack; import com.fr.decision.update.info.UpdateCallBack;
import com.fr.decision.update.info.UpdateProgressCallBack; import com.fr.decision.update.info.UpdateProgressCallBack;

22
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -1,9 +1,8 @@
package com.fr.design.upm; package com.fr.design.upm;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginHelper;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.login.utils.DesignerLoginUtils; import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -16,8 +15,10 @@ import com.fr.general.CommonIOUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants; import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
@ -35,8 +36,9 @@ public class UpmFinder {
private static final String UPM_DIR = "/upm"; private static final String UPM_DIR = "/upm";
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html";
private static final String JXBROWSER = "com.teamdev.jxbrowser.browser.Browser"; private static final String JXBROWSER = "com.teamdev.jxbrowser.browser.Browser";
public static final String TEMP_FILE = "cache/temp.zip";
public static String installHome = PluginStoreConstants.getLocalInstallHome(); public static final String SCRIPT_DOWNLOAD_PATH = CommonUtils.pathJoin(WorkContext.getCurrent().getPath(), TEMP_FILE);
public static String installHome = PluginHelper.getInstance().getStoreProvider().getLocalInstallHome();
private static UIDialog dialog = null; private static UIDialog dialog = null;
@ -44,8 +46,8 @@ public class UpmFinder {
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() { EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override @Override
public void on(Event event, Workspace param) { public void on(Event event, Workspace param) {
installHome = PluginStoreConstants.getLocalInstallHome(); installHome = PluginHelper.getInstance().getStoreProvider().getLocalInstallHome();
UpmResourceLoader.INSTANCE.checkOldShopFile(); PluginHelper.getInstance().getUpmLoader().checkOldShopFile();
} }
}); });
} }
@ -85,7 +87,7 @@ public class UpmFinder {
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION) { if (val == JOptionPane.OK_OPTION) {
try { try {
UpmResourceLoader.INSTANCE.download(); PluginHelper.getInstance().getUpmLoader().download();
installUpmResource(); installUpmResource();
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
@ -107,8 +109,8 @@ public class UpmFinder {
} }
private static void installUpmResource() { private static void installUpmResource() {
String installHome = PluginStoreConstants.getLocalInstallHome(); String installHome = PluginHelper.getInstance().getStoreProvider().getLocalInstallHome();
File scriptZip = new File(BaseResourceLoader.SCRIPT_DOWNLOAD_PATH); File scriptZip = new File(SCRIPT_DOWNLOAD_PATH);
if (scriptZip.exists()) { if (scriptZip.exists()) {
IOUtils.unzip(scriptZip, installHome); IOUtils.unzip(scriptZip, installHome);
CommonIOUtils.deleteFile(scriptZip); CommonIOUtils.deleteFile(scriptZip);

2
designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java vendored

@ -25,8 +25,6 @@ import com.fr.env.detect.bean.DetectorStatus;
import com.fr.env.detect.bean.DetectorType; import com.fr.env.detect.bean.DetectorType;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.design.carton.FeedbackToolboxDialog; import com.fr.design.carton.FeedbackToolboxDialog;
import com.fr.stable.ProductConstantsBase;
import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;

21
designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java

@ -14,23 +14,24 @@ public abstract class FineEmbedServer {
private static volatile boolean onStarting = false; private static volatile boolean onStarting = false;
public synchronized static void start() { public synchronized static void start() {
onStarting = true; // // 内置服务器先去除
EventDispatcher.fire(EmbedServerEvent.BeforeStart); // onStarting = true;
ModuleContext.getModule(FineEmbedServerActivator.class).start(); // EventDispatcher.fire(EmbedServerEvent.BeforeStart);
onStarting = false; // ModuleContext.getModule(FineEmbedServerActivator.class).start();
EventDispatcher.fire(EmbedServerEvent.AfterStart); // onStarting = false;
// EventDispatcher.fire(EmbedServerEvent.AfterStart);
} }
public synchronized static void stop() { public synchronized static void stop() {
// //内置服务器先去除
EventDispatcher.fire(EmbedServerEvent.BeforeStop); // EventDispatcher.fire(EmbedServerEvent.BeforeStop);
ModuleContext.getModule(FineEmbedServerActivator.class).stop(); // ModuleContext.getModule(FineEmbedServerActivator.class).stop();
EventDispatcher.fire(EmbedServerEvent.AfterStop); // EventDispatcher.fire(EmbedServerEvent.AfterStop);
} }
public static boolean isRunning() { public static boolean isRunning() {
return ModuleContext.getModule(FineEmbedServerActivator.class).isRunning(); return false;
} }
public static boolean isOnStarting() { public static boolean isOnStarting() {

4
designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java

@ -11,7 +11,6 @@ import com.fr.startup.FineWebApplicationInitializer;
import com.fr.third.guava.collect.Sets; import com.fr.third.guava.collect.Sets;
import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer;
import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import com.fr.web.socketio.WebSocketEndpoint;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.apache.catalina.Context; import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleException;
@ -95,7 +94,8 @@ public class FineEmbedServerActivator extends Activator {
Set<Class<?>> classes = new HashSet<Class<?>>(); Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(FineWebApplicationInitializer.class); classes.add(FineWebApplicationInitializer.class);
context.addServletContainerInitializer(initializer, classes); context.addServletContainerInitializer(initializer, classes);
context.addServletContainerInitializer(new WsSci(), Sets.newHashSet(WebSocketEndpoint.class)); // 后面本地设计的内置服务器考虑用XST
// context.addServletContainerInitializer(new WsSci(), Sets.newHashSet(WebSocketEndpoint.class));
} }
// tomcat的maxPostSize会影响到post参数获取,默认2M // tomcat的maxPostSize会影响到post参数获取,默认2M

106
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java

@ -3,14 +3,17 @@ package com.fr.van.chart.map.designer.type;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.base.GisLayer;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.server.MapLayerConfigManager; import com.fr.plugin.chart.map.server.MapLayerConfigManager;
@ -29,6 +32,7 @@ import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.util.Locale;
/** /**
* @author Bjorn * @author Bjorn
@ -39,8 +43,16 @@ public class GisLayerPane extends JPanel implements UIObserver {
private UIButtonGroup gisButton; private UIButtonGroup gisButton;
private JPanel layerPaneCheckPane; private JPanel layerPaneCheckPane;
private UIComboBox gisGaoDeLayer;
private UIComboBox gisLayer; /**
* 标准图层
*/
private UIComboBox standardLayers;
/**
* 自定义图层
*/
private UIComboBox customLayers;
private JPanel layerCardPane; private JPanel layerCardPane;
private WMSLayerPane wmsLayerPane; private WMSLayerPane wmsLayerPane;
@ -48,7 +60,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
private UIComboBox zoomLevel; private UIComboBox zoomLevel;
private String[] layers = MapLayerConfigManager.getLayerItems(); private String[] layers = MapLayerConfigManager.getCustomLayerItems();
public GisLayerPane() { public GisLayerPane() {
initComps(); initComps();
@ -86,15 +98,12 @@ public class GisLayerPane extends JPanel implements UIObserver {
gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"),
Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")});
gisButton.setSelectedIndex(ChartEditContext.supportTheme() ? 0 : 1); gisButton.setSelectedIndex(ChartEditContext.supportTheme() ? 0 : 1);
gisGaoDeLayer = new UIComboBox(MapLayerConfigManager.getGaoDeLayerItems());
gisButton.addActionListener(event -> { gisButton.addActionListener(event -> {
refreshZoomLevel(); refreshZoomLevel();
checkLayerCardPane(); checkLayerCardPane();
}); });
gisGaoDeLayer.addItemListener(event -> refreshZoomLevel()); initLayer();
initCustomGISLayerPane();
initLayerCardPane(); initLayerCardPane();
layerPaneCheckPane = new JPanel(new CardLayout()) { layerPaneCheckPane = new JPanel(new CardLayout()) {
@ -104,15 +113,15 @@ public class GisLayerPane extends JPanel implements UIObserver {
return new Dimension(0, 0); return new Dimension(0, 0);
} }
if (isStandardGis()) { if (isStandardGis()) {
return gisGaoDeLayer.getPreferredSize(); return standardLayers.getPreferredSize();
} else { } else {
return gisLayer.getPreferredSize(); return customLayers.getPreferredSize();
} }
} }
}; };
layerPaneCheckPane.add(new JPanel(), "auto"); layerPaneCheckPane.add(new JPanel(), "auto");
layerPaneCheckPane.add(gisGaoDeLayer, "standard"); layerPaneCheckPane.add(standardLayers, "standard");
layerPaneCheckPane.add(gisLayer, "custom"); layerPaneCheckPane.add(customLayers, "custom");
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -142,7 +151,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
if (isStandardGis() || isAuto()) { if (isStandardGis() || isAuto()) {
return new Dimension(0, 0); return new Dimension(0, 0);
} }
String itemName = Utils.objectToString(gisLayer.getSelectedItem()); String itemName = Utils.objectToString(customLayers.getSelectedItem());
if (MapLayerConfigManager.isCustomLayer(itemName)) { if (MapLayerConfigManager.isCustomLayer(itemName)) {
return tileLayerPane.getPreferredSize(); return tileLayerPane.getPreferredSize();
} else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) {
@ -163,10 +172,12 @@ public class GisLayerPane extends JPanel implements UIObserver {
} }
} }
private void initCustomGISLayerPane() { private void initLayer() {
gisLayer = new UIComboBox(layers); standardLayers = new UIComboBox(MapLayerConfigManager.getStandardLayerItems());
customLayers = new UIComboBox(layers);
gisLayer.addItemListener(e -> standardLayers.addItemListener(event -> refreshZoomLevel());
customLayers.addItemListener(e ->
{ {
if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getStateChange() == ItemEvent.SELECTED) {
checkCustomLayerCardPane(); checkCustomLayerCardPane();
@ -175,7 +186,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
} }
); );
gisLayer.addPopupMenuListener(new PopupMenuListener() { customLayers.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
} }
@ -184,12 +195,12 @@ public class GisLayerPane extends JPanel implements UIObserver {
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
String selected = Utils.objectToString(gisLayer.getSelectedItem()); String selected = Utils.objectToString(customLayers.getSelectedItem());
ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem(); ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem();
gisLayer.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getLayerItems())); customLayers.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getCustomLayerItems()));
gisLayer.setSelectedItem(selected); customLayers.setSelectedItem(selected);
zoomLevel.setSelectedItem(zoomSelected); zoomLevel.setSelectedItem(zoomSelected);
} }
}); });
@ -201,15 +212,15 @@ public class GisLayerPane extends JPanel implements UIObserver {
if (isAuto()) { if (isAuto()) {
levels = MapStatusPane.ZOOM_LEVELS; levels = MapStatusPane.ZOOM_LEVELS;
} else if (isStandardGis()) { } else if (isStandardGis()) {
if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) { if (standardLayers.getSelectedIndex() == standardLayers.getItemCount() - 1) {
levels = MapStatusPane.ZOOM_LEVELS; levels = MapStatusPane.ZOOM_LEVELS;
} else { } else {
levels = MapStatusPane.GAODE_ZOOM_LEVELS; levels = MapStatusPane.GAODE_ZOOM_LEVELS;
} }
} else { } else {
if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) { if (ComparatorUtils.equals(customLayers.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) {
levels = MapStatusPane.BLUE_ZOOM_LEVELS; levels = MapStatusPane.BLUE_ZOOM_LEVELS;
} else if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) { } else if (ComparatorUtils.equals(customLayers.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) {
levels = MapStatusPane.GAODE_ZOOM_LEVELS; levels = MapStatusPane.GAODE_ZOOM_LEVELS;
} else { } else {
levels = MapStatusPane.ZOOM_LEVELS; levels = MapStatusPane.ZOOM_LEVELS;
@ -233,31 +244,24 @@ public class GisLayerPane extends JPanel implements UIObserver {
private void checkCustomLayerCardPane() { private void checkCustomLayerCardPane() {
CardLayout cardLayout = (CardLayout) layerCardPane.getLayout(); CardLayout cardLayout = (CardLayout) layerCardPane.getLayout();
cardLayout.show(layerCardPane, Utils.objectToString(gisLayer.getSelectedItem())); cardLayout.show(layerCardPane, Utils.objectToString(customLayers.getSelectedItem()));
} }
public void resetGisLayer(VanChartMapPlot mapPlot) { public void resetGisLayer(VanChartMapPlot mapPlot) {
// if (ChartEditContext.supportTheme()) {
GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer(); GisLayer defaultGisLayer = mapPlot.getDefaultGisLayer();
mapPlot.setGisLayer(defaultGisLayer); mapPlot.setGisLayer(defaultGisLayer);
populate(defaultGisLayer); populate(defaultGisLayer);
// } else {
// GaoDeGisType gaoDeGisType = mapPlot.getDefaultGisLayerType();
//
// mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API);
// mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName());
// mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType);
// populate(mapPlot.getGisLayer());
// }
} }
public void populate(GisLayer layer) { public void populate(GisLayer layer) {
switch (layer.getGisLayerType()) { switch (layer.getGisLayerType()) {
case AUTO: case AUTO:
gisButton.setSelectedIndex(0); gisButton.setSelectedIndex(0);
layer.setGisLayerType(GISLayerType.AUTO);
layer.setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));
break; break;
case GAO_DE_API: case GAO_DE_API:
populateStandardGis(layer);
case LAYER_NULL: case LAYER_NULL:
populateStandardGis(layer); populateStandardGis(layer);
break; break;
@ -272,16 +276,22 @@ public class GisLayerPane extends JPanel implements UIObserver {
private void populateStandardGis(GisLayer layer) { private void populateStandardGis(GisLayer layer) {
gisButton.setSelectedIndex(1); gisButton.setSelectedIndex(1);
String layerName = layer.getLayerName();
if (layer.getGisLayerType() == GISLayerType.LAYER_NULL) { if (layer.getGisLayerType() == GISLayerType.LAYER_NULL) {
gisGaoDeLayer.setSelectedIndex(gisGaoDeLayer.getItemCount() - 1); standardLayers.setSelectedIndex(standardLayers.getItemCount() - 1);
} else {
if (Locale.CHINA.equals(GeneralContext.getLocale())) {
standardLayers.setSelectedItem(layerName);
layer.setGaoDeGisType(GaoDeGisType.parseByLocaleName(layerName));
} else { } else {
gisGaoDeLayer.setSelectedItem(layer.getGaoDeGisType().getTypeName()); standardLayers.setSelectedItem(layerName);
}
} }
} }
private void populateCustomGis(GisLayer layer) { private void populateCustomGis(GisLayer layer) {
gisButton.setSelectedIndex(2); gisButton.setSelectedIndex(2);
gisLayer.setSelectedItem(layer.getShowItemName()); customLayers.setSelectedItem(layer.getShowItemName());
switch (layer.getGisLayerType()) { switch (layer.getGisLayerType()) {
case CUSTOM_WMS_LAYER: case CUSTOM_WMS_LAYER:
@ -297,6 +307,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
if (isAuto()) { if (isAuto()) {
layer.setGisLayerType(GISLayerType.AUTO); layer.setGisLayerType(GISLayerType.AUTO);
layer.setLayerName(GISLayerType.getLocString(GISLayerType.AUTO)); layer.setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));
adaptEditingTemplateTheme(layer);
} else if (isStandardGis()) { } else if (isStandardGis()) {
updateStandardGis(layer); updateStandardGis(layer);
} else { } else {
@ -305,9 +316,9 @@ public class GisLayerPane extends JPanel implements UIObserver {
} }
private void updateStandardGis(GisLayer layer) { private void updateStandardGis(GisLayer layer) {
String layerName = Utils.objectToString(gisGaoDeLayer.getSelectedItem()); String layerName = Utils.objectToString(standardLayers.getSelectedItem());
layer.setLayerName(layerName); layer.setLayerName(layerName);
if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) { if (standardLayers.getSelectedIndex() == standardLayers.getItemCount() - 1) {
layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName));
} else { } else {
layer.setGisLayerType(GISLayerType.GAO_DE_API); layer.setGisLayerType(GISLayerType.GAO_DE_API);
@ -316,7 +327,7 @@ public class GisLayerPane extends JPanel implements UIObserver {
} }
private void updateCustomGis(GisLayer layer) { private void updateCustomGis(GisLayer layer) {
String layerName = Utils.objectToString(gisLayer.getSelectedItem()); String layerName = Utils.objectToString(customLayers.getSelectedItem());
layer.setLayerName(layerName); layer.setLayerName(layerName);
layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName));
@ -329,4 +340,21 @@ public class GisLayerPane extends JPanel implements UIObserver {
break; break;
} }
} }
/**
* 切换图层时根据主题切换图层名称
*
* @param layer 图层
*/
private void adaptEditingTemplateTheme(GisLayer layer) {
if (Locale.CHINA.equals(GeneralContext.getLocale())) {
return;
}
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (JTemplate.isValid(currentEditingTemplate)) {
boolean dark = currentEditingTemplate.getTemplateTheme().isDark();
String name = dark ? Toolkit.i18nText("Fine-Design_Chart_Layer_Black") : Toolkit.i18nText("Fine-Design_Chart_Layer_MapBox");
layer.setLayerName(name);
}
}
} }

5
designer-form/src/main/java/com/fr/design/mainframe/share/generate/task/ComponentUploader.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.share.generate.task; package com.fr.design.mainframe.share.generate.task;
import com.fanruan.cloud.FanruanCloud;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.share.config.ComponentReuseConfigManager; import com.fr.design.mainframe.share.config.ComponentReuseConfigManager;
@ -102,8 +103,8 @@ public class ComponentUploader implements ComponentBanner {
private boolean login(CloseableHttpClient client) throws IOException { private boolean login(CloseableHttpClient client) throws IOException {
String bbsUsername = MarketConfig.getInstance().getBbsUsername(); String bbsUsername = FanruanCloud.marketService().getBbsUsername();
String bbsPassword = MarketConfig.getInstance().getBbsPassword(); String bbsPassword = FanruanCloud.marketService().getBbsPassword();
List<BasicNameValuePair> pairs = new ArrayList<>(); List<BasicNameValuePair> pairs = new ArrayList<>();
pairs.add(new BasicNameValuePair(KEY_USERNAME, bbsUsername)); pairs.add(new BasicNameValuePair(KEY_USERNAME, bbsUsername));
pairs.add(new BasicNameValuePair(KEY_PASSWORD, bbsPassword)); pairs.add(new BasicNameValuePair(KEY_PASSWORD, bbsPassword));

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

@ -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();
}
}

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

@ -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();
}
}

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

@ -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 {
}

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

@ -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>主要是图表reportvcsform相关的基础初始化</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/27
*/
@FineComponent(name = "design_function")
@DependsOn(dependencies = {"design_core_supplemental", "design_dao", "design_conf_config", "design_update"})
@ActivatorRefer(refer = {ChartBaseActivator.class, ReportBaseActivator.class, VcsFolderManagerActivator.class, FormBaseActivator.class})
public class DesignFunctionComponent {
}

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

@ -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();
}
}

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

@ -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 {
}

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

@ -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();
}
}

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

@ -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 {
}

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

@ -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);
}
}
}

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

@ -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 {
}

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

@ -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 {
}

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

@ -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 {
}

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

@ -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();
}
}

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

@ -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 {
}

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

@ -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进去后会从daoconfig初始化基础功能模块初始化完毕后会show设计器面板</p>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/28
*/
@FineComponent(name = "design_show")
@DependsOn(dependencies = "workspace_after")
public class DesignerShowComponent {
/**
* start
*/
@Start
public void start() {
DesignerInitial.prepare();
DesignerStartupExecutor.getInstance().execute(() -> DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE));
//生成BasicChartQuickEditor对象,需要用到ChartDesignerActivator的注册信息(DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);)
//所以不能在registerCellEditor函数中进行注册
ActionFactory.registerCellEditor(ChartCollection.class, new BasicChartQuickEditor());
if (DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter() && WorkContext.getCurrent().isLocal()) {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter());
}
}
}

194
designer-realize/src/main/java/com/fanruan/boot/DesignerStartupComponent.java

@ -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"};
}
}

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

@ -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);
}
}
}
}
}

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

@ -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 {
}

14
designer-realize/src/main/java/com/fanruan/boot/key/ActivatorContextGroup.java

@ -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> {
}

14
designer-realize/src/main/java/com/fanruan/boot/key/StartupArgsShell.java

@ -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> {
}

2
designer-realize/src/main/java/com/fr/design/present/CurrencyLinePane.java

@ -1,6 +1,6 @@
package com.fr.design.present; package com.fr.design.present;
import com.fr.code.bar.BarcodeException; import com.fr.barcode.core.BarcodeException;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;

3
designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java

@ -5,6 +5,7 @@ package com.fr.design.webattr;
import com.fr.base.ConfigManager; import com.fr.base.ConfigManager;
import com.fr.base.print.PrintSettingsAttrMark; import com.fr.base.print.PrintSettingsAttrMark;
import com.fr.config.ExportPrintConfig;
import com.fr.config.PrintConfig; import com.fr.config.PrintConfig;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.LoadingBasicPane;
@ -117,7 +118,7 @@ public class EditReportServerParameterPane extends LoadingBasicPane {
jsPane.update(webAttr); jsPane.update(webAttr);
printSettings = printSettingPane.updateBean(); printSettings = printSettingPane.updateBean();
PrintConfig.getInstance().setPrintSettings(printSettings); ExportPrintConfig.getInstance().setPrintSettings(printSettings);
reportServerPreferenceConfig.setErrorTemplate(this.errorTemplatePane.updateBean()); reportServerPreferenceConfig.setErrorTemplate(this.errorTemplatePane.updateBean());
if (serverFitAttrPane != null) { if (serverFitAttrPane != null) {

83
designer-realize/src/main/java/com/fr/start/CarinaDesigner.java

@ -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();
}
}

42
designer-realize/src/main/java/com/fr/start/DesignContext.java

@ -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;
}
}

88
designer-realize/src/main/java/com/fr/start/DesignLauncher.java

@ -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;
}
}

290
designer-realize/src/main/java/com/fr/start/EmptyServletContext.java

@ -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;
}
}

4
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -162,7 +162,7 @@ public class MainDesigner extends BaseDesigner {
/** /**
* {@link FineRuntime#start()} 运行后 * {@link FineRuntime#start()} 运行后
*/ */
private static void startPreload1() { protected static void startPreload1() {
CompletableFuture<Void> initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel); CompletableFuture<Void> initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel);
PreLoadService.getInstance().addUIFuture(initLookAndFeel); PreLoadService.getInstance().addUIFuture(initLookAndFeel);
@ -173,7 +173,7 @@ public class MainDesigner extends BaseDesigner {
/** /**
* {@link FineRuntime#start()} 运行前 * {@link FineRuntime#start()} 运行前
*/ */
private static void startPreload0() { protected static void startPreload0() {
PreLoadService.getInstance().addRunnable(() -> { PreLoadService.getInstance().addRunnable(() -> {
if (DesignUtils.isPortOccupied()) { if (DesignUtils.isPortOccupied()) {

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

@ -1,5 +1,6 @@
package com.fr.start.module; package com.fr.start.module;
import com.fanruan.cloud.FanruanCloud;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.MultiFieldParameter; import com.fr.base.MultiFieldParameter;
@ -10,11 +11,9 @@ import com.fr.base.process.ProcessOperator;
import com.fr.base.theme.migrator.FormThemeConfigMigrator; import com.fr.base.theme.migrator.FormThemeConfigMigrator;
import com.fr.base.theme.migrator.ReportThemeConfigMigrator; import com.fr.base.theme.migrator.ReportThemeConfigMigrator;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.config.MarketConfig;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.decision.update.backup.RecoverManager; import com.fr.decision.update.backup.RecoverManager;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.PluginResourceLoader; import com.fr.decision.webservice.v10.plugin.helper.category.ResourceLoader;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.NewFormAction; import com.fr.design.actions.NewFormAction;
@ -36,6 +35,7 @@ import com.fr.design.actions.replace.utils.ReplaceOperator;
import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceLoader; import com.fr.design.env.DesignerWorkspaceLoader;
import com.fr.design.extra.PluginHelper;
import com.fr.design.fit.NewJForm; import com.fr.design.fit.NewJForm;
import com.fr.design.fit.common.TemplateTool; import com.fr.design.fit.common.TemplateTool;
import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.form.parameter.FormParaDesigner;
@ -144,6 +144,7 @@ import com.fr.start.BBSGuestPaneProvider;
import com.fr.start.common.DesignerStartupExecutor; import com.fr.start.common.DesignerStartupExecutor;
import com.fr.start.common.DesignerStartupPool; import com.fr.start.common.DesignerStartupPool;
import com.fr.task.Once; import com.fr.task.Once;
import com.fr.tenant.context.TenantContext;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.xml.ReportXMLUtils; import com.fr.xml.ReportXMLUtils;
@ -178,7 +179,6 @@ public class DesignerActivator extends Activator implements Prepare {
@Override @Override
public void start() { public void start() {
List<LocaleMarker> markers = findMutable(InterMutableKey.Path); List<LocaleMarker> markers = findMutable(InterMutableKey.Path);
for (LocaleMarker marker : markers) { for (LocaleMarker marker : markers) {
if (marker.match(LocaleScope.DESIGN)) { if (marker.match(LocaleScope.DESIGN)) {
@ -215,8 +215,8 @@ public class DesignerActivator extends Activator implements Prepare {
CompletableFuture<Void> resourcePrepare = CompletableFuture.runAsync(() -> { CompletableFuture<Void> resourcePrepare = CompletableFuture.runAsync(() -> {
pushUpdateTask.run(); pushUpdateTask.run();
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
PluginResourceLoader.INSTANCE.checkOldShopFile(); PluginHelper.getInstance().getPluginLoader().checkOldShopFile();
UpmResourceLoader.INSTANCE.checkOldShopFile(); PluginHelper.getInstance().getUpmLoader().checkOldShopFile();
} }
}, DesignerStartupPool.common()); }, DesignerStartupPool.common());
@ -514,15 +514,15 @@ public class DesignerActivator extends Activator implements Prepare {
if (newUid > 0) { if (newUid > 0) {
return; return;
} }
int oldUid = MarketConfig.getInstance().getBbsUid(); int oldUid = FanruanCloud.marketService().getBbsUid();
if (oldUid > 0) { if (oldUid > 0) {
manager.setDesignerLoginUid(oldUid); manager.setDesignerLoginUid(oldUid);
manager.setDesignerLoginUsername(MarketConfig.getInstance().getBbsUsername()); manager.setDesignerLoginUsername(FanruanCloud.marketService().getBbsUsername());
manager.setDesignerLoginAppId(MarketConfig.getInstance().getBbsAppId()); manager.setDesignerLoginAppId(FanruanCloud.marketService().getBbsAppId());
manager.setDesignerLoginRefreshToken(MarketConfig.getInstance().getBbsRefreshToken()); manager.setDesignerLoginRefreshToken(FanruanCloud.marketService().getBbsRefreshToken());
manager.setDesignerLastLoginTime(System.currentTimeMillis()); manager.setDesignerLastLoginTime(System.currentTimeMillis());
manager.setLastLoginType(DesignerLoginType.NORMAL_LOGIN); manager.setLastLoginType(DesignerLoginType.NORMAL_LOGIN);
manager.setLastLoginAccount(MarketConfig.getInstance().getBbsUsername()); manager.setLastLoginAccount(FanruanCloud.marketService().getBbsUsername());
manager.setCurrentVersionFirstLaunch(false); manager.setCurrentVersionFirstLaunch(false);
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
} }

17
designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java

@ -1,25 +1,34 @@
package com.fr.start.module; package com.fr.start.module;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina;
import com.fr.design.PluginClassRefreshManager; import com.fr.design.PluginClassRefreshManager;
import com.fr.design.mainframe.app.DesignerAppUtils; import com.fr.design.mainframe.app.DesignerAppUtils;
import com.fr.io.repository.base.fs.FileSystemRepository;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.extension.Prepare;
import com.fr.start.DesignerInitial; import com.fr.start.DesignerInitial;
/** /**
* 设计器界面初始化 * 设计器界面初始化
* *
* @author vito * @author vito
* @version 10.0 * @since 10.0
* Created by vito on 2019/9/25 * Created on 2019/9/25
*/ */
public class DesignerInitActivator extends Activator { public class DesignerInitActivator extends Activator implements Prepare {
@Override
public void prepare() {
ResourceIOUtils.setUnderlying(FileSystemRepository.getSingleton());
}
@Override @Override
public void start() { public void start() {
PluginClassRefreshManager.getInstance().load(); PluginClassRefreshManager.getInstance().load();
DesignerAppUtils.initPluginAllActiveListener(); DesignerAppUtils.initPluginAllActiveListener();
DesignerInitial.init(findSingleton(StartupArgs.class).get()); DesignerInitial.init(Carina.getApplicationContext().singleton(StartupArgsShell.class).get().get());
} }
@Override @Override

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

@ -1,6 +1,7 @@
package com.fr.start.module; package com.fr.start.module;
import com.fanruan.product.BuildContext;
import com.fr.base.OptimizeUtil; import com.fr.base.OptimizeUtil;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.dao.DaoSelectorFactory; import com.fr.config.dao.DaoSelectorFactory;
@ -27,7 +28,6 @@ import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics; import com.fr.record.analyzer.Metrics;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.BuildContext;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;

176
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

@ -1,53 +1,104 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.base.operator.org.OrganizationOperator;
import com.fr.base.rpc.encrypt.EncryptOperator;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.decision.service.context.ServiceContext;
import com.fr.design.PluginClassRefreshManager; import com.fr.design.PluginClassRefreshManager;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.file.filetree.FileNodes;
import com.fr.form.share.ShareComponentOperator;
import com.fr.form.share.ShareEmbeddedConverter;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.extension.Prepare;
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.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; 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 java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
/** /**
* Created by juhaoyu on 2019-06-14. * DesignerWorkspaceActivator
*
* @author juhaoyu
* @since 10.0
* Created on 2019-06-14
*/ */
public class DesignerWorkspaceActivator extends Activator { public class DesignerWorkspaceActivator extends Activator implements Prepare {
private Listener<Workspace> beforeSwitch4Min = new Listener<Workspace>(Integer.MIN_VALUE) {
@Override
public void start() {
registerEnvListener();
}
/**
* 注册切换环境前后事件监听
*/
private void registerEnvListener() {
/*切换环境前,关闭所有相关模块,最后执行*/
listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>(Integer.MIN_VALUE) {
@Override @Override
public void on(Event event, Workspace current) { public void on(Event event, Workspace current) {
// 切换环境功能要再斟酌一下怎么实现合理一些
stopSub(EnvBasedModule.class); //stopSub(EnvBasedModule.class);
} }
}); };
/*切换环境后,重新启动所有相关模块,最先执行*/ private Listener<Workspace> afterSwitch4Max = new Listener<Workspace>(Integer.MAX_VALUE) {
listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>(Integer.MAX_VALUE) {
@Override @Override
public void on(Event event, Workspace current) { public void on(Event event, Workspace current) {
// 切换环境功能要再斟酌一下怎么实现合理一些
startSub(EnvBasedModule.class); //startSub(EnvBasedModule.class);
} }
}); };
/*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/ private Listener<Workspace> beforeSwitch4Max = new Listener<Workspace>(Integer.MAX_VALUE) {
listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>(Integer.MAX_VALUE) {
@Override @Override
public void on(Event event, Workspace workspace) { public void on(Event event, Workspace workspace) {
@ -55,17 +106,37 @@ public class DesignerWorkspaceActivator extends Activator {
HistoryTemplateListCache.getInstance().stash(); HistoryTemplateListCache.getInstance().stash();
PluginClassRefreshManager.getInstance().fireTabChange(); PluginClassRefreshManager.getInstance().fireTabChange();
} }
}); };
/*切换环境后,装载一下打开的所有文件对象,优先级低于默认优先级,要后于 启动相关模块部分 被触发*/ private Listener<Workspace> afterSwitch4Min = new Listener<Workspace>(Integer.MIN_VALUE) {
listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>(Integer.MIN_VALUE) {
@Override @Override
public void on(Event event, Workspace workspace) { public void on(Event event, Workspace workspace) {
HistoryTemplateListCache.getInstance().load(); HistoryTemplateListCache.getInstance().load();
PluginClassRefreshManager.getInstance().addPluginListener(); PluginClassRefreshManager.getInstance().addPluginListener();
} }
}); };
@Override
public void start() {
registerEnvListener();
}
/**
* 注册切换环境前后事件监听
*/
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 startServer(Workspace current) { private void startServer(Workspace current) {
@ -87,6 +158,51 @@ public class DesignerWorkspaceActivator extends Activator {
@Override @Override
public void stop() { public void stop() {
EventDispatcher.stopListen(beforeSwitch4Max);
EventDispatcher.stopListen(beforeSwitch4Min);
EventDispatcher.stopListen(afterSwitch4Min);
EventDispatcher.stopListen(afterSwitch4Max);
}
@Override
public void prepare() {
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()));
} }
} }

8
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -1,5 +1,7 @@
package com.fr.start.module; package com.fr.start.module;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance; import com.fr.design.EnvChangeEntrance;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
@ -8,14 +10,13 @@ import com.fr.design.editlock.ServerTableDataLockChangeChecker;
import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.plugin.remind.PluginErrorDesignReminder; import com.fr.design.plugin.remind.PluginErrorDesignReminder;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.utils.WorkspaceUtils; import com.fr.env.utils.WorkspaceUtils;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.DesignContext;
import com.fr.value.NotNullLazyValue; import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -33,7 +34,7 @@ public class DesignerWorkspaceProvider extends Activator {
@NotNull @NotNull
@Override @Override
protected StartupArgs compute() { protected StartupArgs compute() {
return findSingleton(StartupArgs.class); return Carina.getApplicationContext().singleton(StartupArgsShell.class).get();
} }
}; };
@ -49,6 +50,7 @@ public class DesignerWorkspaceProvider extends Activator {
try { try {
String current = DesignerEnvManager.getEnvManager().getCurEnvName(); String current = DesignerEnvManager.getEnvManager().getCurEnvName();
workspaceInfo = WorkspaceUtils.getWorkspaceInfo(); workspaceInfo = WorkspaceUtils.getWorkspaceInfo();
((DesignContext)Carina.getApplicationContext()).setDesignWebInfPath(workspaceInfo.getPath());
Workspace workspace = DesignerWorkspaceGenerator.generate(workspaceInfo); Workspace workspace = DesignerWorkspaceGenerator.generate(workspaceInfo);
boolean checkValid = workspace != null && workspaceInfo.checkValid(); boolean checkValid = workspace != null && workspaceInfo.checkValid();
if (!checkValid) { if (!checkValid) {

9
designer-realize/src/main/java/com/fr/start/module/optimized/DesignerPluginActivator.java

@ -2,7 +2,6 @@ package com.fr.start.module.optimized;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import com.fr.plugin.PluginActivator;
import com.fr.start.common.DesignerStartupExecutor; import com.fr.start.common.DesignerStartupExecutor;
/** /**
@ -12,13 +11,13 @@ public class DesignerPluginActivator extends Activator {
@Override @Override
public void start() { public void start() {
// 无用了,用PluginComponent
DesignerStartupExecutor.getInstance().execute(() -> ModuleContext.getModule(PluginActivator.class).start()); //DesignerStartupExecutor.getInstance().execute(() -> ModuleContext.getModule(PluginActivator.class).start());
} }
@Override @Override
public void stop() { public void stop() {
// 无用了,用PluginComponent
ModuleContext.getModule(PluginActivator.class).stop(); //ModuleContext.getModule(PluginActivator.class).stop();
} }
} }

15
designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

@ -1,5 +1,8 @@
package com.fr.start.module.optimized; package com.fr.start.module.optimized;
import com.fanruan.boot.key.ActivatorContextGroup;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
@ -36,7 +39,7 @@ public class DesignerStartupPageActivator extends Activator {
@NotNull @NotNull
@Override @Override
protected StartupArgs compute() { protected StartupArgs compute() {
return findSingleton(StartupArgs.class); return Carina.getApplicationContext().singleton(StartupArgsShell.class).get();
} }
}; };
@ -63,7 +66,11 @@ public class DesignerStartupPageActivator extends Activator {
private void startNonStartupPage() { private void startNonStartupPage() {
StopWatch recorder = DesignerStartupContext.getRecorder(); StopWatch recorder = DesignerStartupContext.getRecorder();
try {
DesignerStartupPageUtil.enterWorkspace(); DesignerStartupPageUtil.enterWorkspace();
} catch (Exception e) {
throw new RuntimeException(e);
}
recordStartupEnd(recorder); recordStartupEnd(recorder);
} }
@ -75,7 +82,7 @@ public class DesignerStartupPageActivator extends Activator {
// 即时暂停 // 即时暂停
suspendRecorder(context); suspendRecorder(context);
addMutable(ActivatorContext.KEY, activatorContext); Carina.getApplicationContext().group(ActivatorContextGroup.class).add(activatorContext);
PreLoadService.getInstance().waitForUI(); PreLoadService.getInstance().waitForUI();
@ -159,7 +166,11 @@ public class DesignerStartupPageActivator extends Activator {
DesignerStartupContext.getInstance().setOnWaiting(false); DesignerStartupContext.getInstance().setOnWaiting(false);
DesignerStartupContext.getInstance().setOnStartup(true); DesignerStartupContext.getInstance().setOnStartup(true);
try {
DesignerStartupPageUtil.enterWorkspace(); DesignerStartupPageUtil.enterWorkspace();
} catch (Exception e) {
throw new RuntimeException(e);
}
} finally { } finally {
UIUtil.invokeLaterIfNeeded(() -> { UIUtil.invokeLaterIfNeeded(() -> {
// 换到 awt 线程中关闭,不然异步会出现问题。 // 换到 awt 线程中关闭,不然异步会出现问题。

5
designer-realize/src/main/java/com/fr/start/module/optimized/TenantDBAdapter4Designer.java

@ -1,5 +1,8 @@
package com.fr.start.module.optimized; package com.fr.start.module.optimized;
import com.fanruan.carina.Carina;
import com.fanruan.dao.shell.DBContextShell;
import com.fr.config.BaseDBEnv;
import com.fr.config.dao.DaoSelectorFactory; import com.fr.config.dao.DaoSelectorFactory;
import com.fr.config.dao.swicter.DaoSwitcher; import com.fr.config.dao.swicter.DaoSwitcher;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -8,6 +11,7 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.exit.ConfigToPropMigrator; import com.fr.exit.ConfigToPropMigrator;
import com.fr.stable.db.DBContext;
import com.fr.stable.db.tenant.TenantDBAdapter; import com.fr.stable.db.tenant.TenantDBAdapter;
import com.fr.start.event.LazyStartupEvent; import com.fr.start.event.LazyStartupEvent;
import com.fr.start.server.EmbedServerEvent; import com.fr.start.server.EmbedServerEvent;
@ -21,6 +25,7 @@ public class TenantDBAdapter4Designer extends TenantDBAdapter {
@Override @Override
public void start() { public void start() {
BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get());
if (DaoSelectorFactory.getDaoSelector().useCacheDao()) { if (DaoSelectorFactory.getDaoSelector().useCacheDao()) {
listenEvent(LazyStartupEvent.INSTANCE, new Listener<Null>() { listenEvent(LazyStartupEvent.INSTANCE, new Listener<Null>() {
@Override @Override

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

@ -1,7 +1,7 @@
package com.fr.start.util; package com.fr.start.util;
import com.fr.module.ModuleContext; import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory;
import com.fr.start.module.DesignerWorkspaceActivator;
/** /**
* created by Harrison on 2022/07/11 * created by Harrison on 2022/07/11
@ -11,21 +11,16 @@ public class DesignerStartupPageUtil {
/** /**
* 进入工作目录 * 进入工作目录
*/ */
public static void enterWorkspace() { public static void enterWorkspace() throws Exception {
BootstrapFactory.get().start("design_show");
ModuleContext
.getModule(DesignerWorkspaceActivator.class)
.start();
} }
/** /**
* 退出工作目录 * 退出工作目录
*/ */
public static void exitWorkspace() { public static void exitWorkspace() throws Exception {
BootstrapFactory.get().stop("design_show");
ModuleContext
.getModule(DesignerWorkspaceActivator.class)
.stop();
} }
} }

Loading…
Cancel
Save