Browse Source

Pull request #14230: 无jira任务, mss/2.0 合 fbp-1.0

Merge in DESIGN/design from mss/2.0 to fbp-1.0

* commit 'bc0fd2632ce5fcde2215e611a24984bbb9067b16':
  REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 补充数据集的bean的属性
  REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 完善数据集与数据连接
  REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 预留token接口+完善报错
  REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 完善部分代码+屏蔽frm入口
  REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 适配数据连接+地图配置
  REPORT-114391 【微服务适配】远程&本地设计器能够正常启动
  REPORT-114391 【微服务适配】远程&本地设计器能够正常启动
  KERNEL-18926 修改包名
fbp-1.0
superman 4 months ago committed by Yvan-欧阳帆
parent
commit
48b2497573
  1. 15
      build.gradle
  2. 4
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  3. 8
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  4. 15
      designer-base/src/main/java/com/fr/design/backup/DesignContext.java
  5. 5
      designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java
  6. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  7. 83
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  9. 67
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  10. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  11. 1
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  12. 15
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  13. 17
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  14. 35
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  15. 3
      designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java
  16. 5
      designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java
  17. 19
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  18. 4
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java
  19. 3
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java

15
build.gradle

@ -79,17 +79,28 @@ allprojects {
// //
implementation 'com.fr.cbb:fine-cbb-common:' + cbbVersion implementation 'com.fr.cbb:fine-cbb-common:' + cbbVersion
implementation 'com.fr.auth:fine-auth-webui:' + apiVersion implementation 'com.fr.auth:fine-auth-webui:' + apiVersion
//
implementation 'com.fr.portal:fine-portal:' + apiVersion
implementation 'com.fr.portal:fine-portal-api:' + apiVersion implementation 'com.fr.portal:fine-portal-api:' + apiVersion
// cbb
implementation 'com.fr.essential:fine-essential:' + cbbVersion implementation 'com.fr.essential:fine-essential:' + cbbVersion
implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion
// plugin
implementation 'com.fr.plugin:fine-plugin-api:' + apiVersion implementation 'com.fr.plugin:fine-plugin-api:' + apiVersion
implementation 'com.fr.plugin:fine-plugin:' + apiVersion implementation 'com.fr.plugin:fine-plugin:' + apiVersion
//
implementation 'com.fr.workplace:workplace:' + 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
// auth
implementation 'com.fr.auth:fine-auth:' + apiVersion
implementation 'com.fr.auth:fine-auth-api:' + apiVersion implementation 'com.fr.auth:fine-auth-api:' + apiVersion
// lic
implementation 'com.fr.license:fine-license-api:' + apiVersion implementation 'com.fr.license:fine-license-api:' + apiVersion
implementation 'com.fr.workplace:workplace:' + apiVersion // cluster
implementation 'com.fr.cluster:fine-cluster-api:' + apiVersion implementation 'com.fr.cluster:fine-cluster-api:' + apiVersion
// messenger
implementation 'com.fr.messenger:fine-messenger:' + carinaVersion implementation 'com.fr.messenger:fine-messenger:' + carinaVersion
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'
@ -107,7 +118,7 @@ allprojects {
implementation 'com.fr.activator:fine-activator:' + frVersion implementation 'com.fr.activator:fine-activator:' + frVersion
implementation 'com.fr.datasource:fine-datasource-api:' + fdlVersion implementation 'com.fr.datasource:fine-datasource-api:' + fdlVersion
implementation 'com.fr.datasource:fine-datasource-core:' + fdlVersion implementation 'com.fr.datasource:fine-datasource-core:' + fdlVersion
implementation 'com.fr.datasource:fine-datasource-dec:' + fdlVersion implementation 'com.fr.datasource:fine-datasource-web:' + fdlVersion
implementation 'com.fr.decision:decision-i18n:' + frVersion implementation 'com.fr.decision:decision-i18n:' + frVersion
implementation 'com.fr.report:engine-report:' + frDevVersion implementation 'com.fr.report:engine-report:' + frDevVersion
implementation 'com.fr.report:engine-x:' + frDevVersion implementation 'com.fr.report:engine-x:' + frDevVersion

4
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -1,5 +1,6 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fanruan.workplace.http.HttpConstants;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -158,7 +159,8 @@ public final class WebPreviewUtils {
DesignUtils.visitEnvServerByParameters( DesignUtils.visitEnvServerByParameters(
baseRoute, baseRoute,
parameterNameList.toArray(new String[0]), parameterNameList.toArray(new String[0]),
parameterValueList.toArray(new String[0]) parameterValueList.toArray(new String[0]),
HttpConstants.FR
); );
} else { } else {
int selVal = showConfirmDialog( int selVal = showConfirmDialog(

8
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -22,6 +22,8 @@ import com.fr.esd.event.DsNameTarget;
import com.fr.esd.event.StrategyEventsNotifier; import com.fr.esd.event.StrategyEventsNotifier;
import com.fr.report.LockItem; import com.fr.report.LockItem;
import com.fr.workspace.server.entity.tabledata.TableDataBean;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.awt.Dimension; import java.awt.Dimension;
@ -75,7 +77,11 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
} }
// 锁定成功,执行后续操作 // 锁定成功,执行后续操作
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final Map<String, TableData> tableDataMap = TableDataConfigProviderFactory.getInstance().getTableDatas(); final TableDataBean[] beans = TableDataRepository.getInstance().getAllTableData();
final Map<String, TableData> tableDataMap = new HashMap<>();
for (TableDataBean bean : beans) {
tableDataMap.put(bean.getName() , bean.getTableData());
}
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {
public void complete() { public void complete() {
populate(tableDataMap); populate(tableDataMap);

15
designer-base/src/main/java/com/fr/design/backup/DesignContext.java

@ -2,8 +2,8 @@ package com.fr.design.backup;
import com.fanruan.carina.context.CarinaApplicationContext; import com.fanruan.carina.context.CarinaApplicationContext;
import com.fanruan.carina.standard.PartitionManager; import com.fanruan.carina.standard.PartitionManager;
import com.fanruan.carina.standard.PartitionManagerImpl; import com.fr.log.FineLoggerFactory;
import com.fr.start.server.EmptyServletContext; import com.fr.stable.StringUtils;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
@ -17,7 +17,9 @@ import java.util.Properties;
* Created on 2024/5/14 * Created on 2024/5/14
*/ */
public class DesignContext extends CarinaApplicationContext { public class DesignContext extends CarinaApplicationContext {
public static final String WEB_INF = "\\WEB-INF";
private String designWebInfPath; private String designWebInfPath;
private String designDataPath;
public DesignContext(ServletContext servletContext, PartitionManager manager, Properties carinaApplicationProperties) { public DesignContext(ServletContext servletContext, PartitionManager manager, Properties carinaApplicationProperties) {
@ -36,5 +38,14 @@ public class DesignContext extends CarinaApplicationContext {
public void setDesignWebInfPath(String designWebInfPath) { public void setDesignWebInfPath(String designWebInfPath) {
this.designWebInfPath = designWebInfPath; this.designWebInfPath = designWebInfPath;
if (StringUtils.isNotEmpty(this.designWebInfPath)) {
this.designDataPath = this.designWebInfPath.replace(WEB_INF, StringUtils.EMPTY);
}
FineLoggerFactory.getLogger().info("[DesignContext] designWebInfPath:{}, designDataPath:{}", this.designWebInfPath, this.designDataPath);
}
@Override
public String getDataPath() {
return designDataPath;
} }
} }

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

@ -5,6 +5,7 @@ import com.fanruan.config.realm.ConfigRepositoryFactory;
import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder;
import com.fr.design.ConfigHelper; import com.fr.design.ConfigHelper;
import com.fr.design.mem.MemConfigBackupManager; import com.fr.design.mem.MemConfigBackupManager;
import com.fr.design.mem.MemConfigRepositoryBuilder;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -71,6 +72,10 @@ public class EnvBackupHelper {
} else { } else {
// 如果是切到远程,先暂时用备份的内存配置,成功后再转到新配置,失败则切回原内存配置 // 如果是切到远程,先暂时用备份的内存配置,成功后再转到新配置,失败则切回原内存配置
MemConfigBackupManager.getInstance().startSwitch(); MemConfigBackupManager.getInstance().startSwitch();
if (local) {
// 原来不是远程,需要先切一下内存配置框架
ConfigRepositoryFactory.getInstance().registerConfigRepositoryBuilder(new MemConfigRepositoryBuilder());
}
} }
} }

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

@ -13,8 +13,8 @@ import com.fr.design.gui.ibutton.UILockButton;
import com.fr.report.LockItem; import com.fr.report.LockItem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Dimension; import java.awt.Dimension;
@ -80,7 +80,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 刷新ComboBox.items * 刷新ComboBox.items
*/ */
protected Iterator<String> items() { protected Iterator<String> items() {
Iterator<String> nameIt = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet().iterator(); Iterator<String> nameIt = ConnectionRepository.getInstance().getConnNames().iterator();
Collection<String> noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections(); Collection<String> noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections();
@ -94,7 +94,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
if (noAuthConnections.contains(conName)) { if (noAuthConnections.contains(conName)) {
continue; continue;
} }
Connection connection = ConnectionConfigProviderFactory.getConfigProvider().getConnection(conName); Connection connection = ConnectionRepository.getInstance().getByName(conName).getConnection();
// nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法 // nameList依赖items方法初始化,父类ItemEditableComboBoxPanel里异步执行item方法
filterConnection(connection, conName, nameList); filterConnection(connection, conName, nameList);
} }

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

@ -3,12 +3,11 @@ package com.fr.design.data.datapane.connect;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory; import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.ConnectionConfigWriterFactory; import com.fanruan.config.impl.data.ConnectionConfigWriterFactory;
import com.fr.config.remote.RemoteConfigEvent; import com.fr.config.remote.RemoteConfigEvent;
import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.data.metric.utils.DatabaseConnectionMetricHandler; import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean;
import com.fr.data.operator.DataOperator; import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.MapCompareUtils; import com.fr.design.data.MapCompareUtils;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -219,27 +218,25 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
Arrays.stream(res).map(n -> (NameObject) n).forEach(no -> updatedMap.put(no.getName(), (Connection) no.getObject())); Arrays.stream(res).map(n -> (NameObject) n).forEach(no -> updatedMap.put(no.getName(), (Connection) no.getObject()));
List<String> removedConnNames = new ArrayList<>(); List<String> removedConnNames = new ArrayList<>();
List<ConnectionBean> addConnections = new ArrayList<>(); List<ConnectionInfoBean> addConnections = new ArrayList<>();
List<ConnectionBean> updateConnection = new ArrayList<>(); List<ConnectionInfoBean> updateConnection = new ArrayList<>();
MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> { MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> {
switch (entryEventKind) { try {
case REMOVED: switch (entryEventKind) {
removedConnNames.add(s); case REMOVED:
break; removedConnNames.add(s);
case ADDED: break;
addConnections.add(new ConnectionBean(connection, s)); case ADDED:
if (connection instanceof JDBCDatabaseConnection) { addConnections.add(ConnectionProcessorFactory.createConnectionInfoBean(s, connection));
DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); break;
} case UPDATED:
break; updateConnection.add(ConnectionProcessorFactory.createConnectionInfoBean(s, connection));
case UPDATED: break;
updateConnection.add(new ConnectionBean(connection, s)); default:
if (connection instanceof JDBCDatabaseConnection) { break;
DatabaseConnectionMetricHandler.handleSaveConnection((JDBCDatabaseConnection) connection, null); }
} } catch (Exception e) {
break; FineLoggerFactory.getLogger().error(e.getMessage(), e);
default:
break;
} }
}, new MapCompareUtils.UpdateRule<String, Connection>() { }, new MapCompareUtils.UpdateRule<String, Connection>() {
@Override @Override
@ -269,23 +266,22 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
} }
}); });
List<ConnectionBean> validateBeans = new ArrayList<>(); List<ConnectionInfoBean> validateBeans = new ArrayList<>();
validateBeans.addAll(addConnections); validateBeans.addAll(addConnections);
validateBeans.addAll(updateConnection); validateBeans.addAll(updateConnection);
this.validateDatabaseType(validateBeans); this.validateDatabaseType(validateBeans);
this.validateConnections(validateBeans); this.alterConnections(addConnections, removedConnNames, updateConnection);
this.alterConnections(new BatchConnectionModifyBean(addConnections, removedConnNames, updateConnection));
} }
/** /**
* 校验是否支持所有新增和修改数据连接的数据库类型 * 校验是否支持所有新增和修改数据连接的数据库类型
*/ */
public void validateDatabaseType(@NotNull List<ConnectionBean> addedOrUpdatedConnections) { public void validateDatabaseType(@NotNull List<ConnectionInfoBean> addedOrUpdatedConnections) throws Exception {
Set<String> notSupportedConnections = new HashSet<>(); Set<String> notSupportedConnections = new HashSet<>();
if (!addedOrUpdatedConnections.isEmpty()) { if (!addedOrUpdatedConnections.isEmpty()) {
for (ConnectionBean bean : addedOrUpdatedConnections) { for (ConnectionInfoBean bean : addedOrUpdatedConnections) {
Connection connection = bean.getConnection(); Connection connection = ConnectionProcessorFactory.createConnection(bean);
// 仅校验jdbc连接,其他插件数据连接不进行校验 // 仅校验jdbc连接,其他插件数据连接不进行校验;
if (connection instanceof JDBCDatabaseConnection) { if (connection instanceof JDBCDatabaseConnection) {
DBTypes dataBaseTypePoint = DataBaseTypePointManager.getInstance().getDataBaseTypePoint(connection.getDriver(), connection.feature()); DBTypes dataBaseTypePoint = DataBaseTypePointManager.getInstance().getDataBaseTypePoint(connection.getDriver(), connection.feature());
if (connectionIsNotSupported(connection, dataBaseTypePoint)) { if (connectionIsNotSupported(connection, dataBaseTypePoint)) {
@ -322,25 +318,18 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
} }
private void validateConnections(List<ConnectionBean> addedOrUpdatedConnections) throws Exception { private void alterConnections(List<ConnectionInfoBean> addConnections, List<String> removedConnNames, List<ConnectionInfoBean> updateConnection) {
for (ConnectionBean connectionBean : addedOrUpdatedConnections) {
Connection connection = connectionBean.getConnection();
try {
ConnectionRepository.getInstance().validSettings(new com.fr.workspace.server.entity.connection.ConnectionBean(connection));
} catch (DriverClassNotFoundException e) {
FineLoggerFactory.getLogger().info(e.getMessage());
} catch (Exception e) {
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause());
}
}
}
private void alterConnections(BatchConnectionModifyBean bean) {
try { try {
ConnectionRepository.getInstance().save(bean); for (ConnectionInfoBean bean : addConnections) {
ConnectionRepository.getInstance().add(bean);
}
for (ConnectionInfoBean bean : updateConnection) {
ConnectionRepository.getInstance().update(bean);
}
for (String name : removedConnNames) {
ConnectionRepository.getInstance().delete(new ConnectionInfoBean(name));
}
// hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig");

4
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -451,8 +451,8 @@ public class JDBCDefPane extends JPanel {
jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim());
jdbcDatabase.setOriginalCharsetName(this.originalCharSet); jdbcDatabase.setOriginalCharsetName(this.originalCharSet);
if (this.charSetComboBox.getSelectedIndex() == 0) { if (this.charSetComboBox.getSelectedIndex() == 0) {
jdbcDatabase.setNewCharsetName(null); jdbcDatabase.setNewCharsetName(StringUtils.EMPTY);
jdbcDatabase.setOriginalCharsetName(null); jdbcDatabase.setOriginalCharsetName(StringUtils.EMPTY);
} else { } else {
jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK); jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK);
jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem()));

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

@ -0,0 +1,67 @@
package com.fr.design.data.datapane.connect;
import com.fr.data.driver.DriverClassNotFoundException;
import com.fr.data.impl.Connection;
import com.fr.decision.webservice.bean.datasource.ConnectionInfoBean;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.server.repository.connection.BaseConnectionSource;
import java.sql.SQLException;
/**
* 本地Connection资源操作
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/5/29
*/
public class LocalConnectionSource extends BaseConnectionSource {
@Override
public void add(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.addConnection(bean);
}
@Override
public void delete(ConnectionInfoBean bean) throws Exception {
ConnectionProcessorFactory.deleteConnection(bean.getConnectionName());
}
@Override
public void update(ConnectionInfoBean bean) throws Exception {
Connection connection = ConnectionProcessorFactory.createConnection(bean);
validate(bean.getConnectionName(), connection);
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean);
}
@Override
public boolean lock(String str) {
// 本地默认锁定成功,让其执行后续动作
return true;
}
@Override
public boolean unlock(String str) {
// 本地默认解锁成功
return true;
}
@Override
public boolean isLock(String str) {
// 本地默认未锁定
return false;
}
private void validate(String name, Connection connection) throws SQLException {
try {
connection.validateSettings();
} catch (DriverClassNotFoundException e) {
FineLoggerFactory.getLogger().info(e.getMessage());
} catch (Exception e) {
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", name) + ", " + e.getMessage(), e.getCause());
}
}
}

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -295,8 +295,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
private void refreshParameters() { private void refreshParameters() {
String[] paramTexts = new String[2]; String[] paramTexts = new String[2];
paramTexts[0] = SqlUtils.tryPureSqlText(this.sqlTextPane.getText()); paramTexts[0] = SqlUtils.clearSqlComments(this.sqlTextPane.getText());
paramTexts[1] = SqlUtils.tryPureSqlText(this.pageQuery); paramTexts[1] = SqlUtils.clearSqlComments(this.pageQuery);
List<ParameterProvider> existParameterList = this.editorPane.update(); List<ParameterProvider> existParameterList = this.editorPane.update();
Parameter[] ps = (existParameterList == null) ? new Parameter[0] : existParameterList.toArray(new Parameter[0]); Parameter[] ps = (existParameterList == null) ? new Parameter[0] : existParameterList.toArray(new Parameter[0]);

1
designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java vendored

@ -74,6 +74,7 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
bean.setUsername(connectionInfo.getUserName()); bean.setUsername(connectionInfo.getUserName());
bean.setPassword(connectionInfo.getPassword()); bean.setPassword(connectionInfo.getPassword());
bean.setEncrypted(false); bean.setEncrypted(false);
bean.setValidity(-2);
return bean; return bean;
} }
} }

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

@ -15,6 +15,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
@ -95,13 +97,18 @@ public class TableViewList extends UIList {
@Override @Override
protected DefaultListModel doInBackground() throws Exception { protected DefaultListModel doInBackground() throws Exception {
Connection datasource = ConnectionConfigProviderFactory.getConfigProvider().getConnection(databaseName); Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection();
boolean status = false; boolean status = false;
int count = 3; int count = 3;
//总共给3次连接的机会 //总共给3次连接的机会
while (!status && count > 0) { while (!status && count > 0) {
status = DataOperator.getInstance().testConnection(datasource); try {
count--; ConnectionRepository.getInstance().testConnection(new ConnectionBean(datasource));
status = true;
break;
} catch (Exception e) {
count--;
}
} }
if (!status) { if (!status) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
@ -154,7 +161,7 @@ public class TableViewList extends UIList {
*/ */
private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception { private DefaultListModel processDataInAnotherThread(String databaseName, String searchFilter, String... typesFilter) throws Exception {
DefaultListModel defaultListModel = new DefaultListModel(); DefaultListModel defaultListModel = new DefaultListModel();
Connection datasource = ConnectionConfigProviderFactory.getConfigProvider().getConnection(databaseName); Connection datasource = ConnectionRepository.getInstance().getByName(databaseName).getConnection();
if (datasource == null) { if (datasource == null) {
return defaultListModel; return defaultListModel;
} }

17
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -405,6 +405,16 @@ public class DesignUtils {
* @param values 参数值 * @param values 参数值
*/ */
public static void visitEnvServerByParameters(String baseRoute, String[] names, String[] values) { public static void visitEnvServerByParameters(String baseRoute, String[] names, String[] values) {
visitEnvServerByParameters(baseRoute, names, values, HttpConstants.PUBLIC);
}
/**
* 访问服务器环境
*
* @param names 参数名字
* @param values 参数值
*/
public static void visitEnvServerByParameters(String baseRoute, String[] names, String[] values, String serverType) {
int len = Math.min(ArrayUtils.getLength(names), ArrayUtils.getLength(values)); int len = Math.min(ArrayUtils.getLength(names), ArrayUtils.getLength(values));
String[] nameValuePairs = new String[len]; String[] nameValuePairs = new String[len];
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
@ -417,10 +427,9 @@ public class DesignUtils {
"=" + CommonCodeUtils.encodeURIComponent(CommonCodeUtils.encodeURIComponent(value)); "=" + CommonCodeUtils.encodeURIComponent(CommonCodeUtils.encodeURIComponent(value));
} }
String postfixOfUri = (nameValuePairs.length > 0 ? "?" + StableUtils.join(nameValuePairs, "&") : StringUtils.EMPTY); String postfixOfUri = (nameValuePairs.length > 0 ? "?" + StableUtils.join(nameValuePairs, "&") : StringUtils.EMPTY);
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
String urlPath = getWebBrowserPath(); String urlPath = getWebBrowserPath(serverType);
Desktop.getDesktop().browse(new URI(urlPath + baseRoute + postfixOfUri)); Desktop.getDesktop().browse(new URI(urlPath + baseRoute + postfixOfUri));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("cannot open the url Successful", e); FineLoggerFactory.getLogger().error("cannot open the url Successful", e);
@ -437,8 +446,8 @@ public class DesignUtils {
} }
} }
private static String getWebBrowserPath() { private static String getWebBrowserPath(String serverPath) {
String urlPath = WorkContext.getCurrent().getPath() + HttpConstants.FR; String urlPath = WorkContext.getCurrent().getPath() + serverPath;
DesignerEnvProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); DesignerEnvProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG);
if (processor != null) { if (processor != null) {
//cas访问的时候, url要处理下. //cas访问的时候, url要处理下.

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

@ -113,23 +113,24 @@ public class VersionCheckUtils {
} }
public static void showVersionCheckDialog(String envName) { public static void showVersionCheckDialog(String envName) {
new SwingWorker<Boolean, Void>() { /// 环境检测类都先屏蔽
@Override // new SwingWorker<Boolean, Void>() {
protected Boolean doInBackground() { // @Override
return !VersionCheckUtils.versionCheck(envName); // protected Boolean doInBackground() {
} // return !VersionCheckUtils.versionCheck(envName);
// }
@Override //
protected void done() { // @Override
try { // protected void done() {
if (get()) { // try {
showNotificationDialog(envName); // if (get()) {
} // showNotificationDialog(envName);
} catch (Exception e) { // }
FineLoggerFactory.getLogger().warn(e.getMessage(), e); // } catch (Exception e) {
} // FineLoggerFactory.getLogger().warn(e.getMessage(), e);
} // }
}.execute(); // }
// }.execute();
} }
private static void showNotificationDialog(String envName) { private static void showNotificationDialog(String envName) {

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

@ -2,6 +2,7 @@ package com.fr.start.server;
import com.fanruan.carina.Carina; import com.fanruan.carina.Carina;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.workspace.WorkContext;
/** /**
* Created by juhaoyu on 2018/6/6. * Created by juhaoyu on 2018/6/6.
@ -38,7 +39,7 @@ public abstract class FineEmbedServer {
public static boolean isRunning() { public static boolean isRunning() {
return Carina.partition("fine_report") != null && Carina.partition("fine_report").getReady(); return (Carina.partition("fine_report") != null && Carina.partition("fine_report").getReady()) || !WorkContext.getCurrent().isLocal();
} }
public static boolean isOnStarting() { public static boolean isOnStarting() {

5
designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java

@ -1,10 +1,9 @@
package com.fr.van.chart.map.server; package com.fr.van.chart.map.server;
import com.fanruan.workplace.http.HttpConstants;
import com.fr.base.ServerConfig; import com.fr.base.ServerConfig;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.general.GeneralContext;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.start.server.DesignEmbedHelper; import com.fr.start.server.DesignEmbedHelper;
@ -26,7 +25,7 @@ public class ChartMapEditorAction extends UpdateAction {
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); int port = DesignerEnvManager.getEnvManager().getEmbedServerPort();
String web = DesignEmbedHelper.getAppFolderName(); String web = DesignEmbedHelper.getAppFolderName();
String serverlet = ServerConfig.getInstance().getServletName(); String serverlet = ServerConfig.getInstance().getServletName();
ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/map/edit", port, web, serverlet) : WorkContext.getCurrent().getPath() + "/map/edit"); ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/map/edit", port, web, serverlet) : WorkContext.getCurrent().getPath() + HttpConstants.PUBLIC + "/map/edit");
} }
} }

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

@ -26,6 +26,7 @@ import com.fanruan.kv.factory.KVStoreFactory;
import com.fanruan.kv.manager.CarinaKVManager; import com.fanruan.kv.manager.CarinaKVManager;
import com.fanruan.kv.store.KVStore; import com.fanruan.kv.store.KVStore;
import com.fanruan.kv.store.KVStoreHolder; import com.fanruan.kv.store.KVStoreHolder;
import com.fanruan.workplace.http.RepositoryManager;
import com.fr.cbb.dialect.security.InsecurityElementFactory; import com.fr.cbb.dialect.security.InsecurityElementFactory;
import com.fr.cluster.ClusterBridge; import com.fr.cluster.ClusterBridge;
import com.fr.cluster.lock.ClusterLock; import com.fr.cluster.lock.ClusterLock;
@ -48,11 +49,6 @@ import com.fr.config.holder.ValidateConfigManger;
import com.fr.config.impl.ConfConfigProviderImpl; import com.fr.config.impl.ConfConfigProviderImpl;
import com.fr.config.impl.ConfigInsecurityElementProviderImpl; import com.fr.config.impl.ConfigInsecurityElementProviderImpl;
import com.fr.decision.service.context.ServiceContext; 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.design.backup.EnvBackupHelper;
import com.fr.env.detect.EnvDetectorCenter; import com.fr.env.detect.EnvDetectorCenter;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -79,6 +75,7 @@ import com.fr.scheduler.QuartzContext;
import com.fr.scheduler.SchedulerEvent; import com.fr.scheduler.SchedulerEvent;
import com.fr.scheduler.tenant.ScheduleThreadCurrentTenantProvider; import com.fr.scheduler.tenant.ScheduleThreadCurrentTenantProvider;
import com.fr.security.encryption.EncryptionInitialization; import com.fr.security.encryption.EncryptionInitialization;
import com.fr.security.encryption.SystemEncryptionManager;
import com.fr.security.encryption.core.EncryptionScaffold; import com.fr.security.encryption.core.EncryptionScaffold;
import com.fr.security.encryption.provider.SecuritySeedProvider; import com.fr.security.encryption.provider.SecuritySeedProvider;
import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey; import com.fr.security.encryption.storage.keys.LoadSeedSecurityKey;
@ -273,11 +270,11 @@ public class DesignEnvComponent {
private void startFileServer() throws Exception { private void startFileServer() throws Exception {
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
// 设计器远程下不需要文件系统,走PublicRepo的接口,本地下走基础的磁盘读写 // 设计器远程下不需要文件系统,走PublicRepo的接口,本地下走基础的磁盘读写
LocalFileRepository localFileRepository = new LocalFileRepository(ProjectConstants.LOCAL_ENV, ServiceContext.getWebInfPath()); LocalFileRepository.getSingleton().setWorkRoot(ServiceContext.getWebInfPath());
ResourceRepository realRepo = RepositoryFactory.getRepo(); ResourceRepository realRepo = RepositoryFactory.getRepo();
FSProperties fsProperties = Carina.properties(FSProperties.class); FSProperties fsProperties = Carina.properties(FSProperties.class);
FileServer.init( FileServer.init(
new ResourceRepositoryWrapper(localFileRepository, StringUtils.EMPTY), new ResourceRepositoryWrapper(LocalFileRepository.getSingleton(), StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY), new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY), new ResourceRepositoryWrapper(realRepo, StringUtils.EMPTY),
new ResourceRepositoryWrapper(realRepo.generateTenantsSharedRepo(fsProperties.getTenantsSharedNamespace()), StringUtils.EMPTY)); new ResourceRepositoryWrapper(realRepo.generateTenantsSharedRepo(fsProperties.getTenantsSharedNamespace()), StringUtils.EMPTY));
@ -383,6 +380,9 @@ public class DesignEnvComponent {
} }
}); });
LoadSeedSecurityKey.getInstance().init(); LoadSeedSecurityKey.getInstance().init();
} else {
// 远程也先写死加解密,放在内存中就好,fbp那边暂时没有提供扩展,两边都是写死的,等他们提供扩展后设计器再适配
SystemEncryptionManager.getInstance().restore();
} }
} }
@ -403,5 +403,10 @@ public class DesignEnvComponent {
private void startEnvPrepare() { private void startEnvPrepare() {
EnvDetectorCenter.getInstance().init(); EnvDetectorCenter.getInstance().init();
if (WorkContext.getCurrent().isLocal()) {
// 如果是切回本地,要初始化成本地仓库
// 如果是切回远程,会在用户创建的时候就同步初始化远程仓库
RepositoryManager.getInstance().initLocalRepository();
}
} }
} }

4
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java vendored

@ -455,8 +455,8 @@ public class DesignComponent {
private static void formDesignerRegister() { private static void formDesignerRegister() {
StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance()); StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance());
/// REPORT-127453 屏蔽frm入口
DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); // DesignModuleFactory.registerNewFormActionClass(NewFormAction.class);
DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class); DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class);
DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class);
DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class);

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

@ -15,7 +15,9 @@ import com.fr.decision.webservice.v10.datasource.connection.processor.impl.Conne
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor; 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.JDYConnectionProcessor;
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor; import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JNDIConnectionProcessor;
import com.fr.design.data.datapane.connect.LocalConnectionSource;
import com.fr.workspace.server.repository.connection.ConnectionWriterShell; import com.fr.workspace.server.repository.connection.ConnectionWriterShell;
import com.fr.workspace.server.repository.connection.LocalConnectionShell;
/** /**
@ -40,6 +42,7 @@ public class DesignDatasourceComponent extends DatasourceComponent {
ConnectionProcessorFactory.register(JNDIConnectionProcessor.KEY); ConnectionProcessorFactory.register(JNDIConnectionProcessor.KEY);
ConnectionProcessorFactory.register(ConnectionPluginProcessor.KEY); ConnectionProcessorFactory.register(ConnectionPluginProcessor.KEY);
ConnectionProcessorFactory.register(JDYConnectionProcessor.KEY); ConnectionProcessorFactory.register(JDYConnectionProcessor.KEY);
Carina.getApplicationContext().singleton(LocalConnectionShell.class).set(new LocalConnectionSource());
} }
/** /**

Loading…
Cancel
Save