Browse Source

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

fbp-1.0
Destiny.Lin 5 months ago
parent
commit
95b8dd4632
  1. 7
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  2. 9
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  3. 29
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  4. 3
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  5. 4
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  6. 2
      designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java

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

@ -195,10 +195,11 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
public void populate(Map<String, Connection> connectionMap) {
List<NameObject> nameObjectList = new ArrayList<NameObject>();
populatedConnectionsSnapshot.clear();
for (Map.Entry<String, Connection> entry : ConnectionConfigProviderFactory.getConfigProvider().getConnections().entrySet()) {
nameObjectList.add(new NameObject(entry.getKey(), entry.getValue()));
List<com.fr.workspace.server.entity.connection.ConnectionBean> beans = ConnectionRepository.getInstance().getAll();
for (com.fr.workspace.server.entity.connection.ConnectionBean entry : beans) {
nameObjectList.add(new NameObject(entry.getName(), entry.getConnection()));
try {
populatedConnectionsSnapshot.put(entry.getKey(), (Connection) entry.getValue().clone());
populatedConnectionsSnapshot.put(entry.getName(), (Connection) entry.getConnection().clone());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

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

@ -38,6 +38,8 @@ import com.fr.function.TIME;
import com.fr.general.FRFont;
import com.fr.general.data.DataModel;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -587,9 +589,10 @@ public class PreviewTablePane extends BasicPane {
*/
private void testDBTableDataConnection(TableData tableData) throws Exception {
if (tableData instanceof DBTableData) {
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
try {
ConnectionRepository.getInstance().testConnection(new ConnectionBean(((DBTableData) tableData).getDatabase()));
} catch (Exception e) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), e);
}
}
}

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

@ -35,20 +35,33 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
@Override
public boolean testConnection(WorkspaceConnectionInfo connectionInfo) throws Exception {
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo));
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo);
LoginResponseInfoBean bean;
try {
bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo));
} catch (Exception e) {
client.closePool();
throw e;
}
return StringUtils.isNotEmpty(bean.getAccessToken());
}
@Override
public WorkspaceClient connect(WorkspaceConnectionInfo connectionInfo) throws Exception {
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo);
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo));
WorkspaceConnection connection = new WorkspaceConnection(
UUID.randomUUID().toString(),
connectionInfo.getUserName(),
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(),
InetAddress.getLocalHost().getHostAddress());
client.updateConnection(connection);
try {
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo));
WorkspaceConnection connection = new WorkspaceConnection(
UUID.randomUUID().toString(),
connectionInfo.getUserName(),
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(),
InetAddress.getLocalHost().getHostAddress());
client.updateConnection(connection);
} catch (Exception e) {
client.closePool();
throw e;
}
client.startHeartBeat();
CompatibleRegister.registerCompatibleEnv();
return client;

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

@ -1,5 +1,6 @@
package com.fr.design.utils;
import com.fanruan.workplace.http.HttpConstants;
import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.base.Utils;
@ -437,7 +438,7 @@ public class DesignUtils {
}
private static String getWebBrowserPath() {
String urlPath = WorkContext.getCurrent().getPath();
String urlPath = WorkContext.getCurrent().getPath() + HttpConstants.FR;
DesignerEnvProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG);
if (processor != null) {
//cas访问的时候, url要处理下.

4
designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -133,8 +133,8 @@ public class RemoteWorkspaceURL implements FCloneable {
String prefix = isHttps ? HTTPS : HTTP;
String portColon = StringUtils.isNotEmpty(port) ? ":" : StringUtils.EMPTY;
String webAppNameSlash = StringUtils.isNotEmpty(web) ? "/" : StringUtils.EMPTY;
String servletNameSlash = StringUtils.isNotEmpty(servlet) ? "/" : StringUtils.EMPTY;
this.url = prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash + servlet;
String servletNameSlash = "/";
this.url = prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash;
return this.url;
}

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

@ -218,7 +218,7 @@ public class DesignPreLoadComponent {
try {
beforeAllStart();
//清空临时文件
TmpFileUtils.cleanUpInnerTmpFiles();
Runtime.getRuntime().addShutdownHook(new Thread(TmpFileUtils::cleanUpInnerTmpFiles));
RestartHelper.deleteRecordFilesWhenStart();
CloudCenter.getInstance();
// 创建监听服务

Loading…
Cancel
Save