|
|
|
@ -22,6 +22,7 @@ import com.fr.file.CacheManager;
|
|
|
|
|
import com.fr.file.DatasourceManager; |
|
|
|
|
import com.fr.file.DatasourceManagerProvider; |
|
|
|
|
import com.fr.file.filetree.FileNode; |
|
|
|
|
import com.fr.form.share.ShareConstants; |
|
|
|
|
import com.fr.general.*; |
|
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
|
import com.fr.json.JSONArray; |
|
|
|
@ -2105,4 +2106,47 @@ public class RemoteEnv implements Env {
|
|
|
|
|
public void checkAndRegisterLic(FileNode node, Plugin plugin) throws Exception { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public File[] loadREUFile() throws Exception { |
|
|
|
|
File target = new File(CacheManager.getProviderInstance().getCacheDirectory(), |
|
|
|
|
"fr_share"); |
|
|
|
|
StableUtils.deleteFile(target); |
|
|
|
|
StableUtils.mkdirs(target); |
|
|
|
|
File cacheDir = null; |
|
|
|
|
File zip = null; |
|
|
|
|
try { |
|
|
|
|
HashMap<String, String> para = new HashMap<String, String>(); |
|
|
|
|
para.put("op", "fr_remote_design"); |
|
|
|
|
para.put("cmd", "design_read_reufile"); |
|
|
|
|
para.put("current_uid", this.createUserID()); |
|
|
|
|
para.put("currentUsername", this.getUser()); |
|
|
|
|
|
|
|
|
|
HttpClient client = createHttpMethod(para); |
|
|
|
|
InputStream input = client.getResponseStream(); |
|
|
|
|
zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); |
|
|
|
|
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); |
|
|
|
|
StableUtils.deleteFile(cacheDir); |
|
|
|
|
StableUtils.mkdirs(cacheDir); |
|
|
|
|
StableUtils.makesureFileExist(zip); |
|
|
|
|
FileOutputStream out = new FileOutputStream(zip); |
|
|
|
|
IOUtils.copyBinaryTo(input, out); |
|
|
|
|
out.flush(); |
|
|
|
|
out.close(); |
|
|
|
|
IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录
|
|
|
|
|
if (cacheDir.exists() && cacheDir.isDirectory()) { |
|
|
|
|
return cacheDir.listFiles(new FilenameFilter() { |
|
|
|
|
public boolean accept(File file, String s) { |
|
|
|
|
return s.endsWith("reu"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FRContext.getLogger().error(e.getMessage()); |
|
|
|
|
} finally { |
|
|
|
|
StableUtils.deleteFile(zip); |
|
|
|
|
} |
|
|
|
|
return new File[0]; |
|
|
|
|
} |
|
|
|
|
} |