|
|
@ -2114,6 +2114,7 @@ public class RemoteEnv implements Env { |
|
|
|
StableUtils.mkdirs(target); |
|
|
|
StableUtils.mkdirs(target); |
|
|
|
File cacheDir = null; |
|
|
|
File cacheDir = null; |
|
|
|
File zip = null; |
|
|
|
File zip = null; |
|
|
|
|
|
|
|
OutputStream out = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
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"); |
|
|
@ -2122,16 +2123,15 @@ public class RemoteEnv implements Env { |
|
|
|
para.put("currentUsername", this.getUser()); |
|
|
|
para.put("currentUsername", this.getUser()); |
|
|
|
|
|
|
|
|
|
|
|
HttpClient client = createHttpMethod(para); |
|
|
|
HttpClient client = createHttpMethod(para); |
|
|
|
InputStream input = client.getResponseStream(); |
|
|
|
InputStream input = client.getResponseStream();//拿到服务端传过来的整个共享文件夹的压缩文件的文件流
|
|
|
|
zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); |
|
|
|
zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); |
|
|
|
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); |
|
|
|
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); |
|
|
|
StableUtils.deleteFile(cacheDir); |
|
|
|
StableUtils.deleteFile(cacheDir); |
|
|
|
StableUtils.mkdirs(cacheDir); |
|
|
|
StableUtils.mkdirs(cacheDir); |
|
|
|
StableUtils.makesureFileExist(zip); |
|
|
|
StableUtils.makesureFileExist(zip); |
|
|
|
FileOutputStream out = new FileOutputStream(zip); |
|
|
|
out = new FileOutputStream(zip); |
|
|
|
IOUtils.copyBinaryTo(input, out); |
|
|
|
IOUtils.copyBinaryTo(input, out);//放到本地缓存目录下
|
|
|
|
out.flush(); |
|
|
|
|
|
|
|
out.close(); |
|
|
|
|
|
|
|
IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录
|
|
|
|
IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录
|
|
|
|
if (cacheDir.exists() && cacheDir.isDirectory()) { |
|
|
|
if (cacheDir.exists() && cacheDir.isDirectory()) { |
|
|
|
return cacheDir.listFiles(new FilenameFilter() { |
|
|
|
return cacheDir.listFiles(new FilenameFilter() { |
|
|
@ -2144,6 +2144,10 @@ public class RemoteEnv implements Env { |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FRContext.getLogger().error(e.getMessage()); |
|
|
|
FRContext.getLogger().error(e.getMessage()); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (out != null) { |
|
|
|
|
|
|
|
out.flush(); |
|
|
|
|
|
|
|
out.close(); |
|
|
|
|
|
|
|
} |
|
|
|
StableUtils.deleteFile(zip); |
|
|
|
StableUtils.deleteFile(zip); |
|
|
|
} |
|
|
|
} |
|
|
|
return new File[0]; |
|
|
|
return new File[0]; |
|
|
@ -2151,26 +2155,34 @@ public class RemoteEnv implements Env { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean installREUFile(File reuFile) { |
|
|
|
public boolean installREUFile(File reuFile) { |
|
|
|
// if (reuFile == null) {
|
|
|
|
if (reuFile == null) { |
|
|
|
// return false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// HashMap<String, String> para = new HashMap<String, String>();
|
|
|
|
|
|
|
|
// para.put("op", "fr_remote_design");
|
|
|
|
|
|
|
|
// para.put("cmd", "design_install_reufile");
|
|
|
|
|
|
|
|
// para.put("current_uid", this.createUserID());
|
|
|
|
|
|
|
|
// para.put("currentUsername", this.getUser());
|
|
|
|
|
|
|
|
// para.put("reuFileName", reuFile.getName());
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// HttpClient client = createHttpMethod(para);
|
|
|
|
|
|
|
|
// client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(reuFile)));
|
|
|
|
|
|
|
|
// InputStream input = execute4InputStream(client);
|
|
|
|
|
|
|
|
// return ComparatorUtils.equals(stream2String(input), "true");
|
|
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
File tempFile = new File(CacheManager.getProviderInstance().getCacheDirectory(), "temp_remote"); |
|
|
|
|
|
|
|
IOUtils.unzip(reuFile, tempFile.getAbsolutePath()); |
|
|
|
|
|
|
|
String shareXMLName = StableUtils.pathJoin(tempFile.getAbsolutePath(), ShareConstants.NAME_XML_MODULE); |
|
|
|
|
|
|
|
String helpXMLName = StableUtils.pathJoin(tempFile.getAbsolutePath(), ShareConstants.NAME_XML_HELP); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
HashMap<String, String> para = new HashMap<String, String>(); |
|
|
|
|
|
|
|
para.put("op", "fr_remote_design"); |
|
|
|
|
|
|
|
para.put("cmd", "design_install_reufile"); |
|
|
|
|
|
|
|
para.put("current_uid", this.createUserID()); |
|
|
|
|
|
|
|
para.put("currentUsername", this.getUser()); |
|
|
|
|
|
|
|
para.put("reuFileName", reuFile.getName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HttpClient client = createHttpMethod(para); |
|
|
|
|
|
|
|
client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(new File(shareXMLName)))); |
|
|
|
|
|
|
|
InputStream input = execute4InputStream(client); |
|
|
|
|
|
|
|
client.release(); |
|
|
|
|
|
|
|
para.put("isComplete", "true"); |
|
|
|
|
|
|
|
HttpClient client1 = createHttpMethod(para); |
|
|
|
|
|
|
|
client1.setContent(IOUtils.inputStream2Bytes(new FileInputStream(new File(helpXMLName)))); |
|
|
|
|
|
|
|
InputStream input1 = execute4InputStream(client1); |
|
|
|
|
|
|
|
return ComparatorUtils.equals(stream2String(input), "true") && ComparatorUtils.equals(stream2String(input1), "true"); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean removeREUFilesByName(String fileName) { |
|
|
|
public boolean removeREUFilesByName(String fileName) { |
|
|
|