Browse Source

Pull request #14196: 无jira任务,合并分支

Merge in DESIGN/design from ~DESTINY.LIN/design:fbp-1.0 to fbp-1.0

* commit '61412e90c3f9aedd1ff2d2f517874053680863fd':
  KERNEL-19047 设计器远程设计适配数据连接配置读写分离
  REPORT-126685 fbp设计器适配——数据连接存储位置研究 代码规范
  REPORT-126685 fbp设计器适配——数据连接存储位置研究
  REPORT-126723 新建的服务器数据集设计器重启后丢失
  REPORT-126687 fbp设计器——单元格形态-条形码显示异常
  REPORT-126694 预定义控件保存失败
fbp-1.0
Destiny.Lin-林锦龙 4 months ago
parent
commit
b16ac8d30e
  1. 119
      designer-base/src/main/java/com/fr/design/ConfigHelper.java
  2. 9
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 3
      designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java
  4. 4
      designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java
  5. 2
      designer-base/src/main/java/com/fr/design/backup/DesignContext.java
  6. 117
      designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java
  7. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  8. 91
      designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java
  9. 2
      designer-base/src/main/java/com/fr/design/mem/MemConfigRepository.java
  10. 30
      designer-base/src/main/java/com/fr/design/mem/MemConfigRepositoryBuilder.java
  11. 2
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java
  12. 104
      designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java
  13. 17
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java
  14. 20
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  15. 17
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java
  16. 5
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java
  17. 20
      designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java
  18. 17
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java
  19. 3
      designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java
  20. 3
      designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java
  21. 3
      designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java
  22. 5
      designer-realize/src/main/java/com/fr/design/present/BarCodePane.java
  23. 1
      designer-realize/src/main/java/com/fr/start/CarinaDesigner.java
  24. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

119
designer-base/src/main/java/com/fr/design/ConfigHelper.java

@ -0,0 +1,119 @@
package com.fr.design;
import com.fanruan.carina.Carina;
import com.fanruan.product.ProductConstants;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.resource.ResourceIOException;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
/**
* 配置工具类
* <oi>
* <li>1.获取基础配置</li>
* <li>2.获取环境配置</li>
* <li>3.基础的变量定义与对应环境配置路径获取</li>
* </oi>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/6/26
*/
public class ConfigHelper {
public static final String TAIL = ".properties";
public static final String CONFIG = "confighelper";
public static final String ENV = "envconfig";
public static final String BASE = ProductConstants.getEnvHome() + File.separator + CONFIG + File.separator;
public static final String BASE_PATH = BASE + "BaseProperties" + TAIL;
/**
* 获取基础的配置工作环境无关的配置内容所有工作环境共用一份
*/
public static Properties getBaseProperties() {
return getProperties(BASE_PATH, null);
}
/**
* 获取对应环境配置
*/
public static Properties getEnvProperties(Workspace workspace) {
return getProperties(getEnvPropertiesPath(workspace), getBaseProperties());
}
/**
* 获取当前环境配置
*/
public static Properties getEnvProperties() {
return getProperties(getEnvPropertiesPath(null), getBaseProperties());
}
/**
* 获取对应环境配置的路径
*/
public static String getEnvPropertiesPath(Workspace workspace) {
return CommonUtils.pathJoin(workspace == null ? WorkContext.getCurrent().getPath() : workspace.getPath(), ProjectConstants.ASSETS_NAME, CONFIG, ENV) + TAIL;
}
/**
* 获取当前环境配置的路径
*/
public static String getEnvPropertiesPath() {
return getEnvPropertiesPath(null);
}
private static Properties getProperties(String path, Properties defaultValue){
Properties properties = new Properties();
if (defaultValue != null) {
properties.putAll(defaultValue);
}
try {
File file = new File(path);
if (!file.exists()) {
createFile(file);
}
properties.load(new BufferedReader(new FileReader(path)));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return properties;
}
private static boolean createFile(File file) throws ResourceIOException {
String parent = file.getParent();
if (StringUtils.isNotEmpty(parent)) {
createDirectory(parent);
}
try {
return file.createNewFile();
} catch (IOException e) {
throw new ResourceIOException("[Resource] Failed to create '" + file.getPath() + "'", e);
}
}
private static boolean createDirectory(String dir) {
File root = new File(dir);
if (root.exists()) {
return false;
}
if (!dir.endsWith(File.separator)) {
dir = dir.concat(File.separator);
}
// 创建目录
return root.mkdirs() || new File(dir).mkdirs();
}
}

9
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -1,6 +1,7 @@
package com.fr.design;
import com.fr.common.report.ReportState;
import com.fr.design.backup.EnvBackupHelper;
import com.fr.design.mainframe.manager.clip.TemplateTreeClipboard;
import com.fr.design.plugin.remind.PluginErrorDesignReminder;
import com.fr.design.data.DesignTableDataManager;
@ -59,6 +60,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.HashSet;
@ -109,14 +111,15 @@ public class EnvChangeEntrance {
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
DesignerWorkspaceInfoContext.setWorkspaceInfo(selectedEnv);
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
EnvBackupHelper.getInstance().backup();
try {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
boolean checkValid = workspace != null && selectedEnv.checkValid();
if (!checkValid) {
return false;
}
// 更新目标环境
EnvBackupHelper.getInstance().prepare4switch(workspace);
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
@ -127,6 +130,7 @@ public class EnvChangeEntrance {
//初始化一下serverTray
ServerTray.init();
}
EnvBackupHelper.getInstance().success();
}
});
// REPORT-25688如果是war包部署的服务器,给与提示
@ -142,6 +146,7 @@ public class EnvChangeEntrance {
PluginErrorDesignReminder.getInstance().remindStartFailedPlugins();
} catch (Exception exception) {
// 失败的处理
EnvBackupHelper.getInstance().failed();
WorkspaceExceptionHandler.getInstance().handleInSwitch(exception, selectedEnv);
return false;
}

3
designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java

@ -59,8 +59,7 @@ public class FunctionManagerAction extends UpdateAction {
}
});
FunctionConfig mirror = functionManager.mirror();
functionManagerPane.populate(mirror);
functionManagerPane.populate(functionManager);
functionManagerDialog.setVisible(true);
}

4
designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java

@ -36,9 +36,7 @@ public class ProcedureListAction extends UpdateAction {
final ProcedureConfig procedureConfig = ProcedureConfig.getInstance();
final ProcedureManagerPane databaseManagerPane = new ProcedureManagerPane() {
public void complete() {
ProcedureConfig mirror = procedureConfig.mirror();
populate(mirror);
populate(procedureConfig);
}
};
BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);

2
designer-realize/src/main/java/com/fr/start/DesignContext.java → designer-base/src/main/java/com/fr/design/backup/DesignContext.java

@ -1,4 +1,4 @@
package com.fr.start;
package com.fr.design.backup;
import com.fanruan.carina.context.CarinaApplicationContext;
import com.fanruan.carina.standard.PartitionManager;

117
designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java

@ -0,0 +1,117 @@
package com.fr.design.backup;
import com.fanruan.carina.Carina;
import com.fanruan.config.realm.ConfigRepositoryFactory;
import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder;
import com.fr.design.ConfigHelper;
import com.fr.design.mem.MemConfigBackupManager;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import java.util.Properties;
/**
* 切换环境对应的帮助类主要负责环境切换的备份与环境属性的设置
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/7/12
*/
public class EnvBackupHelper {
private static final EnvBackupHelper INSTANCE = new EnvBackupHelper();
private boolean swtiching = false;
private boolean local = true;
private Properties properties = null;
private String path = null;
private Workspace target;
private Workspace origin;
/**
* 获取单例
*/
public static EnvBackupHelper getInstance() {
return INSTANCE;
}
/**
* 备份
* <p>切换前需要判断为什么当前的配置框架需要在切换前做好备份防止切换失败失败的话要切回备份</p>
*/
public void backup() {
FineLoggerFactory.getLogger().info("[EnvBackup] 1.back start...");
this.swtiching = true;
local = WorkContext.getCurrent().isLocal();
if (local) {
properties = ConfigHelper.getEnvProperties();
path = ConfigHelper.getEnvPropertiesPath();
}
origin = WorkContext.getCurrent();
}
/**
* 切换前的准备
* <p>设置目标环境</p>
* <p>设置新的工程路径</p>
*/
public void prepare4switch(Workspace workspace) {
this.target = workspace;
((DesignContext) Carina.getApplicationContext()).setDesignWebInfPath(workspace.getPath());
}
/**
* 切换
*/
public void do4Switch4Config() {
FineLoggerFactory.getLogger().info("[EnvBackup] 2.do config switch");
// 切换环境的时候新配置框架启动前要先reset原来的
ConfigRepositoryFactory.getInstance().reset();
if (target.isLocal()) {
//如果目标是本地,就清空然后重新注册新的本地配置
ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new LocalConfigRepositoryBuilder(ConfigHelper.getEnvProperties(target), ConfigHelper.getEnvPropertiesPath(target)));
} else {
// 如果是切到远程,先暂时用备份的内存配置,成功后再转到新配置,失败则切回原内存配置
MemConfigBackupManager.getInstance().startSwitch();
}
}
/**
* 切换成功后的处理
*/
public void success() {
FineLoggerFactory.getLogger().info("[EnvBackup] 3.switch all" );
//切换成功,如果原来是本地,则清空备份,不需要干别的,此时配置走的就是新环境的本地
if (local) {
properties = null;
path = null;
} else {
// 如果原来是远程,就把内存的新环境配置替换掉原来旧的,然后新配置清空
MemConfigBackupManager.getInstance().success();
}
}
/**
* 切换失败后的处理
*/
public void failed() {
FineLoggerFactory.getLogger().info("[EnvBackup] 3.handle failed" );
((DesignContext) Carina.getApplicationContext()).setDesignWebInfPath(origin.getPath());
// 切换失败,如果原来是本地,则切回去
ConfigRepositoryFactory.getInstance().reset();
if (local) {
ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new LocalConfigRepositoryBuilder(properties, path));
} else {
// 如果是远程,则新环境的配置全部弃用,直接走老的
MemConfigBackupManager.getInstance().failed();
}
}
public boolean isSwtiching() {
return swtiching;
}
public EnvBackupHelper setSwtiching(boolean swtiching) {
this.swtiching = swtiching;
return this;
}
}

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,6 +1,7 @@
package com.fr.design.data.datapane.connect;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.ConnectionConfigWriterFactory;
import com.fr.config.remote.RemoteConfigEvent;
import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection;
@ -352,11 +353,11 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) {
final int remaining = ConnectionConfigProviderFactory.getConfigProvider().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size());
try {
removedConnNames.forEach(n -> ConnectionConfigProviderFactory.getConfigProvider().removeConnection(n));
removedConnNames.forEach(n -> ConnectionConfigWriterFactory.getConfigWriter().removeConnection(n));
int innerRemaining = remaining;
for (ConnectionBean cb : addedOrUpdatedConnections) {
if (innerRemaining > 0) {
ConnectionConfigProviderFactory.getConfigProvider().addConnectionWithoutCheck(cb.getName(), cb.getConnection());
ConnectionConfigWriterFactory.getConfigWriter().addConnectionWithoutCheck(cb.getName(), cb.getConnection());
innerRemaining--;
} else {
break;

91
designer-base/src/main/java/com/fr/design/mem/MemConfigBackupManager.java

@ -0,0 +1,91 @@
package com.fr.design.mem;
import com.fanruan.config.realm.ConfigRepositoryProvider;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 内存配置框架备份管理
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/7/11
*/
public class MemConfigBackupManager {
private static final MemConfigBackupManager INSTANCE = new MemConfigBackupManager();
private Map<String, ConfigRepositoryProvider> oldEnvConfig = new ConcurrentHashMap<>();
private Map<String, ConfigRepositoryProvider> newEnvConfig = new ConcurrentHashMap<>();
private boolean switching = false;
/**
* 获取备份
*/
public static MemConfigBackupManager getInstance() {
return INSTANCE;
}
/**
* 获取配置
*/
public ConfigRepositoryProvider get(String namespace) {
if (switching) {
return newEnvConfig.getOrDefault(namespace, null);
}
return oldEnvConfig.getOrDefault(namespace, null);
}
/**
* 放入配置
*/
public void put(String namespace, ConfigRepositoryProvider provider) {
if (switching) {
newEnvConfig.put(namespace, provider);
} else {
oldEnvConfig.put(namespace, provider);
}
}
/**
* 清理
*/
public void clear() {
oldEnvConfig.clear();
newEnvConfig.clear();
switching = false;
}
/**
* 切换成功则将切换过程中的配置移动到旧配置新的切换过程中的配置置空
*/
public void success() {
oldEnvConfig = new HashMap<>(newEnvConfig);
newEnvConfig.clear();
switching = false;
}
/**
* 失败处理
*/
public void failed() {
newEnvConfig.clear();
switching = false;
}
public boolean isSwitching() {
return switching;
}
/**
* 开始切换
*/
public void startSwitch() {
switching = true;
}
}

2
designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepository.java → designer-base/src/main/java/com/fr/design/mem/MemConfigRepository.java

@ -1,4 +1,4 @@
package com.fanruan.boot.mem;
package com.fr.design.mem;
import com.fanruan.config.event.ConfigListener;
import com.fanruan.config.realm.ConfigRepositoryProvider;

30
designer-base/src/main/java/com/fr/design/mem/MemConfigRepositoryBuilder.java

@ -0,0 +1,30 @@
package com.fr.design.mem;
import com.fanruan.config.realm.ConfigRepositoryBuilder;
import com.fanruan.config.realm.ConfigRepositoryProvider;
/**
* 设计器MemConfigRepositoryBuilder
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/29
*/
public class MemConfigRepositoryBuilder implements ConfigRepositoryBuilder {
@Override
public ConfigRepositoryProvider build(String namespace) throws Exception {
ConfigRepositoryProvider provider = MemConfigBackupManager.getInstance().get(namespace);
if (provider != null) {
// 如果备份中有说明就是当前要的配置
return provider;
} else {
// 如果没有,说明是全新的远程环境,新建一个
provider = new MemConfigRepository(namespace);
// 备份也得放一个
MemConfigBackupManager.getInstance().put(namespace, provider);
}
return provider;
}
}

2
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java

@ -111,7 +111,7 @@ public class ChartPreStyleListPane extends JListControlPane {
}
public void populateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
ArrayList list = new ArrayList();
Iterator keys = config.names();

104
designer-realize/src/main/java/com/fanruan/boot/ConfigHelper.java

@ -1,104 +0,0 @@
package com.fanruan.boot;
import com.fanruan.carina.Carina;
import com.fanruan.product.ProductConstants;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.io.File;
import java.io.InputStream;
import java.util.Properties;
/**
* 配置工具类
* <oi>
* <li>1.获取基础配置</li>
* <li>2.获取环境配置</li>
* <li>3.基础的变量定义与对应环境配置路径获取</li>
* </oi>
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/6/26
*/
public class ConfigHelper {
public static final String TAIL = ".properties";
public static final String CONFIG = "confighelper";
public static final String BASE = ProductConstants.getEnvHome() + File.separator + CONFIG + File.separator;
public static final String BASE_PATH = BASE + "BaseProperties" + TAIL;
private static String path = StringUtils.EMPTY;
/**
* 获取基础的配置工作环境无关的配置内容所有工作环境共用一份
*/
public static Properties getBaseProperties() {
return getProperties(BASE_PATH, null);
}
/**
* 获取当前环境配置
*/
public static Properties getEnvProperties() {
return getProperties(getEnvPropertiesPath(), getBaseProperties());
}
/**
* 获取当前环境配置的路径
*/
public static String getEnvPropertiesPath() {
return path + TAIL;
}
/**
* 规范化配置文件的路径保证配置文件落在缓存文件夹(110)
*/
public static String normalise(String path) {
if (!path.startsWith(BASE)) {
path = BASE + path.replace("\\", "_").replace("/", "_").replace(":", "_");
}
return path;
}
/**
* 设置config路径
*/
public static void setPath(String path) {
ConfigHelper.path = normalise(path);
}
/**
* 获取路径
*/
public static String getPath() {
if (StringUtils.isEmpty(path)) {
path = Carina.getApplicationContext().getWebInfPath();
}
return path;
}
private static Properties getProperties(String path, Properties defaultValue){
Properties properties = new Properties();
if (defaultValue != null) {
properties.putAll(defaultValue);
}
try {
if (!ResourceIOUtils.exist(path)) {
ResourceIOUtils.createFile(path);
}
try (InputStream is = ResourceIOUtils.read(path)){
properties.load(is);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return properties;
}
}

17
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java vendored

@ -1,7 +1,8 @@
package com.fanruan.boot.env;
import com.fanruan.boot.ConfigHelper;
import com.fr.design.ConfigHelper;
import com.fanruan.boot.key.StartupArgsShell;
import com.fr.design.mem.MemConfigRepositoryBuilder;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
@ -26,7 +27,6 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.plugin.remind.PluginErrorDesignReminder;
import com.fr.env.utils.WorkspaceUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.file.filetree.FileNodes;
@ -36,8 +36,7 @@ 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.stable.StringUtils;
import com.fr.start.DesignContext;
import com.fr.design.backup.DesignContext;
import com.fr.start.module.StartupArgs;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
@ -186,7 +185,6 @@ public class DesignEnvChooseComponent extends ResourceAffiliate {
String current = DesignerEnvManager.getEnvManager().getCurEnvName();
workspaceInfo = WorkspaceUtils.getWorkspaceInfo();
((DesignContext)Carina.getApplicationContext()).setDesignWebInfPath(workspaceInfo.getPath());
updateConfigPath(workspaceInfo);
Workspace workspace = DesignerWorkspaceGenerator.generate(workspaceInfo);
boolean checkValid = workspace != null && workspaceInfo.checkValid();
if (!checkValid) {
@ -205,17 +203,14 @@ public class DesignEnvChooseComponent extends ResourceAffiliate {
private void updateConfigBuilder() {
ConfigRepositoryFactory.getInstance().reset();
if (WorkContext.getCurrent().isLocal()) {
ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new LocalConfigRepositoryBuilder(ConfigHelper.getEnvProperties(), ConfigHelper.getEnvPropertiesPath()));
}
private void updateConfigPath(DesignerWorkspaceInfo workspaceInfo) {
if (StringUtils.isEmpty(workspaceInfo.getPath())) {
ConfigHelper.setPath(workspaceInfo.getConnection().getUrl());
} else {
ConfigHelper.setPath(workspaceInfo.getPath());
ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new MemConfigRepositoryBuilder());
}
}
/**
* 注册切换环境前后事件监听
*/

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

@ -30,7 +30,6 @@ import com.fr.cbb.dialect.security.InsecurityElementFactory;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.lock.ClusterLock;
import com.fr.config.BaseDBEnv;
import com.fr.config.ConfigContext;
import com.fr.config.ConfigEvent;
import com.fr.config.FinalPreferenceConfig;
import com.fr.config.dao.DaoContext;
@ -46,6 +45,12 @@ import com.fr.config.dao.impl.remote.RemoteXmlEntityDao;
import com.fr.config.impl.ConfConfigProviderImpl;
import com.fr.config.impl.ConfigInsecurityElementProviderImpl;
import com.fr.decision.service.context.ServiceContext;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionPluginProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDYConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor;
import com.fr.design.backup.EnvBackupHelper;
import com.fr.env.detect.EnvDetectorCenter;
import com.fr.event.EventDispatcher;
import com.fr.general.FRLogger;
@ -64,9 +69,7 @@ import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.record.analyzer.AnalyzerConfiguration;
import com.fr.record.analyzer.AnalyzerKey;
import com.fr.record.analyzer.AnalyzerMutableGroup;
import com.fr.record.analyzer.Assistant;
import com.fr.record.analyzer.DBMetrics;
import com.fr.scheduler.QuartzContext;
import com.fr.scheduler.SchedulerEvent;
@ -76,7 +79,6 @@ import com.fr.security.encryption.core.EncryptionScaffold;
import com.fr.security.encryption.provider.SecuritySeedProvider;
import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.StringUtils;
import com.fr.stable.db.DBContext;
import com.fr.stable.db.properties.FineMicroServicesDBProperties;
@ -84,11 +86,8 @@ import com.fr.stable.db.session.DBSession;
import com.fr.stable.project.ProjectConstants;
import com.fr.tenant.context.TenantContext;
import com.fr.tenant.context.provider.CurrentTenantKey;
import com.fr.third.net.bytebuddy.description.type.TypeDescription;
import com.fr.third.net.bytebuddy.dynamic.DynamicType;
import com.fr.third.net.bytebuddy.implementation.MethodDelegation;
import com.fr.third.net.bytebuddy.matcher.ElementMatchers;
import com.fr.third.net.bytebuddy.utility.JavaModule;
import com.fr.third.org.hibernate.jdbc.AbstractWork;
import com.fr.tolerance.FaultTolerance;
import com.fr.tolerance.FaultToleranceInterceptor;
@ -102,7 +101,6 @@ import com.fr.workspace.WorkContext;
import java.net.URI;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Objects;
import java.util.Properties;
/**
@ -249,7 +247,7 @@ public class DesignEnvComponent {
private void startFileServer() throws Exception {
if (WorkContext.getCurrent().isLocal()) {
// 设计器远程下不需要文件系统,走PublicRepo的接口,本地下走基础的磁盘读写
LocalFileRepository localFileRepository = LocalFileRepository.getSingleton();
LocalFileRepository localFileRepository = new LocalFileRepository(ProjectConstants.LOCAL_ENV, ServiceContext.getWebInfPath());
ResourceRepository realRepo = RepositoryFactory.getRepo();
FSProperties fsProperties = Carina.properties(FSProperties.class);
FileServer.init(
@ -304,6 +302,10 @@ public class DesignEnvComponent {
*/
private void startConfConfig() {
if (EnvBackupHelper.getInstance().isSwtiching()) {
// 如果是切换环境触发的start,说明此时读的是新环境的配置
EnvBackupHelper.getInstance().do4Switch4Config();
}
BaseDBEnv.setDBContext((DBContext) Carina.getApplicationContext().singleton(DBContextShell.class).get());
if (!WorkContext.getCurrent().isLocal()) {
TransactorFactory.setTransactor(new RemoteTransactor());

17
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java vendored

@ -1,11 +1,21 @@
package com.fanruan.boot.env.function;
import com.fanruan.boot.DatasourceComponent;
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.carina.annotions.Supplemental;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.ConnectionConfigWriter;
import com.fanruan.config.impl.data.ConnectionConfigWriterFactory;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionPluginProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDYConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor;
import com.fr.workspace.server.repository.connection.ConnectionWriterShell;
/**
@ -25,6 +35,11 @@ public class DesignDatasourceComponent extends DatasourceComponent {
@Supplemental
public void prepare() {
super.prepare();
// 注册数据连接处理器
ConnectionProcessorFactory.register(JDBCConnectionProcessor.KEY);
ConnectionProcessorFactory.register(JNDIConnectionProcessor.KEY);
ConnectionProcessorFactory.register(ConnectionPluginProcessor.KEY);
ConnectionProcessorFactory.register(JDYConnectionProcessor.KEY);
}
/**
@ -33,6 +48,8 @@ public class DesignDatasourceComponent extends DatasourceComponent {
@Start
public void start() {
super.start();
ConnectionConfigWriterFactory.registerConnectionConfigWriter((ConnectionConfigWriter) ConnectionConfigProviderFactory.getConfigProvider());
Carina.getApplicationContext().singleton(ConnectionWriterShell.class).set(ConnectionConfigWriterFactory.getConfigWriter());
}
/**

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

@ -23,7 +23,6 @@ import com.fr.env.operator.CommonOperatorImpl;
import com.fr.esd.core.remote.ESDConfigEventOperator;
import com.fr.esd.core.remote.ESDConfigEventOperatorImpl;
import com.fr.file.ConnectionOperator;
import com.fr.file.ConnectionOperatorImpl;
import com.fr.file.TableDataOperator;
import com.fr.file.TableDataOperatorImpl;
import com.fr.file.filetree.FileNodes;
@ -48,6 +47,7 @@ import com.fr.workspace.pool.WorkRPCRegister;
import com.fr.workspace.pool.WorkRPCType;
import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fanruan.workplace.network.RemoteNetworkRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
@ -145,10 +145,9 @@ public class DesignWorkContextComponent {
WorkRPCRegister.wrap(DataOperatorProvider.class, new DataOperator()),
WorkRPCRegister.wrap(ESDConfigEventOperator.class, new ESDConfigEventOperatorImpl()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, TableDataOperator.class, TableDataOperatorImpl.getInstance()),
WorkRPCRegister.wrap(WorkRPCType.Compatible, ConnectionOperator.class, ConnectionOperatorImpl.getInstance()),
WorkRPCRegister.wrap(FileAssistUtilsOperator.class, new FileAssistUtils()),
WorkRPCRegister.wrap(TableDataOperator.class, TableDataOperatorImpl.getInstance()),
WorkRPCRegister.wrap(ConnectionOperator.class, ConnectionOperatorImpl.getInstance()),
WorkRPCRegister.wrap(ConnectionOperator.class, CompatibleConnectionOperator.getInstance()),
WorkRPCRegister.wrap(BuildInfoOperator.class, new BuildInfoOperatorImpl())
);
}

20
designer-realize/src/main/java/com/fanruan/boot/mem/MemConfigRepositoryBuilder.java

@ -1,20 +0,0 @@
package com.fanruan.boot.mem;
import com.fanruan.config.realm.ConfigRepositoryBuilder;
import com.fanruan.config.realm.ConfigRepositoryProvider;
/**
* 设计器MemConfigRepositoryBuilder
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/29
*/
public class MemConfigRepositoryBuilder implements ConfigRepositoryBuilder {
@Override
public ConfigRepositoryProvider build(String namespace) throws Exception {
return new MemConfigRepository(namespace);
}
}

17
designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java

@ -1,8 +1,7 @@
package com.fanruan.boot.pre;
import com.fanruan.boot.ConfigHelper;
import com.fr.design.ConfigHelper;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.boot.mem.MemConfigRepositoryBuilder;
import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start;
@ -15,9 +14,7 @@ import com.fanruan.config.realm.ConfigRepositoryFactory;
import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder;
import com.fanruan.mq.CarinaMQ;
import com.fanruan.mq.InternalMQProvider;
import com.fanruan.product.ProductConstants;
import com.fr.base.function.UITerminator;
import com.fr.carina.revert.provider.CarinaPluginProvider;
import com.fr.carina.util.CarinaResourceUtils;
import com.fr.carina.util.provider.CarinaResourceProvider;
import com.fr.design.DesignerEnvManager;
@ -36,13 +33,10 @@ import com.fr.general.CommonIOUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.module.engine.event.LifecycleErrorEvent;
import com.fr.plugin.ExtraClassManager;
import com.fr.runtime.FineRuntime;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.CommonUtils;
import com.fr.stable.fun.ResourcePathTransformer;
import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.stable.plugin.ExtraClassManagerProvider;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.resource.ResourceLoader;
import com.fr.start.DesignerSubListener;
@ -57,22 +51,13 @@ 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 com.fr.web.controller.common.FileContentModificator;
import com.fr.web.controller.plugin.PluginFileContentModificator;
import com.fr.web.file.FileContentProcessorFactory;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
/**

3
designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -49,8 +49,7 @@ public class ServerConfigManagerAction extends UpdateAction {
@Override
public void complete() {
ServerPreferenceConfig mirror = config.mirror();
populate(mirror);
populate(config);
}
};

3
designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java

@ -61,8 +61,7 @@ public class StyleListAction extends UpdateAction {
}
});
ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror();
styleListPane.populate(mirror);
styleListPane.populate(ServerPreferenceConfig.getInstance());
styleListDialog.setVisible(true);
}

3
designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java

@ -39,8 +39,7 @@ public class WidgetManagerAction extends UpdateAction {
final WidgetManagerPane widgetManagerPane = new WidgetManagerPane() {
@Override
public void complete() {
WidgetInfoConfig mirror = widgetManager.mirror();
populate(mirror);
populate(widgetManager);
}
};

5
designer-realize/src/main/java/com/fr/design/present/BarCodePane.java

@ -1,5 +1,6 @@
package com.fr.design.present;
import com.fr.barcode.core.Barcode;
import com.fr.code.bar.core.BarcodeAttr;
import com.fr.code.BarcodeImpl;
import com.fr.code.bar.core.BarCodeUtils;
@ -326,8 +327,8 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
if (obj == null) {
return;
}
if (obj instanceof BarcodeImpl) {
BarcodeImpl barcodeImpl = (BarcodeImpl) obj;
if (obj instanceof Barcode) {
Barcode barcodeImpl = (Barcode) obj;
Dimension size = this.getSize();
barcodeImpl.draw((Graphics2D) g, (int) (size.getWidth() - barcodeImpl.getWidth()) / 2, (int) (size.getHeight() - barcodeImpl.getHeight()) / 2);
} else {

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

@ -7,6 +7,7 @@ import com.fanruan.carina.context.CarinaApplicationContext;
import com.fanruan.carina.standard.PartitionManager;
import com.fanruan.carina.standard.PartitionManagerImpl;
import com.fr.base.StateHubContext;
import com.fr.design.backup.DesignContext;
import com.fr.design.carton.SwitchForSwingChecker;
import com.fr.log.FineLoggerFactory;

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

@ -16,7 +16,7 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.module.Activator;
import com.fr.start.DesignContext;
import com.fr.design.backup.DesignContext;
import com.fr.value.NotNullLazyValue;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;

Loading…
Cancel
Save