ju 7 years ago
parent
commit
285c8d764c
  1. 9
      designer-base/src/com/fr/design/DesignState.java
  2. 12
      designer-base/src/com/fr/design/data/datapane/preview/PreviewTableModel.java
  3. 4
      designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java
  4. 15
      designer-base/src/com/fr/design/env/DesignerWorkspaceInfo.java
  5. 6
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  6. 3
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  7. 21
      designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  8. 4
      designer-base/src/com/fr/design/remote/ui/UserManagerPane.java
  9. 6
      designer-base/src/com/fr/design/utils/DesignUtils.java
  10. 7
      designer-base/src/com/fr/env/RemoteEnvPane.java
  11. 39
      designer-base/src/com/fr/env/RemoteEnvPane2.java
  12. 334
      designer-base/src/com/fr/env/RemoteEnvUtils.java
  13. 6
      designer-base/src/com/fr/start/ServerStarter.java
  14. 4
      designer-realize/src/com/fr/design/mainframe/JWorkBook.java
  15. 8
      designer-realize/src/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java
  16. 20
      designer-realize/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
  17. 322
      designer-realize/src/com/fr/start/module/DesignerEnvProvider.java
  18. 12
      designer-realize/src/com/fr/start/module/DesignerStartup.java

9
designer-base/src/com/fr/design/DesignState.java

@ -1,10 +1,8 @@
package com.fr.design; package com.fr.design;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.env.RemoteEnv; import com.fr.workspace.WorkContext;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -41,11 +39,10 @@ public class DesignState {
public DesignState(ToolBarMenuDockPlus plus) { public DesignState(ToolBarMenuDockPlus plus) {
designState = plus.getMenuState(); designState = plus.getMenuState();
Env env = FRContext.getCurrentEnv(); if (WorkContext.getCurrent().isLocal()) {
if (env != null && env instanceof RemoteEnv) {
designState += REMOTE; designState += REMOTE;
} }
isRoot = env != null && env.isRoot(); // isRoot = env != null && env.isRoot();
isAuthority = BaseUtils.isAuthorityEditing(); isAuthority = BaseUtils.isAuthorityEditing();
} }

12
designer-base/src/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -1,18 +1,18 @@
package com.fr.design.data.datapane.preview; package com.fr.design.data.datapane.preview;
import javax.swing.table.AbstractTableModel;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.cache.list.IntList;
import com.fr.data.AbstractDataModel; import com.fr.data.AbstractDataModel;
import com.fr.data.impl.EmbeddedTableData.EmbeddedTDDataModel; import com.fr.data.impl.EmbeddedTableData.EmbeddedTDDataModel;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.env.RemoteEnv; import com.fr.design.utils.DesignUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException; import com.fr.general.data.TableDataException;
import com.fr.cache.list.IntList;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.utils.DesignUtils; import com.fr.workspace.WorkContext;
import javax.swing.table.AbstractTableModel;
/** /**
* 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的 * 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的
@ -188,7 +188,7 @@ public class PreviewTableModel extends AbstractTableModel {
s = "?"; s = "?";
} else if (o instanceof String) { } else if (o instanceof String) {
s = Inter.getLocText("FR-Designer_Parameter_String"); s = Inter.getLocText("FR-Designer_Parameter_String");
if (FRContext.getCurrentEnv() instanceof RemoteEnv && dataModel instanceof EmbeddedTDDataModel) { if (!WorkContext.getCurrent().isLocal() && dataModel instanceof EmbeddedTDDataModel) {
Class clzz = ((EmbeddedTDDataModel) dataModel).getColumnClass(column); Class clzz = ((EmbeddedTDDataModel) dataModel).getColumnClass(column);
if (Number.class.isAssignableFrom(clzz)) { if (Number.class.isAssignableFrom(clzz)) {
s = Inter.getLocText("FR-Designer_Number");//bigdecimal s = Inter.getLocText("FR-Designer_Number");//bigdecimal

4
designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java

@ -9,8 +9,8 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.env.RemoteEnv;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -95,7 +95,7 @@ public final class StoreProcedureNameWrapper implements TableDataWrapper {
} }
columnNameList = new ArrayList<String>(); columnNameList = new ArrayList<String>();
Env env = FRContext.getCurrentEnv(); Env env = FRContext.getCurrentEnv();
if (env instanceof RemoteEnv) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
createStore(false); createStore(false);
columnNameList = Arrays.asList(procedureDataModel.getColumnName()); columnNameList = Arrays.asList(procedureDataModel.getColumnName());

15
designer-base/src/com/fr/design/env/DesignerWorkspaceInfo.java vendored

@ -59,6 +59,21 @@ public class DesignerWorkspaceInfo implements XMLable {
return connection; return connection;
} }
public void setType(DesignerWorkspaceType type) {
this.type = type;
}
public void setPath(String path) {
this.path = path;
}
public void setConnection(WorkspaceConnection connection) {
this.connection = connection;
}
@Override @Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {

6
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -5,7 +5,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.env.EnvConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -14,6 +13,7 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
@ -650,9 +650,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
defaultTitleSB.append(" "); defaultTitleSB.append(" ");
// james:标识登录的用户和登录的ENV // james:标识登录的用户和登录的ENV
String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
EnvConfig env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
if (env != null) { if (env != null) {
defaultTitleSB.append(env.getDescription(envName)); // defaultTitleSB.append(env.getDescription(envName));
if (editingTemplate != null) { if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath(); String path = editingTemplate.getEditingFILE().getPath();
if (!editingTemplate.getEditingFILE().exists()) { if (!editingTemplate.getEditingFILE().exists()) {

3
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -2,10 +2,7 @@ package com.fr.design.mainframe.loghandler.socketio;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.env.RemoteEnv;
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;

21
designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -48,7 +48,6 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction; import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -60,19 +59,10 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType; import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import javax.swing.Icon; import javax.swing.*;
import javax.swing.JComponent; import java.awt.*;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -447,8 +437,9 @@ public abstract class ToolBarMenuDock {
return FRContext.getCurrentEnv() != null && !FRContext.getCurrentEnv().isLocalEnv() && FRContext.getCurrentEnv().isRoot(); return FRContext.getCurrentEnv() != null && !FRContext.getCurrentEnv().isLocalEnv() && FRContext.getCurrentEnv().isRoot();
} }
protected boolean shouldShowPlugin() { private boolean shouldShowPlugin() {
return !(FRContext.getCurrentEnv() instanceof RemoteEnv) && FRContext.isChineseEnv();
return !(WorkContext.getCurrent().isLocal()) && FRContext.isChineseEnv();
} }
/** /**

4
designer-base/src/com/fr/design/remote/ui/UserManagerPane.java

@ -278,8 +278,8 @@ public class UserManagerPane extends BasicPane {
@Override @Override
protected List<RemoteDesignMember> doInBackground() { protected List<RemoteDesignMember> doInBackground() {
addingMembers.clear(); addingMembers.clear();
String username = EnvConfigUtils.getUsername(EnvContext.currentEnv()); // String username = EnvConfigUtils.getUsername(EnvContext.currentEnv());
addingMembers.addAll(EnvProxy.get(DecisionOperator.class).getMembers(username, keyword)); // addingMembers.addAll(EnvProxy.get(DecisionOperator.class).getMembers(username, keyword));
return addingMembers; return addingMembers;
} }

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

@ -27,6 +27,7 @@ import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -299,11 +300,12 @@ public class DesignUtils {
} }
String postfixOfUri = (segs.length > 0 ? "?" + StableUtils.join(segs, "&") : StringUtils.EMPTY); String postfixOfUri = (segs.length > 0 ? "?" + StableUtils.join(segs, "&") : StringUtils.EMPTY);
if (FRContext.getCurrentEnv() instanceof RemoteEnv) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
if (Utils.isEmbeddedParameter(postfixOfUri)) { if (Utils.isEmbeddedParameter(postfixOfUri)) {
String time = Calendar.getInstance().getTime().toString().replaceAll(" ", ""); String time = Calendar.getInstance().getTime().toString().replaceAll(" ", "");
boolean isUserPrivilege = ((RemoteEnv) FRContext.getCurrentEnv()).writePrivilegeMap(time, postfixOfUri); // boolean isUserPrivilege = FRContext.getCurrentEnv()).writePrivilegeMap(time, postfixOfUri);
boolean isUserPrivilege = false;
postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID() : postfixOfUri; postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID() : postfixOfUri;
} }
// 加参数给远程设计校验权限。 // 加参数给远程设计校验权限。

7
designer-base/src/com/fr/env/RemoteEnvPane.java vendored

@ -257,7 +257,7 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
String username = ob.getConnection().getUserName(); String username = ob.getConnection().getUserName();
String pwd = ob.getConnection().getPassword(); String pwd = ob.getConnection().getPassword();
this.usernameInput.setText(username == null ? StringUtils.EMPTY : pwd); this.usernameInput.setText(username == null ? StringUtils.EMPTY : pwd);
this.passwordInput.setText(pwd == null ? StringUtils.EMPTY : "******"); this.passwordInput.setText(pwd == null ? StringUtils.EMPTY : pwd);
} }
@Override @Override
@ -459,14 +459,13 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
private boolean testConnection() { private boolean testConnection() {
String url = remoteEnvURL.getURL(); String url = remoteEnvURL.getURL();
//RemoteEnv env = new RemoteEnv(url, usernameInput.getText(), new String(passwordInput.getPassword())); //RemoteEnv env = new RemoteEnv(url, usernameInput.getText(), new String(passwordInput.getPassword()));
RemoteEnv env = null;
boolean connect = false; boolean connect = false;
try { try {
if (StringUtils.isNotEmpty(url)) { if (StringUtils.isNotEmpty(url)) {
if (remoteEnvURL.getHttps()) { if (remoteEnvURL.getHttps()) {
setHttpsParas(); setHttpsParas();
} }
connect = env.testConnectionWithOutRegisteServer(this); // connect = env.testConnectionWithOutRegisteServer(this);
} }
} catch (Exception e) { } catch (Exception e) {
JOptionPane.showMessageDialog( JOptionPane.showMessageDialog(
@ -479,7 +478,7 @@ public class RemoteEnvPane extends BasicBeanPane<DesignerWorkspaceInfo> {
} }
if (connect) { if (connect) {
try { try {
String remoteVersion = env.getDesignerVersion(); String remoteVersion = "";
if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) { if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) {
String info = Inter.getLocText("Server-version-tip") + "。"; String info = Inter.getLocText("Server-version-tip") + "。";
String moreInfo = Inter.getLocText("Server-version-tip-moreInfo") + "。"; String moreInfo = Inter.getLocText("Server-version-tip-moreInfo") + "。";

39
designer-base/src/com/fr/env/RemoteEnvPane2.java vendored

@ -1,8 +1,9 @@
package com.fr.env; package com.fr.env;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.ipasswordfield.UIPassWordField;
@ -12,6 +13,8 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnection;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
@ -24,7 +27,7 @@ import java.awt.event.WindowEvent;
/** /**
* 远程环境设置界面暂时命名为2待做完功能直接替代掉老的RemoteEnvPane * 远程环境设置界面暂时命名为2待做完功能直接替代掉老的RemoteEnvPane
*/ */
public class RemoteEnvPane2 extends BasicBeanPane<RemoteEnvConfig> { public class RemoteEnvPane2 extends BasicBeanPane<DesignerWorkspaceInfo> {
private UITextField hostTextField; private UITextField hostTextField;
private UIIntNumberField portTextField; private UIIntNumberField portTextField;
@ -88,8 +91,9 @@ public class RemoteEnvPane2 extends BasicBeanPane<RemoteEnvConfig> {
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
final RemoteEnv remoteEnv = new RemoteEnv(updateBean());
remoteEnv.connectOnce(); final DesignerWorkspaceInfo remoteEnv = updateBean();
WorkContext.getConnector().testConnection(remoteEnv.getConnection());
return null; return null;
} }
@ -161,25 +165,28 @@ public class RemoteEnvPane2 extends BasicBeanPane<RemoteEnvConfig> {
} }
@Override @Override
public void populateBean(RemoteEnvConfig config) { public void populateBean(DesignerWorkspaceInfo config) {
if (config == null) { if (config == null) {
return; return;
} }
hostTextField.setText(config.getHost()); WorkspaceConnection connection = config.getConnection();
if (config.getPort() != 0) { if (connection != null) {
portTextField.setValue(config.getPort()); hostTextField.setText(connection.getIp());
if (connection.getPort() != 0) {
portTextField.setValue(connection.getPort());
}
usernameTextField.setText(connection.getUserName());
passwordTextField.setText(connection.getPassword());
} }
usernameTextField.setText(config.getUsername());
passwordTextField.setText(config.getPassword());
} }
@Override @Override
public RemoteEnvConfig updateBean() { public DesignerWorkspaceInfo updateBean() {
RemoteEnvConfig config = new RemoteEnvConfig();
config.setHost(hostTextField.getText()); DesignerWorkspaceInfo config = new DesignerWorkspaceInfo();
config.setPort((int) portTextField.getValue()); WorkspaceConnection connection = new WorkspaceConnection(hostTextField.getText(), (int) portTextField.getValue(), usernameTextField.getText(), passwordTextField.getText());
config.setUsername(usernameTextField.getText()); config.setConnection(connection);
config.setPassword(passwordTextField.getText()); config.setType(DesignerWorkspaceType.Remote);
return config; return config;
} }
} }

334
designer-base/src/com/fr/env/RemoteEnvUtils.java vendored

@ -1,167 +1,167 @@
package com.fr.env; //package com.fr.env;
//
import com.fr.base.EnvException; //import com.fr.base.EnvException;
import com.fr.base.FRContext; //import com.fr.base.FRContext;
import com.fr.report.DesignAuthority; //import com.fr.report.DesignAuthority;
import com.fr.report.util.AuthorityXMLUtils; //import com.fr.report.util.AuthorityXMLUtils;
import com.fr.stable.EncodeConstants; //import com.fr.stable.EncodeConstants;
import com.fr.third.org.apache.commons.io.IOUtils; //import com.fr.third.org.apache.commons.io.IOUtils;
import com.fr.third.org.apache.http.HttpResponse; //import com.fr.third.org.apache.http.HttpResponse;
import com.fr.third.org.apache.http.HttpStatus; //import com.fr.third.org.apache.http.HttpStatus;
import com.fr.third.org.apache.http.client.ClientProtocolException; //import com.fr.third.org.apache.http.client.ClientProtocolException;
import com.fr.third.org.apache.http.client.ResponseHandler; //import com.fr.third.org.apache.http.client.ResponseHandler;
import com.fr.third.org.apache.http.client.methods.HttpUriRequest; //import com.fr.third.org.apache.http.client.methods.HttpUriRequest;
import com.fr.third.org.apache.http.client.methods.RequestBuilder; //import com.fr.third.org.apache.http.client.methods.RequestBuilder;
import com.fr.third.org.apache.http.entity.ContentType; //import com.fr.third.org.apache.http.entity.ContentType;
import com.fr.third.org.apache.http.entity.InputStreamEntity; //import com.fr.third.org.apache.http.entity.InputStreamEntity;
import com.fr.third.org.apache.http.impl.client.CloseableHttpClient; //import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
import com.fr.third.org.apache.http.impl.client.HttpClients; //import com.fr.third.org.apache.http.impl.client.HttpClients;
//
import java.io.ByteArrayInputStream; //import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; //import java.io.ByteArrayOutputStream;
import java.io.IOException; //import java.io.IOException;
import java.io.InputStream; //import java.io.InputStream;
import java.net.URLEncoder; //import java.net.URLEncoder;
import java.util.Map; //import java.util.Map;
//
public class RemoteEnvUtils { //public class RemoteEnvUtils {
//
private RemoteEnvUtils() { // private RemoteEnvUtils() {
} // }
//
private static ResponseHandler<InputStream> responseHandler = new ResponseHandler<InputStream>() { // private static ResponseHandler<InputStream> responseHandler = new ResponseHandler<InputStream>() {
@Override // @Override
public InputStream handleResponse(HttpResponse response) throws IOException { // public InputStream handleResponse(HttpResponse response) throws IOException {
int statusCode = response.getStatusLine().getStatusCode(); // int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) { // if (statusCode != HttpStatus.SC_OK) {
throw new ClientProtocolException("Method failed: " + response.getStatusLine().toString()); // throw new ClientProtocolException("Method failed: " + response.getStatusLine().toString());
} // }
InputStream in = response.getEntity().getContent(); // InputStream in = response.getEntity().getContent();
if (in == null) { // if (in == null) {
return null; // return null;
} // }
// 读取并返回 // // 读取并返回
ByteArrayOutputStream out = new ByteArrayOutputStream(); // ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, out); // IOUtils.copy(in, out);
return new ByteArrayInputStream(out.toByteArray()); // return new ByteArrayInputStream(out.toByteArray());
} // }
}; // };
//
public static InputStream simulateRPCByHttpPost(byte[] bytes, Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException { // public static InputStream simulateRPCByHttpPost(byte[] bytes, Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
String path = env.getPath(); // String path = env.getPath();
RequestBuilder builder = RequestBuilder.post(path); // RequestBuilder builder = RequestBuilder.post(path);
//
InputStream inputStream = null; // InputStream inputStream = null;
//
for (Map.Entry<String, String> entry : parameters.entrySet()) { // for (Map.Entry<String, String> entry : parameters.entrySet()) {
builder.addParameter(entry.getKey(), entry.getValue()); // builder.addParameter(entry.getKey(), entry.getValue());
} // }
if (!isSignIn) { // if (!isSignIn) {
builder.addParameter("id", env.getUserID()); // builder.addParameter("id", env.getUserID());
} // }
InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(bytes)); // InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(bytes));
//
try (CloseableHttpClient httpClient = HttpClients.createSystem()) { // try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = builder // HttpUriRequest request = builder
.setEntity(reqEntity) // .setEntity(reqEntity)
.build(); // .build();
inputStream = httpClient.execute(request, responseHandler); // inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) { // } catch (IOException e) {
FRContext.getLogger().error(e.getMessage()); // FRContext.getLogger().error(e.getMessage());
} // }
return inputStream; // return inputStream;
} // }
//
public static InputStream simulateRPCByHttpPost(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException { // public static InputStream simulateRPCByHttpPost(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
String path = env.getPath(); // String path = env.getPath();
RequestBuilder builder = RequestBuilder.post(path); // RequestBuilder builder = RequestBuilder.post(path);
//
InputStream inputStream = null; // InputStream inputStream = null;
//
for (Map.Entry<String, String> entry : parameters.entrySet()) { // for (Map.Entry<String, String> entry : parameters.entrySet()) {
builder.addParameter(entry.getKey(), entry.getValue()); // builder.addParameter(entry.getKey(), entry.getValue());
} // }
if (!isSignIn) { // if (!isSignIn) {
builder.addParameter("id", env.getUserID()); // builder.addParameter("id", env.getUserID());
} // }
//
try (CloseableHttpClient httpClient = HttpClients.createSystem()) { // try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = builder // HttpUriRequest request = builder
.build(); // .build();
inputStream = httpClient.execute(request, responseHandler); // inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) { // } catch (IOException e) {
FRContext.getLogger().error(e.getMessage()); // FRContext.getLogger().error(e.getMessage());
} // }
return inputStream; // return inputStream;
} // }
//
public static InputStream simulateRPCByHttpGet(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException { // public static InputStream simulateRPCByHttpGet(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
String path = env.getPath(); // String path = env.getPath();
RequestBuilder builder = RequestBuilder.get(path); // RequestBuilder builder = RequestBuilder.get(path);
//
InputStream inputStream = null; // InputStream inputStream = null;
//
for (Map.Entry<String, String> entry : parameters.entrySet()) { // for (Map.Entry<String, String> entry : parameters.entrySet()) {
builder.addParameter(entry.getKey(), entry.getValue()); // builder.addParameter(entry.getKey(), entry.getValue());
} // }
if (!isSignIn) { // if (!isSignIn) {
builder.addParameter("id", env.getUserID()); // builder.addParameter("id", env.getUserID());
} // }
try (CloseableHttpClient httpClient = HttpClients.createSystem()) { // try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = builder.build(); // HttpUriRequest request = builder.build();
inputStream = httpClient.execute(request, responseHandler); // inputStream = httpClient.execute(request, responseHandler);
//
} catch (IOException e) { // } catch (IOException e) {
FRContext.getLogger().error(e.getMessage()); // FRContext.getLogger().error(e.getMessage());
} // }
return inputStream; // return inputStream;
} // }
//
//
public static InputStream updateAuthorities(DesignAuthority[] authorities, RemoteEnv env) { // public static InputStream updateAuthorities(DesignAuthority[] authorities, RemoteEnv env) {
String path = env.getPath(); // String path = env.getPath();
// 远程设计临时用户id // // 远程设计临时用户id
String userID = env.getUserID(); // String userID = env.getUserID();
InputStream inputStream = null; // InputStream inputStream = null;
//
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
AuthorityXMLUtils.writeDesignAuthoritiesXML(authorities, outputStream); // AuthorityXMLUtils.writeDesignAuthoritiesXML(authorities, outputStream);
InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(outputStream.toByteArray()), ContentType.TEXT_XML); // InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(outputStream.toByteArray()), ContentType.TEXT_XML);
//
try (CloseableHttpClient httpClient = HttpClients.createSystem()) { // try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = RequestBuilder.post(path) // HttpUriRequest request = RequestBuilder.post(path)
.addParameter("id", userID) // .addParameter("id", userID)
.addParameter("op", "remote_design_authority") // .addParameter("op", "remote_design_authority")
.addParameter("cmd", "update_authorities") // .addParameter("cmd", "update_authorities")
.setEntity(reqEntity) // .setEntity(reqEntity)
.build(); // .build();
inputStream = httpClient.execute(request, responseHandler); // inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) { // } catch (IOException e) {
FRContext.getLogger().error(e.getMessage()); // FRContext.getLogger().error(e.getMessage());
} // }
//
return inputStream; // return inputStream;
//
} // }
//
public static InputStream getAuthorities(RemoteEnv env) throws EnvException { // public static InputStream getAuthorities(RemoteEnv env) throws EnvException {
String path = env.getPath(); // String path = env.getPath();
// 远程设计临时用户id // // 远程设计临时用户id
String userID = env.getUserID(); // String userID = env.getUserID();
InputStream inputStream = null; // InputStream inputStream = null;
//
try (CloseableHttpClient httpClient = HttpClients.createSystem();) { // try (CloseableHttpClient httpClient = HttpClients.createSystem();) {
HttpUriRequest request = RequestBuilder.get(path) // HttpUriRequest request = RequestBuilder.get(path)
.addParameter("id", userID) // .addParameter("id", userID)
.addParameter("op", "remote_design_authority") // .addParameter("op", "remote_design_authority")
.addParameter("cmd", "get_authorities") // .addParameter("cmd", "get_authorities")
.build(); // .build();
inputStream = httpClient.execute(request, responseHandler); // inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) { // } catch (IOException e) {
FRContext.getLogger().error(e.getMessage()); // FRContext.getLogger().error(e.getMessage());
} // }
return inputStream; // return inputStream;
} // }
//
//
} //}

6
designer-base/src/com/fr/start/ServerStarter.java

@ -11,7 +11,6 @@ import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -37,8 +36,9 @@ public class ServerStarter {
*/ */
public static void browserDemoURL() { public static void browserDemoURL() {
if (FRContext.getCurrentEnv() instanceof RemoteEnv) { if (!WorkContext.getCurrent().isLocal()) {
browser(FRContext.getCurrentEnv().getPath()); //有问题,这里拿不到远程的http端口
browser(WorkContext.getCurrent().getPath());
return; return;
} }
if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用 if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用

4
designer-realize/src/com/fr/design/mainframe/JWorkBook.java

@ -62,7 +62,6 @@ import com.fr.design.selection.QuickEditor;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane; import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.design.write.submit.SmartInsertDBManipulationPane; import com.fr.design.write.submit.SmartInsertDBManipulationPane;
import com.fr.env.RemoteEnv;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
@ -93,6 +92,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.module.Module; import com.fr.stable.module.Module;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.web.controller.ViewRequestConstants; import com.fr.web.controller.ViewRequestConstants;
import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -634,7 +634,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public ShortCut[] shortcut4FileMenu() { public ShortCut[] shortcut4FileMenu() {
return (ShortCut[]) ArrayUtils.addAll( return (ShortCut[]) ArrayUtils.addAll(
super.shortcut4FileMenu(), super.shortcut4FileMenu(),
BaseUtils.isAuthorityEditing() || (FRContext.getCurrentEnv() instanceof RemoteEnv) ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()} BaseUtils.isAuthorityEditing() || (!WorkContext.getCurrent().isLocal()) ? new ShortCut[0] : new ShortCut[]{this.createWorkBookExportMenu()}
); );
} }

8
designer-realize/src/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java

@ -1,14 +1,13 @@
package com.fr.design.mainframe.alphafine.cell.model; package com.fr.design.mainframe.alphafine.cell.model;
import com.fr.base.FRContext;
import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
import com.fr.design.mainframe.alphafine.CellType; import com.fr.design.mainframe.alphafine.CellType;
import com.fr.env.RemoteEnv;
import com.fr.log.FineLoggerFactory;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
/** /**
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
@ -106,7 +105,8 @@ public class PluginModel extends AlphaCellModel {
@Override @Override
public void doAction() { public void doAction() {
if (StringUtils.isBlank(this.pluginId) || FRContext.getCurrentEnv() instanceof RemoteEnv) {
if (StringUtils.isBlank(this.pluginId) || !WorkContext.getCurrent().isLocal()) {
return; return;
} }
WebViewDlgHelper.showPluginInStore(getName(), "[" + ModelToJson().optString("result") + "]"); WebViewDlgHelper.showPluginInStore(getName(), "[" + ModelToJson().optString("result") + "]");

20
designer-realize/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -1,13 +1,5 @@
package com.fr.design.report.freeze; package com.fr.design.report.freeze;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.extra.WebViewDlgHelper;
@ -15,12 +7,19 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.env.RemoteEnv;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.page.ReportPageAttrProvider; import com.fr.page.ReportPageAttrProvider;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.FT; import com.fr.stable.FT;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Sets Report Page Attributes * Sets Report Page Attributes
@ -244,7 +243,8 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
} }
private boolean shouldShowTip() { private boolean shouldShowTip() {
return !(FRContext.getCurrentEnv() instanceof RemoteEnv) && FRContext.isChineseEnv();
return WorkContext.getCurrent().isLocal() && FRContext.isChineseEnv();
} }
protected void initWriteListener() { protected void initWriteListener() {

322
designer-realize/src/com/fr/start/module/DesignerEnvProvider.java

@ -1,27 +1,11 @@
package com.fr.start.module; package com.fr.start.module;
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.serializer.OldSerializerAdapter;
import com.fr.base.env.serializer.ProcedureDataModelSerializer;
import com.fr.core.env.proxy.EnvProxy;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection;
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.DesignerEnvManager;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.EnvSwitcher; import com.fr.start.EnvSwitcher;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import java.io.InputStream;
import java.io.OutputStream;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
* 设计器启动时的环境相关模块activator * 设计器启动时的环境相关模块activator
@ -54,159 +38,159 @@ public class DesignerEnvProvider extends Activator {
private void addSerializers() { private void addSerializers() {
EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer()); // EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer());
//
EnvProxy.addSerializer(ModifiedTable.class, new OldSerializerAdapter<ModifiedTable>( // EnvProxy.addSerializer(ModifiedTable.class, new OldSerializerAdapter<ModifiedTable>(
new OldSerializerAdapter.OldSerializer<ModifiedTable>() { // new OldSerializerAdapter.OldSerializer<ModifiedTable>() {
//
@Override // @Override
public void serializer(ModifiedTable obj, OutputStream out) throws Exception { // public void serializer(ModifiedTable obj, OutputStream out) throws Exception {
//
DavXMLUtils.writeXMLModifiedTables(obj, out); // DavXMLUtils.writeXMLModifiedTables(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<ModifiedTable>() { // new OldSerializerAdapter.OldDeserializer<ModifiedTable>() {
//
@Override // @Override
public ModifiedTable deserializer(InputStream in) throws Exception { // public ModifiedTable deserializer(InputStream in) throws Exception {
//
return DavXMLUtils.readXMLModifiedTables(in); // return DavXMLUtils.readXMLModifiedTables(in);
} // }
} // }
)); // ));
//
EnvProxy.addSerializer(com.fr.data.impl.Connection.class, new OldSerializerAdapter<com.fr.data.impl.Connection>( // EnvProxy.addSerializer(com.fr.data.impl.Connection.class, new OldSerializerAdapter<com.fr.data.impl.Connection>(
new OldSerializerAdapter.OldSerializer<Connection>() { // new OldSerializerAdapter.OldSerializer<Connection>() {
//
@Override // @Override
public void serializer(Connection obj, OutputStream out) { // public void serializer(Connection obj, OutputStream out) {
//
DavXMLUtils.writeXMLFileDatabaseConnection(obj, out); // DavXMLUtils.writeXMLFileDatabaseConnection(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<Connection>() { // new OldSerializerAdapter.OldDeserializer<Connection>() {
//
@Override // @Override
public Connection deserializer(InputStream in) throws Exception { // public Connection deserializer(InputStream in) throws Exception {
//
return DavXMLUtils.readXMLDatabaseConnection(in); // return DavXMLUtils.readXMLDatabaseConnection(in);
} // }
} // }
)); // ));
//
EnvProxy.addSerializer(FileNode[].class, new OldSerializerAdapter<FileNode[]>( // EnvProxy.addSerializer(FileNode[].class, new OldSerializerAdapter<FileNode[]>(
new OldSerializerAdapter.OldSerializer<FileNode[]>() { // new OldSerializerAdapter.OldSerializer<FileNode[]>() {
//
@Override // @Override
public void serializer(FileNode[] obj, OutputStream out) { // public void serializer(FileNode[] obj, OutputStream out) {
//
DavXMLUtils.writeXMLFileNodes(obj, out); // DavXMLUtils.writeXMLFileNodes(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<FileNode[]>() { // new OldSerializerAdapter.OldDeserializer<FileNode[]>() {
//
@Override // @Override
public FileNode[] deserializer(InputStream in) { // public FileNode[] deserializer(InputStream in) {
//
return DavXMLUtils.readXMLFileNodes(in); // return DavXMLUtils.readXMLFileNodes(in);
} // }
} // }
)); // ));
//
EnvProxy.addSerializer(TableProcedure[].class, new OldSerializerAdapter<TableProcedure[]>( // EnvProxy.addSerializer(TableProcedure[].class, new OldSerializerAdapter<TableProcedure[]>(
new OldSerializerAdapter.OldSerializer<TableProcedure[]>() { // new OldSerializerAdapter.OldSerializer<TableProcedure[]>() {
//
@Override // @Override
public void serializer(TableProcedure[] obj, OutputStream out) { // public void serializer(TableProcedure[] obj, OutputStream out) {
//
DavXMLUtils.writeXMLFileSQLTable(obj, out); // DavXMLUtils.writeXMLFileSQLTable(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<TableProcedure[]>() { // new OldSerializerAdapter.OldDeserializer<TableProcedure[]>() {
//
@Override // @Override
public TableProcedure[] deserializer(InputStream in) throws Exception { // public TableProcedure[] deserializer(InputStream in) throws Exception {
//
return DavXMLUtils.readXMLSQLTables(in); // return DavXMLUtils.readXMLSQLTables(in);
} // }
} // }
)); // ));
//
EnvProxy.addSerializer(TableData.class, new OldSerializerAdapter<TableData>( // EnvProxy.addSerializer(TableData.class, new OldSerializerAdapter<TableData>(
new OldSerializerAdapter.OldSerializer<TableData>() { // new OldSerializerAdapter.OldSerializer<TableData>() {
//
@Override // @Override
public void serializer(TableData obj, OutputStream out) { // public void serializer(TableData obj, OutputStream out) {
//
DavXMLUtils.writeXMLFileTableData(obj, out); // DavXMLUtils.writeXMLFileTableData(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<TableData>() { // new OldSerializerAdapter.OldDeserializer<TableData>() {
//
@Override // @Override
public TableData deserializer(InputStream in) throws Exception { // public TableData deserializer(InputStream in) throws Exception {
//
return DavXMLUtils.readXMLTableData(in); // return DavXMLUtils.readXMLTableData(in);
} // }
} // }
)); // ));
//
EnvProxy.addSerializer(Parameter[].class, new OldSerializerAdapter<Parameter[]>( // EnvProxy.addSerializer(Parameter[].class, new OldSerializerAdapter<Parameter[]>(
new OldSerializerAdapter.OldSerializer<Parameter[]>() { // new OldSerializerAdapter.OldSerializer<Parameter[]>() {
//
@Override // @Override
public void serializer(Parameter[] obj, OutputStream out) { // public void serializer(Parameter[] obj, OutputStream out) {
//
DavXMLUtils.writeXMLFileParameters(obj, out); // DavXMLUtils.writeXMLFileParameters(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<Parameter[]>() { // new OldSerializerAdapter.OldDeserializer<Parameter[]>() {
//
@Override // @Override
public Parameter[] deserializer(InputStream in) throws Exception { // public Parameter[] deserializer(InputStream in) throws Exception {
//
return DavXMLUtils.readXMLParameters(in); // return DavXMLUtils.readXMLParameters(in);
} // }
} // }
)); // ));
//
EnvProxy.addSerializer(StoreProcedure.class, new OldSerializerAdapter<StoreProcedure>( // EnvProxy.addSerializer(StoreProcedure.class, new OldSerializerAdapter<StoreProcedure>(
new OldSerializerAdapter.OldSerializer<StoreProcedure>() { // new OldSerializerAdapter.OldSerializer<StoreProcedure>() {
//
@Override // @Override
public void serializer(StoreProcedure obj, OutputStream out) { // public void serializer(StoreProcedure obj, OutputStream out) {
//
DavXMLUtils.writeXMLFileStoreProcedure(obj, out); // DavXMLUtils.writeXMLFileStoreProcedure(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<StoreProcedure>() { // new OldSerializerAdapter.OldDeserializer<StoreProcedure>() {
//
@Override // @Override
public StoreProcedure deserializer(InputStream in) throws Exception { // public StoreProcedure deserializer(InputStream in) throws Exception {
//
return DavXMLUtils.readXMLStoreProcedure(in); // return DavXMLUtils.readXMLStoreProcedure(in);
} // }
} // }
)); // ));
//
EnvProxy.addSerializer(StoreProcedureParameter[].class, new OldSerializerAdapter<StoreProcedureParameter[]>( // EnvProxy.addSerializer(StoreProcedureParameter[].class, new OldSerializerAdapter<StoreProcedureParameter[]>(
new OldSerializerAdapter.OldSerializer<StoreProcedureParameter[]>() { // new OldSerializerAdapter.OldSerializer<StoreProcedureParameter[]>() {
//
@Override // @Override
public void serializer(StoreProcedureParameter[] obj, OutputStream out) { // public void serializer(StoreProcedureParameter[] obj, OutputStream out) {
//
DavXMLUtils.writeXMLFileParameters(obj, out); // DavXMLUtils.writeXMLFileParameters(obj, out);
} // }
}, // },
new OldSerializerAdapter.OldDeserializer<StoreProcedureParameter[]>() { // new OldSerializerAdapter.OldDeserializer<StoreProcedureParameter[]>() {
//
@Override // @Override
public StoreProcedureParameter[] deserializer(InputStream in) throws Exception { // public StoreProcedureParameter[] deserializer(InputStream in) throws Exception {
//
return DavXMLUtils.readXMLStoreProcedureParameters(in); // return DavXMLUtils.readXMLStoreProcedureParameters(in);
} // }
} // }
)); // ));
} }
@Override @Override

12
designer-realize/src/com/fr/start/module/DesignerStartup.java

@ -1,7 +1,5 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.base.env.EnvConfig;
import com.fr.core.env.EnvEvent;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.module.Activator; import com.fr.module.Activator;
@ -9,6 +7,8 @@ import com.fr.start.Designer;
import com.fr.start.EnvSwitcher; import com.fr.start.EnvSwitcher;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.startup.activators.BasicActivator; import com.fr.startup.activators.BasicActivator;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
/** /**
* Created by juhaoyu on 2018/1/8. * Created by juhaoyu on 2018/1/8.
@ -39,18 +39,18 @@ public class DesignerStartup extends Activator {
*/ */
private void registerEnvListener() { private void registerEnvListener() {
listenEvent(EnvEvent.BEFORE_SIGN_OUT, new Listener<EnvConfig>() { listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>() {
@Override @Override
public void on(Event event, EnvConfig param) { public void on(Event event, Workspace param) {
getSub(EnvBasedModule.class).stop(); getSub(EnvBasedModule.class).stop();
} }
}); });
listenEvent(EnvEvent.AFTER_SIGN_IN, new Listener<EnvConfig>() { listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override @Override
public void on(Event event, EnvConfig param) { public void on(Event event, Workspace param) {
getSub(EnvBasedModule.class).start(); getSub(EnvBasedModule.class).start();
} }

Loading…
Cancel
Save