From c5c1cea90b1a0fbcfaa210b22aecbeb33a58b0dc Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 12 Sep 2016 10:26:47 +0800 Subject: [PATCH] update --- .../com/fr/dependservice/PluginService.java | 37 ------------------- .../fr/dependservice/PluginServiceUtils.java | 18 --------- designer_base/src/com/fr/env/RemoteEnv.java | 21 ++++++++--- 3 files changed, 16 insertions(+), 60 deletions(-) delete mode 100644 designer_base/src/com/fr/dependservice/PluginService.java delete mode 100644 designer_base/src/com/fr/dependservice/PluginServiceUtils.java diff --git a/designer_base/src/com/fr/dependservice/PluginService.java b/designer_base/src/com/fr/dependservice/PluginService.java deleted file mode 100644 index 0ba4895cb0..0000000000 --- a/designer_base/src/com/fr/dependservice/PluginService.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.dependservice; - -import com.fr.base.FRContext; -import com.fr.general.FRLogger; -import com.fr.plugin.dependence.PluginServiceCreator; - -import java.util.HashMap; - -/** - * Created by hufan on 2016/9/9. - */ -public abstract class PluginService implements PluginServiceCreator { - @Override - public String remoteServiceAction(String req) throws Exception { - HashMap para = new HashMap(); - para.put("op", "fr_remote_design"); - para.put("cmd", "design_get_plugin_service_data"); - para.put("serviceID", getServiceID()); - para.put("req", req); - return PluginServiceUtils.getDataFormRemote(para); - } - /** - * 服务ID - * @return - */ - protected abstract String getServiceID(); - - /** - * 获取数据 - * @param req - * @return - */ - @Override - public String fetchServiceData(String req) throws Exception { - return FRContext.getCurrentEnv().pluginServiceAction(this, req); - } -} diff --git a/designer_base/src/com/fr/dependservice/PluginServiceUtils.java b/designer_base/src/com/fr/dependservice/PluginServiceUtils.java deleted file mode 100644 index b5304aa725..0000000000 --- a/designer_base/src/com/fr/dependservice/PluginServiceUtils.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fr.dependservice; - -import com.fr.base.FRContext; -import com.fr.env.RemoteEnv; -import com.fr.general.IOUtils; - -import java.io.InputStream; -import java.util.HashMap; - -/** - * Created by hufan on 2016/9/9. - */ -public class PluginServiceUtils { - public static String getDataFormRemote(HashMap para) throws Exception { - InputStream inputStream = ((RemoteEnv)FRContext.getCurrentEnv()).getDataFormRemote(para); - return IOUtils.inputStream2String(inputStream); - } -} diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 927743012a..3085991d43 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -32,6 +32,7 @@ import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginLoader; import com.fr.plugin.dependence.PluginServiceCreator; +import com.fr.plugin.dependence.PluginServiceManager; import com.fr.stable.*; import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.project.ProjectConstants; @@ -2081,16 +2082,26 @@ public class RemoteEnv implements Env { } @Override - public String pluginServiceAction(PluginServiceCreator service, String req) throws Exception { - return service.remoteServiceAction(req); + public String pluginServiceAction(String serviceID, String req) throws Exception { + PluginServiceCreator service = PluginServiceManager.getService(serviceID); + if (service == null){ + return null; + } + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_get_plugin_service_data"); + para.put("serviceID", service.getServiceID()); + para.put("req", req); + InputStream inputStream = getDataFormRemote(para); + return IOUtils.inputStream2String(inputStream); } /** * 远程不启动,使用虚拟服务 - * @param service + * @param serviceID */ @Override - public void pluginServiceStart(PluginServiceCreator service){ + public void pluginServiceStart(String serviceID){ } @Override @@ -2105,7 +2116,7 @@ public class RemoteEnv implements Env { * @return * @throws Exception */ - public InputStream getDataFormRemote(HashMap para) throws Exception { + private InputStream getDataFormRemote(HashMap para) throws Exception { HttpClient client = createHttpMethod(para); //jim :加上user,远程设计点击预览时传递用户角色信息 return execute4InputStream(client); }