Browse Source

Merge pull request #209 in DESIGN/design from ~HZZZ/design61:release/10.0 to release/10.0

* commit 'c43fb7a7e795b3aa24ced6a01e2a62c0de205c93':
  .
  https
  https
  https
  https
master
Hzzz 7 years ago
parent
commit
af316b95a2
  1. 12
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  2. 15
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  3. 22
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  4. 7
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

12
designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -55,8 +55,10 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
String url = reader.getAttrAsString("url", StringUtils.EMPTY);
String username = reader.getAttrAsString("username", StringUtils.EMPTY);
//密码解密
String password = SecurityToolbox.defaultDecrypt(reader.getAttrAsString("password", StringUtils.EMPTY).replaceAll(" ","\r\n"));
this.connection = new WorkspaceConnection(url, username, password);
String password = SecurityToolbox.defaultDecrypt(reader.getAttrAsString("password", StringUtils.EMPTY).replaceAll(" ", "\r\n"));
String certPath = reader.getAttrAsString("certPath", StringUtils.EMPTY);
String certSecretKey = reader.getAttrAsString("certSecretKey", StringUtils.EMPTY);
this.connection = new WorkspaceConnection(url, username, password, certPath, certSecretKey);
}
}
}
@ -70,6 +72,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
writer.attr("url", connection.getUrl());
writer.attr("username", connection.getUserName());
writer.attr("password", SecurityToolbox.defaultEncrypt(connection.getPassword()));
writer.attr("certPath", connection.getCertPath());
writer.attr("certSecretKey", connection.getCertSecretKey());
writer.end();
}
}
@ -77,9 +81,9 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@Override
public Object clone() throws CloneNotSupportedException {
RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo)super.clone();
RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo) super.clone();
object.connection = (WorkspaceConnection)StableUtils.cloneObject(this.connection);
object.connection = (WorkspaceConnection) StableUtils.cloneObject(this.connection);
return object;
}
}

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

@ -270,8 +270,13 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
: new RemoteEnvURL(connection.getUrl());
String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY);
String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY);
String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY);
String certSecretKey = fromNullable(connection.getCertSecretKey()).or(StringUtils.EMPTY);
this.usernameInput.setText(username);
this.passwordInput.setText(pwd);
this.certPathInput.setText(certPath);
this.certSecretKeyInput.setText(certSecretKey);
}
fillRemoteEnvURLField();
@ -290,7 +295,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
WorkspaceConnection connection = new WorkspaceConnection(
this.remoteEnvURL.getURL(),
this.usernameInput.getText(),
new String(this.passwordInput.getPassword()));
new String(this.passwordInput.getPassword()),
this.certPathInput.getText(),
new String(this.certSecretKeyInput.getPassword()));
return RemoteDesignerWorkspaceInfo.create(connection);
}
@ -478,7 +485,11 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
return WorkContext.getConnector().testConnection(remoteEnv.getConnection());
WorkspaceConnection connection = remoteEnv.getConnection();
DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath());
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
return WorkContext.getConnector().testConnection(connection);
}
@Override

22
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -2,14 +2,11 @@ package com.fr.design.mainframe.socketio;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.env.operator.socket.SocketInfoOperator;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.third.guava.base.Optional;
import com.fr.third.guava.primitives.Ints;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants;
@ -65,24 +62,13 @@ public class DesignerSocketIO {
private static String getSocketUri(Workspace current) throws IOException {
URL url = new URL(current.getPath());
int port = getPort(current);
return String.format("http://%s:%s%s?%s=%s",
int port = WorkContext.getCurrent().get(SocketInfoOperator.class).getPort();
return String.format("%s://%s:%s%s?%s=%s",
url.getProtocol(),
url.getHost(),
port,
WorkspaceConstants.WS_NAMESPACE,
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
RemoteCallClient.getInstance().getToken());
}
private static int getPort(Workspace current) throws IOException {
String url = current.getPath() + WorkspaceConstants.CONTROLLER_PREFIX + WorkspaceConstants.CONTROLLER_SOCKETIO_PORT;
try {
String portStr = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(portStr);
return Ints.tryParse(jsonObject.optString("data"));
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
}

7
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -51,6 +51,8 @@ import com.fr.design.mainframe.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.loghandler.DesignerLogImpl;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.env.operator.socket.FineSocketInfoOperator;
import com.fr.env.operator.socket.SocketInfoOperator;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane;
@ -98,6 +100,8 @@ import com.fr.stable.script.ValueConverter;
import com.fr.stable.xml.ObjectTokenizer;
import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider;
import com.fr.workspace.base.WorkspaceKey;
import com.fr.workspace.pool.WorkPRCRegister;
import com.fr.xml.ReportXMLUtils;
import java.awt.Image;
@ -409,5 +413,8 @@ public class DesignerActivator extends Activator implements Prepare {
public void prepare() {
addMutable(InterMutableKey.Path, "com/fr/design/i18n/main", "com/fr/design/i18n/chart");
addMutable(WorkspaceKey.RPC, WorkPRCRegister.wrap(SocketInfoOperator.class, new FineSocketInfoOperator()));
}
}
Loading…
Cancel
Save