public void getProgressInfo(Integer downloadKey) throws Exception {
// DWR objects
WebContext wctx = WebContextFactory.get();
ScriptSession scriptSession = wctx.getScriptSession();
//DownloadResults results = getPluginInstaller().checkOnInstall(downloadKey);
ScriptProxy scriptProxy = new ScriptProxy();
scriptProxy.addScriptSession(scriptSession);
PluginInstallerGBean pluginInstallerInternal = (PluginInstallerGBean) getPluginInstaller();
DownloadResults results = pluginInstallerInternal.checkOnInstall(downloadKey, false);
//In the event results.isFinished is passed in true during polling
scriptProxy.addFunctionCall("setMainMessage", results.getCurrentMessage());
scriptProxy.addFunctionCall("setProgressCurrentFile", results.getCurrentFile());
while (!results.isFinished()) {
// update the progress bar
scriptProxy.addFunctionCall("setProgressCurrentFile", results.getCurrentFile());
scriptProxy.addFunctionCall("setProgressPercent", results.getCurrentFilePercent());
scriptProxy.addFunctionCall("setMainMessage", results.getCurrentMessage());
// get an update on the download progress, sleep time reduce to poll faster for smaller files
Thread.sleep(100);
//results = getPluginInstaller().checkOnInstall(downloadKey);
results = pluginInstallerInternal.checkOnInstall(downloadKey, false);
}
if(results.isFailed()) {
scriptProxy.addFunctionCall("setErrorMessage", results.getFailure().toString());
throw new Exception("Unable to install configuration", results.getFailure());
}
//Fills bar at the end in the event the poller didn't catch the 100
scriptProxy.addFunctionCall("setProgressFull");
scriptProxy.addFunctionCall("setFinished");
}