Browse Source

REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 兼容+门槛

mss/2.0
Destiny.Lin 6 months ago
parent
commit
b79ce4609b
  1. 16
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 3
      designer-base/src/main/java/com/fr/design/data/datapane/auth/TableDataAuthHelper.java
  3. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  4. 2
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  5. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  6. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  7. 3
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  8. 3
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  9. 5
      designer-base/src/main/java/com/fr/startup/ui/StartupLoadingPanel.java
  10. 4
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java
  11. 4
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  12. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerShowActivator.java

16
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -40,6 +40,7 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.workspace.server.entity.tabledata.PreviewDataBean; import com.fr.workspace.server.entity.tabledata.PreviewDataBean;
import com.fr.workspace.server.entity.tabledata.PreviewSourceBean;
import com.fr.workspace.server.repository.tabledata.TableDataRepository; import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import javax.swing.JFrame; import javax.swing.JFrame;
@ -572,10 +573,10 @@ public abstract class DesignTableDataManager {
parameter.setValue(parameterMap.get(parameter.getName())); parameter.setValue(parameterMap.get(parameter.getName()));
} }
} }
PreviewDataBean bean = new PreviewDataBean(); PreviewSourceBean bean = new PreviewSourceBean();
TableDataSource source = TableDataSourceTailor.extractTableData(tableDataSource); TableDataSource source = TableDataSourceTailor.extractTableData(tableDataSource);
bean.setDataSource(source); bean.setDataSource(source);
bean.setDataName(getTableDataName(source, tabledata)); bean.setDataName(DataOperator.getTableDataName(source, tabledata));
bean.setParameterMap(parameterMap); bean.setParameterMap(parameterMap);
return (EmbeddedTableData) TableDataRepository.getInstance().previewTableData(bean).getTableData(); return (EmbeddedTableData) TableDataRepository.getInstance().previewTableData(bean).getTableData();
} catch (Exception e) { } catch (Exception e) {
@ -700,16 +701,5 @@ public abstract class DesignTableDataManager {
return globalDsCache.containsKey(tableDataName); return globalDsCache.containsKey(tableDataName);
} }
private static String getTableDataName(TableDataSource source, TableData data) {
Iterator tableDataNameIterator = source.getTableDataNameIterator();
while (tableDataNameIterator.hasNext()) {
String tableDataName = (String) tableDataNameIterator.next();
TableData tableData = source.getTableData(tableDataName);
if (tableData.equals(data)) {
return tableDataName;
}
}
return StringUtils.EMPTY;
}
} }

3
designer-base/src/main/java/com/fr/design/data/datapane/auth/TableDataAuthHelper.java

@ -7,6 +7,7 @@ import com.fr.data.impl.NameDatabaseConnection;
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.connection.DBConnectAuth;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -34,7 +35,7 @@ public class TableDataAuthHelper {
*/ */
public static Collection<String> getNoAuthConnections() { public static Collection<String> getNoAuthConnections() {
// 获取无权限连接集合 // 获取无权限连接集合
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); Collection<String> noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections();
return noAuthConnections == null ? Collections.emptyList() : noAuthConnections; return noAuthConnections == null ? Collections.emptyList() : noAuthConnections;
} }

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

@ -14,6 +14,7 @@ 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.connection.DBConnectAuth;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Dimension; import java.awt.Dimension;
@ -81,7 +82,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
protected Iterator<String> items() { protected Iterator<String> items() {
Iterator<String> nameIt = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet().iterator(); Iterator<String> nameIt = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet().iterator();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); Collection<String> noAuthConnections = RemoteAuthorityRepository.getInstance().getNoAuthConnections();
nameList = new ArrayList<>(); nameList = new ArrayList<>();

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

@ -2,6 +2,7 @@ package com.fr.design.env;
import com.fanruan.workplace.http.HttpConstants; import com.fanruan.workplace.http.HttpConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient; import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient;
import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean; import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean;
import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean; import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean;
@ -49,6 +50,7 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
InetAddress.getLocalHost().getHostAddress()); InetAddress.getLocalHost().getHostAddress());
client.updateConnection(connection); client.updateConnection(connection);
client.startHeartBeat(); client.startHeartBeat();
CompatibleRegister.registerCompatibleEnv();
return client; return client;
} }

3
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -12,6 +12,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.repository.template.TemplateRepository;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -215,7 +216,7 @@ public class EnvFileTree extends RefreshableJTree {
resFns = fileNodes.values().toArray(new FileNode[fileNodes.size()]); resFns = fileNodes.values().toArray(new FileNode[fileNodes.size()]);
} }
Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); Arrays.sort(resFns, new FileNodeComparator(TemplateRepository.getInstance().getSupportedTypes()));
return resFns; return resFns;
} }

3
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeComparator.java

@ -2,6 +2,7 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.workspace.server.repository.template.TemplateRepository;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
@ -43,7 +44,7 @@ public class FileNodeComparator implements Comparator<FileNode>, Serializable {
@Deprecated @Deprecated
public FileNodeComparator(boolean reverse) { public FileNodeComparator(boolean reverse) {
this.isReverse = reverse; this.isReverse = reverse;
this.supportTypes = FRContext.getFileNodes().getSupportedTypes(); this.supportTypes = TemplateRepository.getInstance().getSupportedTypes();
} }
public FileNodeComparator(boolean reverse, String[] types) { public FileNodeComparator(boolean reverse, String[] types) {

3
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java

@ -10,6 +10,7 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.ExtraReportClassManager; import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.ReportSupportedFileProvider; import com.fr.report.fun.ReportSupportedFileProvider;
import com.fr.workspace.server.repository.template.TemplateRepository;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -62,7 +63,7 @@ public class FileNodeConstants {
for (ReportSupportedFileProvider provider : providers) { for (ReportSupportedFileProvider provider : providers) {
addAppExtensions(provider.getFileExtensions()); addAppExtensions(provider.getFileExtensions());
} }
supportFileType.addAll(Arrays.asList(FRContext.getFileNodes().getSupportedTypes())); supportFileType.addAll(Arrays.asList(TemplateRepository.getInstance().getSupportedTypes()));
} finally { } finally {
rwl.writeLock().unlock(); rwl.writeLock().unlock();

3
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -51,6 +51,7 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.server.repository.template.TemplateRepository;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.AbstractListModel; import javax.swing.AbstractListModel;
@ -799,7 +800,7 @@ public class FILEChooserPane extends BasicPane {
if (editing == null || !editing.isChartBook()) { if (editing == null || !editing.isChartBook()) {
if (type == JFileChooser.OPEN_DIALOG) { if (type == JFileChooser.OPEN_DIALOG) {
ChooseFileFilter supportedTypes = new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")); ChooseFileFilter supportedTypes = new ChooseFileFilter(TemplateRepository.getInstance().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File"));
Set<ReportSupportedFileProvider> providers = ExtraReportClassManager.getInstance().getArray(ReportSupportedFileProvider.XML_TAG); Set<ReportSupportedFileProvider> providers = ExtraReportClassManager.getInstance().getArray(ReportSupportedFileProvider.XML_TAG);
for (ReportSupportedFileProvider provider : providers) { for (ReportSupportedFileProvider provider : providers) {
for (FileExtension fileExtension : provider.getFileExtensions()) { for (FileExtension fileExtension : provider.getFileExtensions()) {

5
designer-base/src/main/java/com/fr/startup/ui/StartupLoadingPanel.java

@ -8,7 +8,6 @@ import com.fr.design.ui.util.UIUtil;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.module.ModuleEvent;
import java.awt.Frame; import java.awt.Frame;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
@ -88,8 +87,8 @@ public class StartupLoadingPanel {
} }
private void initListeners() { private void initListeners() {
/// 后续换成其他进度方式
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, MODULE_LISTENER); //EventDispatcher.listen(ModuleEvent.MajorModuleStarting, MODULE_LISTENER);
} }
private void resetListeners() { private void resetListeners() {

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

@ -29,6 +29,7 @@ import com.fr.workspace.resource.WorkResource;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.connect.RemoteNetworkRepository; import com.fr.workspace.server.repository.connect.RemoteNetworkRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository; import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.resource.WorkResourceRepository;
import com.fr.workspace.server.repository.system.SystemInfoRepository; import com.fr.workspace.server.repository.system.SystemInfoRepository;
import com.fr.workspace.server.repository.tabledata.TableDataRepository; import com.fr.workspace.server.repository.tabledata.TableDataRepository;
import com.fr.workspace.server.repository.template.TemplateRepository; import com.fr.workspace.server.repository.template.TemplateRepository;
@ -76,7 +77,8 @@ public class DesignWorkContextComponent {
RepositoryManager.getInstance().pureRegisterRepo4Start(TemplateRepository.getInstance()); RepositoryManager.getInstance().pureRegisterRepo4Start(TemplateRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(VcsRepository.getInstance()); RepositoryManager.getInstance().pureRegisterRepo4Start(VcsRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(ShareRepository.getInstance()); RepositoryManager.getInstance().pureRegisterRepo4Start(ShareRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(WorkResourceRepository.getInstance());
RepositoryManager.getInstance().initLocalRepository();
for (WorkRPCRegister<?> workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) { for (WorkRPCRegister<?> workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) {
validate(workRPCRegister.getClazz()); validate(workRPCRegister.getClazz());
FineObjectPool.getInstance().add(workRPCRegister.getClazz(), workRPCRegister.getType(), workRPCRegister.getObject()); FineObjectPool.getInstance().add(workRPCRegister.getClazz(), workRPCRegister.getType(), workRPCRegister.getObject());

4
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -10,7 +10,6 @@ import com.fr.event.Listener;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark; import com.fr.general.locale.LocaleMark;
import com.fr.module.ModuleEvent;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.Locale; import java.util.Locale;
@ -106,7 +105,8 @@ public class SplashContext {
updateModuleLog(moduleId.isEmpty() ? StringUtils.EMPTY : moduleId + loading[loadingIndex % 3]); updateModuleLog(moduleId.isEmpty() ? StringUtils.EMPTY : moduleId + loading[loadingIndex % 3]);
} }
}; };
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener); /// 后续换成其他进度方式
//EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener);
} }
private void updateModuleLog(String text) { private void updateModuleLog(String text) {

4
designer-realize/src/main/java/com/fr/start/module/DesignerShowActivator.java

@ -3,7 +3,6 @@ package com.fr.start.module;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.module.ModuleEvent;
import com.fr.start.DesignerInitial; import com.fr.start.DesignerInitial;
/** /**
@ -13,7 +12,8 @@ public class DesignerShowActivator extends Activator {
@Override @Override
public void start() { public void start() {
EventDispatcher.asyncFire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Module_Name_Designer")); /// 后续换成其他进度方式
//EventDispatcher.asyncFire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Module_Name_Designer"));
DesignerInitial.prepare(); DesignerInitial.prepare();
} }

Loading…
Cancel
Save