diff --git a/designer-base/src/main/java/com/fr/design/ConfigHelper.java b/designer-base/src/main/java/com/fr/design/ConfigHelper.java index 31724d8652..c5fd1668d0 100644 --- a/designer-base/src/main/java/com/fr/design/ConfigHelper.java +++ b/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); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index 8ab88bbf99..47b1d4d247 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/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 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(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 94debc6c5b..974f8b0d7b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/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 removedConnNames = new ArrayList<>(); List addConnections = new ArrayList<>(); List updateConnection = new ArrayList<>(); + List 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 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 addedOrUpdatedConnections) throws Exception { + public void validateDatabaseType(@NotNull List addedOrUpdatedConnections) throws Exception { Set 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 connectionMap = ConnectionConfigProviderFactory.getConfigProvider().getConnections(); + List beans = ConnectionRepository.getInstance().getAll(); + Map 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 } } } + } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0a00f37041..be7ea004a1 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/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 0) { try { - ConnectionRepository.getInstance().testConnection(new ConnectionBean(datasource)); + ConnectionRepository.getInstance().testConnection(ConnectionInfoBeanHelper.createConnectionInfoBean(databaseName, datasource)); status = true; break; } catch (Exception e) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 54cc4cc4d3..99579aae3d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/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()); diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java index a461ee33b5..62b20d50d0 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageModel.java +++ b/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 workspaceInfos = new ArrayList<>(); @@ -57,7 +59,13 @@ public class StartupPageModel { for (StartupWorkspaceBean info : infos) { String name = info.getName(); List recentFiles = envManager.getRecentOpenedFilePathList4Env(name); - recentFileMap.put(name, recentFiles); + List 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); } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 700fc12258..9e482c00ca 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -402,7 +402,8 @@ public class DesignEnvComponent { } private void startEnvPrepare() { - EnvDetectorCenter.getInstance().init(); + /// 环境检测、资源升级都暂不支持 + //EnvDetectorCenter.getInstance().init(); if (WorkContext.getCurrent().isLocal()) { // 如果是切回本地,要初始化成本地仓库 // 如果是切回远程,会在用户创建的时候就同步初始化远程仓库 diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java index e2f59dba9c..55ceb2de9d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java @@ -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()); } } diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java index 736aa35096..4fd91d49a4 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java +++ b/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(); } diff --git a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java b/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java index 21bca14bd0..b3363f6d3d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java +++ b/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 {