private InstallerResult install(PluginInfo info) { logger.info(LogBanner.start("Downloading and Installing Plugin")); BackgroundTask downloading = ProtegeApplication.getBackgroundTaskManager().startTask("downloading " + info.getLabel()); logger.info("Downloading the {} plugin (Version {})", info.getLabel(), info.getAvailableVersion()); try { Optional<File> downloadedPlugin = downloadPlugin(info); if (!downloadedPlugin.isPresent()) { logger.error("An error occurred whilst downloading the {} plugin. The plugin has not been installed.", info.getLabel()); return InstallerResult.ERROR; } Optional<File> installedPluginFile = copyPluginToInstallLocation(downloadedPlugin.get(), info); if (!installedPluginFile.isPresent()) { logger.error("There was an error whilst trying to install the {} plugin. It has not been installed", info.getLabel()); return InstallerResult.ERROR; } if (installPlugin(installedPluginFile.get(), info)) { return InstallerResult.INSTALLED; } else { return InstallerResult.DOWNLOADED; } } catch (IOException | URISyntaxException t) { logger.error("An error occurred whilst downloading and installing the {} plugin: {}", info.getLabel(), t.getMessage(), t); return InstallerResult.ERROR; } finally { logger.info(LogBanner.end()); ProtegeApplication.getBackgroundTaskManager().endTask(downloading); } }
private InstallerResult install(PluginInfo info) { BackgroundTask downloading = ProtegeApplication.getBackgroundTaskManager().startTask("downloading " + info.getLabel()); logger.info("Downloading " + info.getLabel()); try { File tempPluginFile = downloadPlugin(info); if (tempPluginFile == null) { logger.error("Could not download plugin"); return InstallerResult.ERROR; } File installedPluginFile = copyPluginToInstallLocation(tempPluginFile, info); if (installedPluginFile == null) { logger.error("Could not install plugin"); return InstallerResult.ERROR; } if (installPlugin(installedPluginFile, info)) { return InstallerResult.INSTALLED; } else { return InstallerResult.DOWNLOADED; } } catch (Throwable t) { logger.error("Exception caught installing plugins", t); return InstallerResult.ERROR; } finally{ ProtegeApplication.getBackgroundTaskManager().endTask(downloading); } }
private InstallerResult install(PluginInfo info) { BackgroundTask downloading = ProtegeApplication.getBackgroundTaskManager().startTask("downloading " + info.getLabel()); logger.info("Downloading " + info.getLabel()); try { File tempPluginFile = downloadPlugin(info); if (tempPluginFile == null) { logger.error("Could not download plugin"); return InstallerResult.ERROR; } File installedPluginFile = copyPluginToInstallLocation(tempPluginFile, info); if (installedPluginFile == null) { logger.error("Could not install plugin"); return InstallerResult.ERROR; } if (installPlugin(installedPluginFile, info)) { return InstallerResult.INSTALLED; } else { return InstallerResult.DOWNLOADED; } } catch (Throwable t) { logger.error("Exception caught installing plugins", t); return InstallerResult.ERROR; } finally{ ProtegeApplication.getBackgroundTaskManager().endTask(downloading); } }