Browse Source

依赖下载

master
Fangjie Hu 8 years ago
parent
commit
bd06e8242e
  1. 20
      designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

20
designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

@ -164,9 +164,13 @@ public class DownLoadDependenceUI implements ActionListener {
return result; return result;
} }
private List<String> downloadPluginDependenceFile() throws Exception { /**
* 下载和安装不分开是因为本地如果只安装好了一个依赖下次就不需要重复下载了
* @return
* @throws Exception
*/
private void downloadAndInstallPluginDependenceFile() throws Exception {
totalBytesRead = 0; totalBytesRead = 0;
List<String> pathList = new ArrayList<String>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
PluginDependenceUnit dependenceUnit = list.get(i); PluginDependenceUnit dependenceUnit = list.get(i);
httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceUnit.getDependenceID())); httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceUnit.getDependenceID()));
@ -191,21 +195,23 @@ public class DownLoadDependenceUI implements ActionListener {
result = false; result = false;
throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Install_Failed")); throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Install_Failed"));
} }
pathList.add(temp);
//安装文件
IOUtils.unzip(new File(temp), FRContext.getCurrentEnv().getPath() + dependenceUnit.getDependenceDir());
} else { } else {
result = false; result = false;
throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Install_Failed")); throw new PluginDependenceException(Inter.getLocText("FR-Designer-Dependence_Install_Failed"));
} }
} }
return pathList; //所有依赖都正常安装下载完毕,则结果为true
result = true;
} }
public void installDependenceOnline() { public void installDependenceOnline() {
try { try {
List<String> filePathList = downloadPluginDependenceFile(); //下载并安装文件
//安装文件 downloadAndInstallPluginDependenceFile();
installPluginDependenceFile(filePathList);
} catch (Exception e) { } catch (Exception e) {
result = false; result = false;
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());

Loading…
Cancel
Save