Browse Source

Pull request #14265: REPORT-114392 FR-FBP版本本地设计适配

Merge in DESIGN/design from ~DESTINY.LIN/design:mss/2.0 to mss/2.0

* commit 'e17feb7436565577db77e99c28e8a72fd3672f64':
  REPORT-114392 FR-FBP版本本地设计适配 修复国际化
  REPORT-114392 FR-FBP版本本地设计适配 修复数据连接
  REPORT-114392 FR-FBP版本本地设计适配 修复数据连接保存
  REPORT-114392 FR-FBP版本本地设计适配 关闭环境监测
  REPORT-127453 frm问题处理
mss/2.0
Destiny.Lin-林锦龙 4 months ago
parent
commit
885306a51e
  1. 5
      designer-base/src/main/java/com/fr/design/ConfigHelper.java
  2. 6
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  3. 43
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  4. 22
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  5. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  6. 124
      designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java
  7. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  8. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java
  9. 8
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  10. 3
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  11. 4
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  12. 12
      designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java
  13. 3
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  14. 2
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java
  15. 2
      designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java
  16. 49
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java

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

@ -94,7 +94,10 @@ public class ConfigHelper {
return properties;
}
private static boolean createFile(File file) throws ResourceIOException {
/**
* 创建配置文件
*/
public static boolean createFile(File file) throws ResourceIOException {
String parent = file.getParent();
if (StringUtils.isNotEmpty(parent)) {
createDirectory(parent);

6
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -14,6 +14,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.RefreshLabel.Refreshable;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.datapane.preview.PreviewTablePane;
@ -39,6 +40,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.JList;
import javax.swing.JOptionPane;
@ -442,8 +444,10 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return TableData.EMPTY_TABLEDATA;
}
try {
connect = DataOperator.getInstance().testConnection(database);
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(database));
connect = true;
} catch (Exception ignored) {
connect= false;
}
if (!connect) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();

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

@ -3,13 +3,28 @@ 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.auth.AuthenticationType;
import com.fr.data.auth.kerberos.KerberosAuthentication;
import com.fr.data.auth.kerberos.KerberosUtils;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.data.security.ssh.BaseSsh;
import com.fr.data.security.ssh.SshType;
import com.fr.data.security.ssh.impl.KeyVerifySsh;
import com.fr.data.security.ssl.BaseSsl;
import com.fr.data.security.ssl.SslType;
import com.fr.data.security.ssl.impl.NormalSsl;
import com.fr.decision.privilege.TransmissionTool;
import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean;
import com.fr.decision.webservice.bean.datasource.JDBCConnectionBean;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
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.design.ExtraDesignClassManager;
import com.fr.design.data.MapCompareUtils;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
@ -24,10 +39,12 @@ import com.fr.license.database.DBTypes;
import com.fr.license.database.DataBaseTypePointManager;
import com.fr.license.exception.DataBaseNotSupportedException;
import com.fr.log.FineLoggerFactory;
import com.fr.security.encryption.transmission.TransmissionEncryptors;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.third.fasterxml.jackson.databind.ObjectMapper;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.database.DataBaseTypeOperator;
import com.fr.workspace.server.entity.connection.BatchConnectionModifyBean;
@ -220,6 +237,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
List<String> removedConnNames = new ArrayList<>();
List<ConnectionInfoBean> addConnections = new ArrayList<>();
List<ConnectionInfoBean> updateConnection = new ArrayList<>();
List<Connection> validConnection = new ArrayList<>();
MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> {
try {
switch (entryEventKind) {
@ -227,10 +245,12 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
removedConnNames.add(s);
break;
case ADDED:
addConnections.add(ConnectionProcessorFactory.createConnectionInfoBean(s, connection));
addConnections.add(ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true));
validConnection.add(connection);
break;
case UPDATED:
updateConnection.add(ConnectionProcessorFactory.createConnectionInfoBean(s, connection));
updateConnection.add(ConnectionInfoBeanHelper.createConnectionInfoBean(s, connection, true));
validConnection.add(connection);
break;
default:
break;
@ -265,22 +285,18 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
return connection instanceof JDBCDatabaseConnection || connection instanceof JNDIDatabaseConnection;
}
});
List<ConnectionInfoBean> validateBeans = new ArrayList<>();
validateBeans.addAll(addConnections);
validateBeans.addAll(updateConnection);
this.validateDatabaseType(validateBeans);
/// 先不管
//this.validateDatabaseType(validConnection);
this.alterConnections(addConnections, removedConnNames, updateConnection);
}
/**
* 校验是否支持所有新增和修改数据连接的数据库类型
*/
public void validateDatabaseType(@NotNull List<ConnectionInfoBean> addedOrUpdatedConnections) throws Exception {
public void validateDatabaseType(@NotNull List<Connection> addedOrUpdatedConnections) throws Exception {
Set<String> notSupportedConnections = new HashSet<>();
if (!addedOrUpdatedConnections.isEmpty()) {
for (ConnectionInfoBean bean : addedOrUpdatedConnections) {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
for (Connection connection : addedOrUpdatedConnections) {
// 仅校验jdbc连接,其他插件数据连接不进行校验;
if (connection instanceof JDBCDatabaseConnection) {
DBTypes dataBaseTypePoint = DataBaseTypePointManager.getInstance().getDataBaseTypePoint(connection.getDriver(), connection.feature());
@ -360,7 +376,11 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
}
public static void showDialog(Window parent) {
Map<String, Connection> connectionMap = ConnectionConfigProviderFactory.getConfigProvider().getConnections();
List<ConnectionBean> beans = ConnectionRepository.getInstance().getAll();
Map<String, Connection> connectionMap = new HashMap<>();
for (ConnectionBean bean : beans) {
connectionMap.put(bean.getName(), bean.getConnection());
}
final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() {
@Override
public void complete() {
@ -385,4 +405,5 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
}
}
}
}

22
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -14,6 +14,7 @@ import com.fr.data.solution.entity.DriverPage;
import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor;
import com.fr.data.solution.processor.SolutionProcessor;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -29,6 +30,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
@ -429,25 +431,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
// 返回连接结果
DriverPage.updateCache();
final Exception[] exception = new Exception[1];
WorkContext.getCurrent().get(DataOperatorProvider.class, new ExceptionHandler() {
@Override
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
// 正常调用发生的异常也会被捕获,因此需要对异常类型进行判断,如果是NoSuchMethodException 就要去调用 testConnection
// 如果不是 NoSuchMethodException 保存下异常上下文
// 两种情况下异常都需要抛出
if (exceptionInfo.getException() instanceof NoSuchMethodException) {
if (!WorkContext.getCurrent().get(DataOperatorProvider.class).testConnection(database)) {
exception[0] = new Exception(Toolkit.i18nText("Fine-Design_Description_Of_Test_Connection"));
}
} else {
exception[0] = exceptionInfo.getException();
}
return null;
}
}).testConnectionWithException(database);
if (exception[0] != null) {
throw exception[0];
}
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(database));
return null;
}

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

@ -18,6 +18,11 @@ import java.sql.SQLException;
*/
public class LocalConnectionSource extends BaseConnectionSource {
@Override
public void testConnection(ConnectionInfoBean database) throws Exception {
dataOperator.testConnectionWithException(ConnectionProcessorFactory.createConnection(database));
}
@Override
public void add(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean);

124
designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java

@ -0,0 +1,124 @@
package com.fr.design.data.datapane.preview;
import com.fr.data.auth.AuthenticationType;
import com.fr.data.auth.kerberos.KerberosAuthentication;
import com.fr.data.auth.kerberos.KerberosUtils;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.data.security.ssh.BaseSsh;
import com.fr.data.security.ssh.SshType;
import com.fr.data.security.ssh.impl.KeyVerifySsh;
import com.fr.data.security.ssl.BaseSsl;
import com.fr.data.security.ssl.SslType;
import com.fr.data.security.ssl.impl.NormalSsl;
import com.fr.decision.privilege.TransmissionTool;
import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean;
import com.fr.decision.webservice.bean.datasource.JDBCConnectionBean;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
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.security.encryption.transmission.TransmissionEncryptors;
import com.fr.stable.StringUtils;
import com.fr.third.fasterxml.jackson.databind.ObjectMapper;
/**
* 数据连接传输工具类
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/7/25
*/
public class ConnectionInfoBeanHelper {
private static ObjectMapper objectMapper = new ObjectMapper();
/**
* 创建数据连接Bean可自定义是否携带密码
*/
public static ConnectionInfoBean createConnectionInfoBean(String name, Connection connection, boolean withPassword) throws Exception {
if (JDBCConnectionProcessor.KEY.acceptConnections().contains(connection.getClass())) {
ConnectionInfoBean bean = new ConnectionInfoBean();
bean.setConnectionData(objectMapper.writeValueAsString(convertToJDBCConnectionBean(connection, withPassword)));
bean.setConnectionType(JDBCConnectionProcessor.CONNECTION_TYPE);
bean.setConnectionType(JDBCConnectionProcessor.KEY.getConnectionType(connection));
bean.setConnectionName(name);
bean.setCreator(connection.getCreator());
return bean;
} else {
return ConnectionProcessorFactory.createConnectionInfoBean(name, connection);
}
}
/**
* 创建数据连接Bean默认携带密码
*/
public static ConnectionInfoBean createConnectionInfoBean(String name, Connection connection) throws Exception {
return createConnectionInfoBean(name, connection, true);
}
/**
* 创建数据连接bean
*/
public static ConnectionInfoBean createConnectionInfoBean(Connection connection) throws Exception {
return createConnectionInfoBean(connection.getConnectionName(), connection, true);
}
/**
* jdbc的特殊处理
*/
private static JDBCConnectionBean convertToJDBCConnectionBean(Connection connection, boolean withPassword) {
JDBCDatabaseConnection jdbcConnection = (JDBCDatabaseConnection) connection;
JDBCConnectionBean jdbcConnectionBean = new JDBCConnectionBean();
DBCPConnectionPoolAttr poolAttr = new DBCPConnectionPoolAttr();
try {
poolAttr = (DBCPConnectionPoolAttr) jdbcConnection.getDbcpAttr().clone();
} catch (CloneNotSupportedException ignore) {
}
poolAttr.setValidationQuery(TransmissionTool.encrypt(poolAttr.getValidationQuery()));
KerberosAuthentication kerberosAuthentication = null;
if (jdbcConnection.getAuthentication().type() == AuthenticationType.KERBEROS) {
//获取数据连接信息的时候,做一下兼容处理(兼容旧的kerberos形式)
KerberosUtils.compatibilityProcess(((KerberosAuthentication) jdbcConnection.getAuthentication()));
kerberosAuthentication = ((KerberosAuthentication) jdbcConnection.getAuthentication());
}
//因为设计器创建连接时database属性为空,所以这里直接取数据库保存的fetchSize值,默认值为-1
return jdbcConnectionBean
.newCharsetName(jdbcConnection.getNewCharsetName())
.originalCharsetName(jdbcConnection.getOriginalCharsetName())
.database(jdbcConnection.getDatabase())
.user(jdbcConnection.getUser())
.driver(jdbcConnection.getDriver())
// 关键中的关键,由设计器发出的请求如果要携带密码,不能传明文,必须必须必须传加密后的密码
.password(withPassword ? TransmissionEncryptors.getInstance().encrypt(jdbcConnection.getPassword()) : DecisionServiceConstants.DEFAULT_PASSWORD)
.schema(jdbcConnection.getSchema())
.url(jdbcConnection.getURL())
.creator(jdbcConnection.getCreator())
.source(jdbcConnection.getDriverSource())
.connectionPoolAttr(poolAttr.create())
.authType(kerberosAuthentication != null ? "kerberos" : StringUtils.EMPTY)
.principal(kerberosAuthentication != null ? kerberosAuthentication.getPrincipal() : StringUtils.EMPTY)
.keyPath(kerberosAuthentication != null ? kerberosAuthentication.getKeyPath() : StringUtils.EMPTY)
.krb5Path(kerberosAuthentication != null ? KerberosUtils.getKrb5Path(kerberosAuthentication.getKeyPath(), kerberosAuthentication.getPrincipal()) : StringUtils.EMPTY)
.useJaas(jdbcConnection.getAuthentication().type() == AuthenticationType.KERBEROS && ((KerberosAuthentication) jdbcConnection.getAuthentication()).getUseJaas())
.fetchSize(jdbcConnection.getFetchSize()).identity(connection.getIdentity())
.sshType(jdbcConnection.getSsh().getSshType().toString())
.sshIp(((BaseSsh) jdbcConnection.getSsh()).getIp())
.usingSsh(jdbcConnection.getSsh().isUsingSsh())
.sshUser(((BaseSsh) jdbcConnection.getSsh()).getUser())
.sshPort(((BaseSsh) jdbcConnection.getSsh()).getPort())
.redirectPort(jdbcConnection.getSsh().getRedirectPort())
.redirectIp((jdbcConnection.getSsh()).getRedirectIp())
.sshTimeOut(((BaseSsh) jdbcConnection.getSsh()).getTimeOut())
.sshSecret(withPassword ? ((BaseSsh) jdbcConnection.getSsh()).getSecret() : DecisionServiceConstants.DEFAULT_PASSWORD)
.sshPrivateKeyPath(jdbcConnection.getSsh().getSshType() == SshType.KEY ? ((KeyVerifySsh) jdbcConnection.getSsh()).getPrivateKeyPath() : StringUtils.EMPTY)
.usingSsl((jdbcConnection.getSsl()).isUsingSsl())
.sslType(jdbcConnection.getSsl().getSslType().toString())
.sslClientCertificate(((BaseSsl) jdbcConnection.getSsl()).getClientCertificate())
.sslClientPrivateKey(((BaseSsl) jdbcConnection.getSsl()).getClientPrivateKey())
.caCertificate(((BaseSsl) jdbcConnection.getSsl()).getCaCertificate())
.properties(jdbcConnection.getProperties())
.verifyCa(jdbcConnection.getSsl().getSslType() == SslType.NORMAL && ((NormalSsl) jdbcConnection.getSsl()).isVerifyCa());
}
}

2
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -590,7 +590,7 @@ public class PreviewTablePane extends BasicPane {
private void testDBTableDataConnection(TableData tableData) throws Exception {
if (tableData instanceof DBTableData) {
try {
ConnectionRepository.getInstance().testConnection(new ConnectionBean(((DBTableData) tableData).getDatabase()));
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(tableData.getName(), ((DBTableData) tableData).getDatabase()));
} catch (Exception e) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), e);
}

10
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java

@ -6,6 +6,7 @@ import com.fr.data.impl.NameDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
@ -14,6 +15,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.Icon;
import javax.swing.JFrame;
@ -192,10 +194,10 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
if (tableData instanceof StoreProcedure) {
try {
connectionBar.start();
boolean success = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection());
if (!success) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
} finally {
connectionBar.close();
}

8
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -6,6 +6,7 @@ import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
@ -14,6 +15,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.Icon;
import javax.swing.JFrame;
@ -178,8 +180,10 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
loadingBar.close();
PreviewTablePane.resetPreviewTable();
connectionBar.start();
boolean status = DataOperator.getInstance().testConnection(((StoreProcedure) getTableData()).getDatabaseConnection());
if (!status) {
try {
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(((StoreProcedure) getTableData()).getDatabaseConnection()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
connectionBar.close();
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}

3
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -10,6 +10,7 @@ import com.fr.data.impl.Connection;
import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.mainframe.dnd.SerializableTransferable;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
@ -103,7 +104,7 @@ public class TableViewList extends UIList {
//总共给3次连接的机会
while (!status && count > 0) {
try {
ConnectionRepository.getInstance().testConnection(new ConnectionBean(datasource));
ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(databaseName, datasource));
status = true;
break;
} catch (Exception e) {

4
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -572,8 +572,8 @@ public abstract class ToolBarMenuDock {
if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction());
}
shortCuts.add(new EnvDetectorAction());
/// fbp本地和远程都暂时不使用环境监测
//shortCuts.add(new EnvDetectorAction());
//服务平台(仅针对中国大陆)
if (GeneralContext.getLocale().equals(Locale.CHINA)) {
shortCuts.add(new ServicePlatformAction());

12
designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java

@ -1,5 +1,6 @@
package com.fr.startup.ui;
import com.fr.base.extension.FileExtension;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
@ -19,7 +20,8 @@ import java.util.stream.Collectors;
* created by Harrison on 2022/07/06
**/
public class StartupPageModel {
private static final String FRM = "frm";
private static final String FORM = "form";
private StartupWorkspaceBean selectWorkspaceInfo;
private List<StartupWorkspaceBean> workspaceInfos = new ArrayList<>();
@ -57,7 +59,13 @@ public class StartupPageModel {
for (StartupWorkspaceBean info : infos) {
String name = info.getName();
List<String> recentFiles = envManager.getRecentOpenedFilePathList4Env(name);
recentFileMap.put(name, recentFiles);
List<String> checkFiles = new ArrayList<>();
for (String s : recentFiles) {
if (!s.endsWith(FRM) && !s.endsWith(FORM)) {
checkFiles.add(s);
}
}
recentFileMap.put(name, checkFiles);
}
return new StartupPageModel(infos, recentFileMap);
}

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

@ -402,7 +402,8 @@ public class DesignEnvComponent {
}
private void startEnvPrepare() {
EnvDetectorCenter.getInstance().init();
/// 环境检测、资源升级都暂不支持
//EnvDetectorCenter.getInstance().init();
if (WorkContext.getCurrent().isLocal()) {
// 如果是切回本地,要初始化成本地仓库
// 如果是切回远程,会在用户创建的时候就同步初始化远程仓库

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

@ -56,6 +56,6 @@ public class DesignAppComponent {
*/
@Supplemental
public void prepare() {
Carina.getApplicationContext().group(AppGroup.class).addAll(new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp());
Carina.getApplicationContext().group(AppGroup.class).addAll(new CptApp(), new CptxApp(), new XlsApp(), new XlsxApp());
}
}

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

@ -45,6 +45,7 @@ import com.fr.locale.InterMutableKey;
import com.fr.locale.LocaleMarker;
import com.fr.locale.LocaleScope;
import com.fr.locale.LocaleUtils;
import com.fr.locale.international.InternationalLocaleManager;
import com.fr.log.FineLoggerFactory;
import com.fr.measure.DBMeterFactory;
import com.fr.record.DefaultDBMeter;
@ -146,6 +147,7 @@ public class DesignPreLoadComponent {
}
FrontProviderImpl.init(InterProviderImpl.getInstance());
InternationalLocaleManager.getInstance().init();
}

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

@ -1,5 +1,10 @@
package com.fanruan.boot.pre;
import com.fanruan.boot.FSProperties;
import com.fanruan.fs.FileServer;
import com.fanruan.fs.RepositoryFactory;
import com.fanruan.fs.repository.local.LocalFileRepository;
import com.fanruan.product.ProductConstants;
import com.fr.design.ConfigHelper;
import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina;
@ -31,11 +36,17 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.CommonIOUtils;
import com.fr.general.GeneralUtils;
import com.fr.io.base.ResourcePaths;
import com.fr.io.repository.ResourceRepository;
import com.fr.io.repository.ResourceRepositoryWrapper;
import com.fr.io.utils.ResourceIOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.module.engine.event.LifecycleErrorEvent;
import com.fr.runtime.FineRuntime;
import com.fr.stable.CommonCodeUtils;
import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.resource.ResourceLoader;
@ -56,6 +67,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
@ -72,6 +84,9 @@ public class DesignPreStartComponent {
private static final String SEPARATOR = "/";
private static final String CPT = ".cpt";
private static final String XML = ".xml";
private static final String PRE_FILE_ROOT = ProductConstants.getEnvHome() + File.separator + "prefile";
private static final String PRE_FILE = PRE_FILE_ROOT + File.separator + "check";
/**
* 启动
@ -84,10 +99,38 @@ public class DesignPreStartComponent {
startTenant();
// 3.pluginPrepare,注册插件的反向依赖
startPluginPrepare();
// 4.正式启动
startPre();
// 5.mq
// 4.mq
startMq();
// 5.基础fs
startBasicFs();
// 6.正式启动
startPre();
}
private void startBasicFs() throws Exception {
// 启动的时候无关环境信息的写缓存里
checkFile(PRE_FILE);
LocalFileRepository.getSingleton().setWorkRoot(PRE_FILE_ROOT);
ResourceRepository realRepo = RepositoryFactory.getRepo();
FSProperties fsProperties = Carina.properties(FSProperties.class);
FileServer.init(
new ResourceRepositoryWrapper(LocalFileRepository.getSingleton(), StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo.generateTenantsSharedRepo(fsProperties.getTenantsSharedNamespace()), StringUtils.EMPTY));
ResourceIOUtils.setUnderlying(FileServer.local());
ResourceIOUtils.setIsolationMode(false);
ResourcePaths.register(ProjectConstants.ASSETS_NAME, true);
ResourcePaths.register(ProjectConstants.SCHEDULE_NAME, false);
}
private void checkFile(String path) {
File file = new File(path);
if (!file.exists()) {
ConfigHelper.createFile(file);
}
}
private void startMq() throws Exception {

Loading…
Cancel
Save