Browse Source

远程设计插件信息获取问题1/3

master
vito 9 years ago
parent
commit
4d5eb1708c
  1. 48
      designer_base/src/com/fr/env/RemoteEnv.java

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

@ -28,6 +28,8 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.stable.*; import com.fr.stable.*;
import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.file.XMLFileManagerProvider;
@ -2044,25 +2046,45 @@ public class RemoteEnv implements Env {
} }
public InputStream readPluginConfig() throws Exception { private void readPlugins() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "design_get_plugin_info"); para.put("cmd", "design_plugins");
InputStream inputStream = postBytes2ServerB(out.toByteArray(), para);
String pluginsStr = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
if(StringUtils.isNotBlank(pluginsStr) && pluginsStr.startsWith("[")){
JSONArray jsonArray = new JSONArray(pluginsStr);
for (int i = 0; i < jsonArray.length(); i++) {
Plugin plugin = new Plugin();
plugin.parseJSON(jsonArray.getJSONObject(i));
PluginLoader.getLoader().addRemotePlugin(plugin);
}
}
}
return postBytes2ServerB(out.toByteArray(), para); private void readPluginLicenses() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_plugin_licenses");
InputStream inputStream = postBytes2ServerB(out.toByteArray(), para);
String pluginsLicensesStr = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
if(StringUtils.isNotBlank(pluginsLicensesStr) && pluginsLicensesStr.startsWith("[")) {
JSONArray jsonArray = new JSONArray(pluginsLicensesStr);
for (int i = 0; i < jsonArray.length(); i++) {
PluginLicense pluginLicense = new PluginLicense();
pluginLicense.parseJSON(jsonArray.getJSONObject(i));
PluginLicenseManager.getInstance().addRemotePluginLicense(pluginLicense);
}
}
} }
/**
* 远程设计先不需要检测MD5
*
* @return 是否正确
* @throws Exception MD5算法异常
*/
@Override @Override
public boolean isTruePluginMD5(Plugin plugin, File file) throws Exception { public void readPluginConfig() throws Exception {
return true; readPlugins();
readPluginLicenses();
} }
} }
Loading…
Cancel
Save