|
|
@ -9,6 +9,7 @@ import com.fr.base.remote.RemoteDeziConstants; |
|
|
|
import com.fr.common.rpc.RemoteCallServerConfig; |
|
|
|
import com.fr.common.rpc.RemoteCallServerConfig; |
|
|
|
import com.fr.common.rpc.netty.MessageSendExecutor; |
|
|
|
import com.fr.common.rpc.netty.MessageSendExecutor; |
|
|
|
import com.fr.common.rpc.netty.RemoteCallClient; |
|
|
|
import com.fr.common.rpc.netty.RemoteCallClient; |
|
|
|
|
|
|
|
import com.fr.core.env.EnvConstants; |
|
|
|
import com.fr.core.env.EnvContext; |
|
|
|
import com.fr.core.env.EnvContext; |
|
|
|
import com.fr.data.impl.storeproc.StoreProcedure; |
|
|
|
import com.fr.data.impl.storeproc.StoreProcedure; |
|
|
|
import com.fr.dav.AbstractEnv; |
|
|
|
import com.fr.dav.AbstractEnv; |
|
|
@ -22,7 +23,6 @@ import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.EnvProxyFactory; |
|
|
|
import com.fr.general.EnvProxyFactory; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.general.http.HttpToolbox; |
|
|
|
import com.fr.general.http.HttpToolbox; |
|
|
|
import com.fr.io.utils.ResourceIOUtils; |
|
|
|
import com.fr.io.utils.ResourceIOUtils; |
|
|
|
import com.fr.json.JSONArray; |
|
|
|
import com.fr.json.JSONArray; |
|
|
@ -34,18 +34,16 @@ import com.fr.share.ShareConstants; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.Filter; |
|
|
|
import com.fr.stable.Filter; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.stable.ProductConstants; |
|
|
|
import com.fr.stable.ProductConstants; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.SvgProvider; |
|
|
|
import com.fr.stable.SvgProvider; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.third.guava.base.Strings; |
|
|
|
import com.fr.third.guava.base.Strings; |
|
|
|
import com.fr.third.guava.collect.ImmutableMap; |
|
|
|
import com.fr.third.guava.collect.ImmutableMap; |
|
|
|
import com.fr.web.ResourceConstants; |
|
|
|
import com.fr.web.ResourceConstants; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.xml.transform.Source; |
|
|
|
import javax.xml.transform.Source; |
|
|
|
import javax.xml.transform.Transformer; |
|
|
|
import javax.xml.transform.Transformer; |
|
|
|
import javax.xml.transform.TransformerConfigurationException; |
|
|
|
import javax.xml.transform.TransformerConfigurationException; |
|
|
@ -53,7 +51,6 @@ import javax.xml.transform.TransformerException; |
|
|
|
import javax.xml.transform.TransformerFactory; |
|
|
|
import javax.xml.transform.TransformerFactory; |
|
|
|
import javax.xml.transform.dom.DOMSource; |
|
|
|
import javax.xml.transform.dom.DOMSource; |
|
|
|
import javax.xml.transform.stream.StreamResult; |
|
|
|
import javax.xml.transform.stream.StreamResult; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
@ -68,6 +65,8 @@ import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.fr.third.guava.base.Preconditions.checkArgument; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author null |
|
|
|
* @author null |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -254,12 +253,7 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean testServerConnectionWithOutShowMessagePane() throws Exception { |
|
|
|
public boolean testServerConnectionWithOutShowMessagePane() throws Exception { |
|
|
|
try { |
|
|
|
return testConnection(false, true, DesignerContext.getDesignerFrame()); |
|
|
|
connectOnce(); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -270,15 +264,55 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut |
|
|
|
* @throws Exception 异常 |
|
|
|
* @throws Exception 异常 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean testConnectionWithOutRegisteServer(Component messageParentPane) throws Exception { |
|
|
|
public boolean testConnectionWithOutRegisteServer(Component messageParentPane) throws Exception { |
|
|
|
try { |
|
|
|
return testConnection(true, false, messageParentPane); |
|
|
|
connectOnce(); |
|
|
|
} |
|
|
|
return true; |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(messageParentPane, Inter.getLocText("Datasource-Connection_failed")); |
|
|
|
private boolean testConnection(boolean needMessage, boolean isRegisteServer, Component parentComponent) throws Exception { |
|
|
|
|
|
|
|
checkArgument(parentComponent instanceof Component, "parentComponent should be a java.awt.component"); |
|
|
|
|
|
|
|
Component component = parentComponent; |
|
|
|
|
|
|
|
String url = String.format("%s/connection", EnvConstants.toDecisionPath(getPath())); |
|
|
|
|
|
|
|
ImmutableMap<String, Object> params = ImmutableMap.of( |
|
|
|
|
|
|
|
"version", (Object) ProductConstants.DESIGNER_VERSION |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
ImmutableMap<String, String> headers = ImmutableMap.of( |
|
|
|
|
|
|
|
EnvConstants.USERNAME, getUser(), |
|
|
|
|
|
|
|
EnvConstants.PWD, getPassword()); |
|
|
|
|
|
|
|
String res = HttpToolbox.post(url, params, headers); |
|
|
|
|
|
|
|
if (Strings.isNullOrEmpty(res)) { |
|
|
|
|
|
|
|
if (needMessage) { |
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(component, Inter.getLocText("Datasource-Connection_failed")); |
|
|
|
|
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
} else if (ComparatorUtils.equals(res, "true")) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(res, EnvConstants.AUTH_ERROR)) { |
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(component, |
|
|
|
|
|
|
|
Inter.getLocText(new String[]{"Datasource-Connection_failed", "Registration-User_Name", "Password", "Error"}, new String[]{",", "", "", "!"}) |
|
|
|
|
|
|
|
, Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(res, EnvConstants.WAR_ERROR)) { |
|
|
|
|
|
|
|
if (needMessage) { |
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(component, Inter.getLocText(new String[]{"Datasource-Connection_failed", "NS-war-remote"}, new String[]{",", "!"})); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Datasource-Connection_failed", "NS-war-remote"}, new String[]{",", "!"})); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (needMessage) { |
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(component, Inter.getLocText("Datasource-Connection_failed")); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"})); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void refreshHttpSProperty() { |
|
|
|
private void refreshHttpSProperty() { |
|
|
|
if (getPath().startsWith(HTTPS_PREFIX) && System.getProperty(CERT_KEY) == null) { |
|
|
|
if (getPath().startsWith(HTTPS_PREFIX) && System.getProperty(CERT_KEY) == null) { |
|
|
|
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); |
|
|
|
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); |
|
|
@ -543,7 +577,8 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String getWebReportPath() { |
|
|
|
public String getWebReportPath() { |
|
|
|
return getPath().substring(0, getPath().lastIndexOf("/")); |
|
|
|
|
|
|
|
|
|
|
|
return StableUtils.pathJoin(getPath(), getAppName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String[] getProcedureColumns(StoreProcedure storeProcedure, Map parameterMap) throws Exception { |
|
|
|
public String[] getProcedureColumns(StoreProcedure storeProcedure, Map parameterMap) throws Exception { |
|
|
|