Browse Source

连接远程env插件加载接口

master
neil 8 years ago
parent
commit
50bc517864
  1. 14
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  2. 24
      designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java
  3. 18
      designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java
  4. 14
      designer_base/src/com/fr/env/RemoteEnv.java

14
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -124,6 +124,18 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private Set<HyperlinkProvider> hyperlinkGroupProviders;
private DesignerEnvProcessor envProcessor;
public DesignerEnvProcessor getEnvProcessor() {
return envProcessor;
}
public void setEnvProcessor(Level level, PluginSimplify simplify) throws Exception {
validAPILevel(level, DesignerEnvProcessor.CURRENT_LEVEL, simplify.getPluginName());
envProcessor = (DesignerEnvProcessor) level;
}
public void addSupportDesignApps(Level level, PluginSimplify simplify) throws Exception {
validAPILevel(level, App.CURRENT_LEVEL, simplify.getPluginName());
App provider = (App) level;
@ -783,6 +795,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
addHyperlinkProvider(impl, simplify);
} else if (tagName.equals(App.MARK_STRING)) {
addSupportDesignApps(impl, simplify);
} else if (tagName.equals(DesignerEnvProcessor.XML_TAG)) {
setEnvProcessor(impl, simplify);
}
} catch (PluginInvalidLevelException e) {
PluginMessage.remindUpdate(e.getMessage());

24
designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java

@ -0,0 +1,24 @@
package com.fr.design.fun;
import com.fr.stable.fun.Level;
/**
* 在env加载之前, 修改env参数的接口
* : https [需要在加载之前设置系统证书];
* cas [需要动态获取sessionid来修改path]
*
* Created by Administrator on 2016/3/31/0031.
*/
public interface DesignerEnvProcessor extends Level{
String XML_TAG = "DesignerEnvProcessor";
int CURRENT_LEVEL = 1;
/**
* 在远程env连接之前, 修改env的path, 以通过权限认证. 如果之前没有jsessionid, 那么就加上, 如果有了, 就更新成新的.
* : localhost:8080/WebReport/ReportServer? -> localhost:8080/WebReport/ReportServer?jsessionid=abcdegf;
*
* @return 修改后的jsessionid
*/
String changeEnvPathBeforeConnect(String userName, String password, String path);
}

18
designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java

@ -0,0 +1,18 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DesignerEnvProcessor;
/**
* Created by Administrator on 2016/3/31/0031.
*/
public abstract class AbstractDesignerEnvProcessor implements DesignerEnvProcessor {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
public String changeEnvPathBeforeConnect(String userName, String password, String path){
return path;
}
}

14
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -11,8 +11,10 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.dav.DavXMLUtils;
import com.fr.dav.UserBaseEnv;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
@ -26,6 +28,7 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader;
import com.fr.stable.*;
import com.fr.stable.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants;
@ -330,6 +333,8 @@ public class RemoteEnv implements Env {
private boolean testConnection(boolean needMessage, boolean isRegisteServer, Component parentComponent) throws Exception {
extraChangeEnvPara();
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "test_server_connection");
@ -378,6 +383,15 @@ public class RemoteEnv implements Env {
}
}
private void extraChangeEnvPara() {
//在env连接之前, 加载一下不依赖env的插件. 看看需不需要改变参数.
PluginLoader.init();
DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getEnvProcessor();
if (envProcessor != null) {
this.path = envProcessor.changeEnvPathBeforeConnect(user, password, path);
}
}
private void setHttpsParas() {
if (path.startsWith(HTTPS_PREFIX) && System.getProperty(CERT_KEY) == null) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();

Loading…
Cancel
Save