From a48c9ab91c1a8350aa72add1912ea3f77772fe8c Mon Sep 17 00:00:00 2001 From: ju Date: Thu, 14 Jun 2018 21:44:40 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-8790=20=E6=94=B9=E5=8A=A8=E5=A4=AA?= =?UTF-8?q?=E5=A4=9A=E4=BA=86=EF=BC=8C=E5=85=88commit=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/DesignerEnvManager.java | 23 +++---- .../design/actions/file/SwitchExistEnv.java | 14 ++--- .../env/DesignerWorkspaceGenerator.java | 29 +++++++++ .../src/com/fr/design/env/EnvGenerator.java | 22 ------- .../com/fr/design/env/RemoteEnvConfig.java | 7 ++- .../com/fr/design/env/RemoteWorkspace.java | 61 +++++++++++++++++++ .../design/file/HistoryTemplateListPane.java | 4 +- .../com/fr/design/file/TemplateTreePane.java | 4 +- .../fr/design/mainframe/DesignerFrame.java | 26 ++------ .../com/fr/design/mainframe/TemplatePane.java | 18 ++---- .../loghandler/socketio/DesignerSocketIO.java | 6 +- designer-base/src/com/fr/env/EnvListPane.java | 4 +- .../src/com/fr/env/LocalEnvPane.java | 2 +- designer-base/src/com/fr/env/RemoteEnv.java | 30 +-------- .../src/com/fr/env/RemoteEnvPane.java | 1 - designer-base/src/com/fr/env/SignIn.java | 46 -------------- .../src/com/fr/start/ServerStarter.java | 6 +- .../src/com/fr/start/EnvSwitcher.java | 10 +-- .../fr/start/module/DesignerEnvProvider.java | 15 ----- .../com/fr/start/module/DesignerStartup.java | 2 +- 20 files changed, 145 insertions(+), 185 deletions(-) create mode 100644 designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java delete mode 100644 designer-base/src/com/fr/design/env/EnvGenerator.java create mode 100644 designer-base/src/com/fr/design/env/RemoteWorkspace.java delete mode 100644 designer-base/src/com/fr/env/SignIn.java diff --git a/designer-base/src/com/fr/design/DesignerEnvManager.java b/designer-base/src/com/fr/design/DesignerEnvManager.java index 956871424d..54564ced18 100644 --- a/designer-base/src/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/com/fr/design/DesignerEnvManager.java @@ -6,12 +6,11 @@ package com.fr.design; import com.fr.base.BaseXMLUtils; import com.fr.base.FRContext; import com.fr.base.Utils; -import com.fr.base.env.EnvUpdater; -import com.fr.core.env.EnvConfig; -import com.fr.core.env.impl.LocalEnvConfig; +import com.fr.base.env.EnvConfig; +import com.fr.base.env.LocalEnvConfig; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; -import com.fr.design.env.EnvGenerator; +import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.file.FILEFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; @@ -33,6 +32,7 @@ import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLableReader; +import com.fr.workspace.WorkContext; import javax.swing.*; import javax.swing.SwingWorker.StateValue; @@ -194,7 +194,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if (installHome != null) { String name = Inter.getLocText("FR-Engine_DEFAULT"); String envPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); - designerEnvManager.putEnv(name, new LocalEnvConfig(envPath)); + designerEnvManager.putEnv(name, new LocalEnvConfig(envPath, name)); designerEnvManager.setCurEnvName(name); } } @@ -482,7 +482,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { /** * 返回默认环境 */ - public EnvConfig getDefaultEnv() { + public EnvConfig getDefaultConfig() { String installHome = StableUtils.getInstallHome(); String defaultenvPath = StableUtils.pathJoin(installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME); defaultenvPath = new File(defaultenvPath).getPath(); @@ -494,8 +494,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { return env; } } - EnvConfig newDefaultEnv = new LocalEnvConfig(defaultenvPath); - this.putEnv(Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}), newDefaultEnv); + String name = Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}); + EnvConfig newDefaultEnv = new LocalEnvConfig(defaultenvPath, name); + this.putEnv(name, newDefaultEnv); return newDefaultEnv; } @@ -526,7 +527,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if (isCurrentEnvDefault()) { return; } - EnvUpdater.updateEnv(EnvGenerator.generate(getDefaultEnv())); + WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig())); } /** @@ -1416,9 +1417,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if ((tmpVal = reader.getAttrAsString("webinfLocation", null)) != null) { // marks:兼容6.1的 // marks:设置默认的目录. - EnvConfig reportServer = new LocalEnvConfig(tmpVal); - String curReportServerName = Inter.getLocText("Server-Embedded_Server"); + EnvConfig reportServer = new LocalEnvConfig(tmpVal,curReportServerName); + this.putEnv(curReportServerName, reportServer); this.setCurEnvName(curReportServerName); } diff --git a/designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java index c956670576..f21fb69910 100644 --- a/designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java @@ -1,15 +1,13 @@ package com.fr.design.actions.file; import com.fr.base.BaseUtils; -import com.fr.base.env.Callback; -import com.fr.base.env.EnvUpdater; -import com.fr.core.env.EnvConfig; -import com.fr.core.env.impl.LocalEnvConfig; +import com.fr.base.env.EnvConfig; +import com.fr.base.env.LocalEnvConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.ResponseDataSourceChange; -import com.fr.design.env.EnvGenerator; +import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.RemoteEnvConfig; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.DesignerContext; @@ -19,11 +17,11 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.utils.DesignUtils; -import com.fr.env.RemoteEnv; import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.log.FineLoggerFactory; import com.fr.stable.EnvChangedListener; +import com.fr.workspace.WorkContext; +import com.fr.workspace.WorkContextCallback; import javax.swing.*; import java.awt.event.ActionEvent; @@ -102,7 +100,7 @@ public class SwitchExistEnv extends MenuDef { DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); final String envName = getName(); EnvConfig selectedEnv = envManager.getEnv(envName); - EnvUpdater.updateEnv(EnvGenerator.generate(selectedEnv), new Callback() { + WorkContext.switchTo(DesignerWorkspaceGenerator.generate(selectedEnv), new WorkContextCallback() { @Override public void success() { DesignerEnvManager.getEnvManager().setCurEnvName(envName); diff --git a/designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java b/designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java new file mode 100644 index 0000000000..1197b9cb55 --- /dev/null +++ b/designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java @@ -0,0 +1,29 @@ +package com.fr.design.env; + +import com.fr.base.Env; +import com.fr.base.env.EnvConfig; +import com.fr.base.env.LocalEnvConfig; +import com.fr.env.RemoteEnv; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import com.fr.workspace.connect.WorkspaceClient; +import com.fr.workspace.connect.WorkspaceConnection; + +/** + * 根据配置生成运行环境 + */ +public class DesignerWorkspaceGenerator { + + public static Workspace generate(EnvConfig config) { + + Workspace workspace = null; + if (config instanceof LocalEnvConfig) { + workspace = WorkContext.getFactory().build(config.getPath()); + } else if (config instanceof RemoteEnvConfig) { + RemoteEnvConfig remoteConfig = (RemoteEnvConfig) config; + WorkspaceClient client = WorkContext.getConnector().connect(new WorkspaceConnection(remoteConfig.getHost(), remoteConfig.getPort(), remoteConfig.getUsername(), remoteConfig.getPassword())); + workspace = new RemoteWorkspace(client, remoteConfig.getHost() + ":" + remoteConfig.getPort(), remoteConfig.getPassword()); + } + return workspace; + } +} diff --git a/designer-base/src/com/fr/design/env/EnvGenerator.java b/designer-base/src/com/fr/design/env/EnvGenerator.java deleted file mode 100644 index c56ab92956..0000000000 --- a/designer-base/src/com/fr/design/env/EnvGenerator.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.design.env; - -import com.fr.base.Env; -import com.fr.core.env.EnvConfig; -import com.fr.core.env.impl.LocalEnvConfig; -import com.fr.dav.LocalEnv; -import com.fr.env.RemoteEnv; - -/** - * 根据配置生成运行环境 - */ -public class EnvGenerator { - public static Env generate(EnvConfig config) { - Env env = null; - if (config instanceof LocalEnvConfig) { - env = new LocalEnv((LocalEnvConfig)config); - } else if (config instanceof RemoteEnvConfig) { - env = new RemoteEnv((RemoteEnvConfig) config); - } - return env; - } -} diff --git a/designer-base/src/com/fr/design/env/RemoteEnvConfig.java b/designer-base/src/com/fr/design/env/RemoteEnvConfig.java index fc701d8ca7..280149484a 100644 --- a/designer-base/src/com/fr/design/env/RemoteEnvConfig.java +++ b/designer-base/src/com/fr/design/env/RemoteEnvConfig.java @@ -1,6 +1,6 @@ package com.fr.design.env; -import com.fr.core.env.impl.AbstractEnvConfig; +import com.fr.base.env.AbstractEnvConfig; import com.fr.general.Inter; import com.fr.security.SecurityToolbox; import com.fr.stable.AssistUtils; @@ -20,10 +20,13 @@ public class RemoteEnvConfig extends AbstractEnvConfig { private String password; public RemoteEnvConfig() { - + + super(name); } public RemoteEnvConfig(String host, int port, String username, String password) { + + super(name); this.host = host; this.port = port; this.username = username; diff --git a/designer-base/src/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/com/fr/design/env/RemoteWorkspace.java new file mode 100644 index 0000000000..487f2c0493 --- /dev/null +++ b/designer-base/src/com/fr/design/env/RemoteWorkspace.java @@ -0,0 +1,61 @@ +package com.fr.design.env; + +import com.fr.general.Inter; +import com.fr.workspace.Workspace; +import com.fr.workspace.connect.WorkspaceClient; + +/** + * Created by juhaoyu on 2018/6/14. + * 远程工作目录 + */ +public class RemoteWorkspace implements Workspace { + + private final WorkspaceClient client; + + private final String address; + + private final String userName; + + public RemoteWorkspace(WorkspaceClient client, String address, String userName) { + + this.client = client; + this.address = address; + this.userName = userName; + } + + @Override + public String getName() { + + return userName; + } + + @Override + public String getPath() { + + return address; + } + + @Override + public String getDescription() { + + return userName + "@" + "[" + Inter.getLocText("Fine-Designer_Basic_Remote_Env") + "]"; + } + + @Override + public boolean isWarDeploy() { + + return false; + } + + @Override + public boolean isLocal() { + + return false; + } + + @Override + public T get(Class type) { + + return client.getPool().get(type); + } +} diff --git a/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java index daa851c668..2c2137384e 100644 --- a/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java @@ -3,7 +3,6 @@ package com.fr.design.file; import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.base.chart.chartdata.CallbackEvent; -import com.fr.dav.LocalEnv; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.constants.UIConstants; @@ -25,6 +24,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; import javax.swing.*; import javax.swing.event.ListSelectionEvent; @@ -368,7 +368,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C FileNode fileNode = new FileNode(((JTemplate) list.getSelectedValue()).getEditingFILE().getPath(), false); Env env = FRContext.getCurrentEnv(); if (env.isLocalEnv()) { - IOUtils.openWindowsFolder(StableUtils.pathJoin(env.getEnvConfig().getPath(), fileNode.getEnvPath())); + IOUtils.openWindowsFolder(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fileNode.getEnvPath())); } } diff --git a/designer-base/src/com/fr/design/file/TemplateTreePane.java b/designer-base/src/com/fr/design/file/TemplateTreePane.java index a095595cf8..6d5063fd67 100644 --- a/designer-base/src/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/com/fr/design/file/TemplateTreePane.java @@ -6,7 +6,6 @@ package com.fr.design.file; import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.base.io.FileAssistUtils; -import com.fr.dav.LocalEnv; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.layout.FRGUIPaneFactory; @@ -23,6 +22,7 @@ import com.fr.stable.CoreConstants; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; @@ -147,7 +147,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { try { Desktop.getDesktop().open(new File(filePath)); } catch (Exception e) { - IOUtils.openWindowsFolder(StableUtils.pathJoin(localEnv.getEnvConfig().getPath(), fn.getEnvPath())); + IOUtils.openWindowsFolder(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fn.getEnvPath())); } } diff --git a/designer-base/src/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/com/fr/design/mainframe/DesignerFrame.java index 470f4c32d6..4968dc0690 100644 --- a/designer-base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/com/fr/design/mainframe/DesignerFrame.java @@ -5,8 +5,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; -import com.fr.base.env.EnvUpdater; -import com.fr.core.env.EnvConfig; +import com.fr.base.env.EnvConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -54,24 +53,11 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JLayeredPane; -import javax.swing.JMenuBar; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.WindowConstants; +import javax.swing.*; import javax.swing.border.MatteBorder; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Graphics; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Toolkit; +import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -992,8 +978,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta EastRegionContainerPane.getInstance().getContainerWidth()); DesignerEnvManager.getEnvManager().saveXMLFile(); - - EnvUpdater.disconnect(); + + WorkContext.switchTo(null); this.setVisible(false); this.dispose(); diff --git a/designer-base/src/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/com/fr/design/mainframe/TemplatePane.java index 5c539cd9bf..a6d5a16eef 100644 --- a/designer-base/src/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/com/fr/design/mainframe/TemplatePane.java @@ -1,16 +1,13 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.base.env.Callback; -import com.fr.base.env.EnvUpdater; -import com.fr.core.env.EnvConfig; -import com.fr.core.env.impl.LocalEnvConfig; +import com.fr.base.env.EnvConfig; +import com.fr.base.env.LocalEnvConfig; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.dialog.InformationWarnPane; -import com.fr.design.env.EnvGenerator; +import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.RemoteEnvConfig; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.TemplateTreePane; @@ -18,14 +15,12 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.DesignUtils; import com.fr.env.EnvListPane; -import com.fr.env.RemoteEnv; -import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.EnvChangedListener; -import com.fr.stable.ProductConstants; -import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.WorkContextCallback; import javax.swing.*; import java.awt.*; @@ -120,7 +115,7 @@ public class TemplatePane extends JPanel implements MouseListener { EnvConfig selectedEnv = envManager.getEnv(selectedName); GeneralContext.fireEnvWillChangeListener(); try { - EnvUpdater.updateEnv(EnvGenerator.generate(selectedEnv), new Callback() { + WorkContext.switchTo(DesignerWorkspaceGenerator.generate(selectedEnv), new WorkContextCallback() { @Override public void fail() { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); @@ -128,7 +123,6 @@ public class TemplatePane extends JPanel implements MouseListener { @Override public void success() { - DesignerEnvManager.getEnvManager().setCurEnvName(selectedName); DesignUtils.refreshDesignerFrame(); } }); diff --git a/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java b/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java index 957d9f83ac..bcf9e2ae03 100644 --- a/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java +++ b/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java @@ -2,13 +2,10 @@ package com.fr.design.mainframe.loghandler.socketio; import com.fr.base.Env; import com.fr.base.FRContext; -import com.fr.config.ConfigEvent; -import com.fr.config.Configuration; -import com.fr.core.env.EnvConfig; +import com.fr.base.env.EnvConfig; import com.fr.core.env.EnvConstants; import com.fr.core.env.EnvContext; import com.fr.core.env.EnvEvent; -import com.fr.core.env.impl.LocalEnvConfig; import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.design.env.RemoteEnvConfig; import com.fr.design.mainframe.loghandler.DesignerLogHandler; @@ -27,7 +24,6 @@ import io.socket.emitter.Emitter; import java.io.ByteArrayInputStream; import java.net.URI; -import java.net.URL; public class DesignerSocketIO { diff --git a/designer-base/src/com/fr/env/EnvListPane.java b/designer-base/src/com/fr/env/EnvListPane.java index 6146b5d5d5..652b11d084 100644 --- a/designer-base/src/com/fr/env/EnvListPane.java +++ b/designer-base/src/com/fr/env/EnvListPane.java @@ -1,7 +1,7 @@ package com.fr.env; -import com.fr.core.env.EnvConfig; -import com.fr.core.env.impl.LocalEnvConfig; +import com.fr.base.env.EnvConfig; +import com.fr.base.env.LocalEnvConfig; import com.fr.design.env.RemoteEnvConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.gui.controlpane.JListControlPane; diff --git a/designer-base/src/com/fr/env/LocalEnvPane.java b/designer-base/src/com/fr/env/LocalEnvPane.java index d5dce6a1a3..993a72b139 100644 --- a/designer-base/src/com/fr/env/LocalEnvPane.java +++ b/designer-base/src/com/fr/env/LocalEnvPane.java @@ -1,6 +1,6 @@ package com.fr.env; -import com.fr.core.env.impl.LocalEnvConfig; +import com.fr.base.env.LocalEnvConfig; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; diff --git a/designer-base/src/com/fr/env/RemoteEnv.java b/designer-base/src/com/fr/env/RemoteEnv.java index 6517efce18..084962a03b 100644 --- a/designer-base/src/com/fr/env/RemoteEnv.java +++ b/designer-base/src/com/fr/env/RemoteEnv.java @@ -6,9 +6,6 @@ import com.fr.base.operator.connect.ConnectOperator; import com.fr.base.operator.file.FileOperator; import com.fr.base.operator.org.OrganizationOperator; import com.fr.base.remote.RemoteDeziConstants; -import com.fr.common.rpc.RemoteCallServerConfig; -import com.fr.common.rpc.netty.MessageSendExecutor; -import com.fr.common.rpc.netty.RemoteCallClient; import com.fr.core.env.EnvConstants; import com.fr.core.env.EnvContext; import com.fr.data.impl.storeproc.StoreProcedure; @@ -20,7 +17,6 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.file.CacheManager; import com.fr.general.CommonIOUtils; import com.fr.general.ComparatorUtils; -import com.fr.general.EnvProxyFactory; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.http.HttpToolbox; @@ -42,6 +38,9 @@ import com.fr.stable.project.ProjectConstants; import com.fr.third.guava.base.Strings; import com.fr.third.guava.collect.ImmutableMap; import com.fr.web.ResourceConstants; +import com.fr.workspace.engine.server.rpc.RemoteCallServerConfig; +import com.fr.workspace.engine.server.rpc.netty.MessageSendExecutor; +import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient; import javax.swing.*; import javax.xml.transform.Source; @@ -109,24 +108,6 @@ public class RemoteEnv extends AbstractEnv implements DesignAut return true; } - @Override - public EnvProxyFactory getProxyFactory() { - - return new EnvProxyFactory() { - - @Override - public T get(Class clazz, T obj) { - - assert clazz != null; - try { - return MessageSendExecutor.getInstance().execute(clazz); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - } - @Override public FileOperator getFileOperator() throws Exception { @@ -143,11 +124,6 @@ public class RemoteEnv extends AbstractEnv implements DesignAut return MessageSendExecutor.getInstance().execute(OrganizationOperator.class); } - @Override - public RemoteEnvConfig getEnvConfig() { - return config; - } - @Override public String getPath() { return config.getPath(); diff --git a/designer-base/src/com/fr/env/RemoteEnvPane.java b/designer-base/src/com/fr/env/RemoteEnvPane.java index 6028dc6eee..12571369f3 100644 --- a/designer-base/src/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/com/fr/env/RemoteEnvPane.java @@ -1,7 +1,6 @@ package com.fr.env; import com.fr.base.FRContext; -import com.fr.core.env.resource.EnvConfigUtils; import com.fr.design.env.RemoteEnvConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.beans.BasicBeanPane; diff --git a/designer-base/src/com/fr/env/SignIn.java b/designer-base/src/com/fr/env/SignIn.java deleted file mode 100644 index bca04d2484..0000000000 --- a/designer-base/src/com/fr/env/SignIn.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fr.env; - - -import com.fr.base.Env; -import com.fr.base.FRContext; -import com.fr.core.env.EnvConfig; -import com.fr.core.env.EnvContext; -import com.fr.core.env.EnvEvent; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.utils.DesignUtils; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; -import com.fr.event.Null; -import com.fr.general.ComparatorUtils; -import com.fr.general.Inter; -import com.fr.stable.AssistUtils; - -import javax.swing.*; - - -public class SignIn { - - static { - EventDispatcher.listen(EnvEvent.CONNECTION_ERROR, new Listener() { - @Override - public void on(Event event, Null param) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed")); - } - }); - } - - /** - * 注册入环境 - * - * @param selectedEnv 选择的环境 - * @throws Exception 异常 - */ - public static void signIn(EnvConfig selectedEnv) throws Exception { - Env env = FRContext.getCurrentEnv(); - if (env != null && AssistUtils.equals(env.getEnvConfig(), selectedEnv)) { - env.disconnect(); - } - //DesignUtils.switchToEnv(selectedEnv); - } -} \ No newline at end of file diff --git a/designer-base/src/com/fr/start/ServerStarter.java b/designer-base/src/com/fr/start/ServerStarter.java index 1dc8cf8f14..3c6c1f22a2 100644 --- a/designer-base/src/com/fr/start/ServerStarter.java +++ b/designer-base/src/com/fr/start/ServerStarter.java @@ -2,13 +2,12 @@ package com.fr.start; import com.fr.base.FRContext; import com.fr.base.ServerConfig; -import com.fr.base.env.EnvUpdater; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.env.EnvGenerator; +import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.mainframe.DesignerContext; @@ -22,6 +21,7 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.start.server.FineEmbedServer; +import com.fr.workspace.WorkContext; import javax.swing.*; import java.awt.*; @@ -54,7 +54,7 @@ public class ServerStarter { @Override public void doOk() { try { - EnvUpdater.updateEnv(EnvGenerator.generate(DesignerEnvManager.getEnvManager().getDefaultEnv())); + WorkContext.switchTo(DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getDefaultConfig())); TemplateTreePane.getInstance().refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); } catch (Exception e) { diff --git a/designer-realize/src/com/fr/start/EnvSwitcher.java b/designer-realize/src/com/fr/start/EnvSwitcher.java index 5dffc028ab..6fbffcc5a6 100644 --- a/designer-realize/src/com/fr/start/EnvSwitcher.java +++ b/designer-realize/src/com/fr/start/EnvSwitcher.java @@ -1,10 +1,10 @@ package com.fr.start; -import com.fr.base.Env; -import com.fr.base.env.EnvUpdater; import com.fr.design.DesignerEnvManager; -import com.fr.design.env.EnvGenerator; +import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.mainframe.TemplatePane; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; /** * Created by juhaoyu on 2018/1/31. @@ -16,8 +16,8 @@ public class EnvSwitcher { try { String current = DesignerEnvManager.getEnvManager().getCurEnvName(); - Env env = EnvGenerator.generate(DesignerEnvManager.getEnvManager().getEnv(current)); - EnvUpdater.updateEnv(env); + Workspace workspace = DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getEnv(current)); + WorkContext.switchTo(workspace); } catch (Exception e) { TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner(); } diff --git a/designer-realize/src/com/fr/start/module/DesignerEnvProvider.java b/designer-realize/src/com/fr/start/module/DesignerEnvProvider.java index 0615d7774a..827ee73cb3 100644 --- a/designer-realize/src/com/fr/start/module/DesignerEnvProvider.java +++ b/designer-realize/src/com/fr/start/module/DesignerEnvProvider.java @@ -1,15 +1,11 @@ package com.fr.start.module; -import com.fr.base.Env; import com.fr.base.ModifiedTable; import com.fr.base.Parameter; import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; -import com.fr.base.env.EnvUpdater; import com.fr.base.env.serializer.OldSerializerAdapter; import com.fr.base.env.serializer.ProcedureDataModelSerializer; -import com.fr.core.env.EnvConfig; -import com.fr.core.env.EnvEvent; import com.fr.core.env.proxy.EnvProxy; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.Connection; @@ -17,10 +13,6 @@ import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.dav.DavXMLUtils; import com.fr.design.DesignerEnvManager; -import com.fr.design.env.EnvGenerator; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.module.Activator; @@ -58,13 +50,6 @@ public class DesignerEnvProvider extends Activator { private void initDesignerEnv() { addSerializers(); - EventDispatcher.listen(EnvEvent.BEFORE_SIGN_IN, new Listener() { - @Override - public void on(Event event, EnvConfig envConfig) { - Env env = EnvGenerator.generate(envConfig); - EnvUpdater.updateEnv(env); - } - }); } private void addSerializers() { diff --git a/designer-realize/src/com/fr/start/module/DesignerStartup.java b/designer-realize/src/com/fr/start/module/DesignerStartup.java index eb1cc85d72..f5c3959e08 100644 --- a/designer-realize/src/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/com/fr/start/module/DesignerStartup.java @@ -1,6 +1,6 @@ package com.fr.start.module; -import com.fr.core.env.EnvConfig; +import com.fr.base.env.EnvConfig; import com.fr.core.env.EnvEvent; import com.fr.event.Event; import com.fr.event.Listener;