private void downloadBundles()

in taverna-update-impl/src/main/java/org/apache/taverna/update/impl/UpdateManagerImpl.java [173:198]


	private void downloadBundles(ApplicationProfile profile, Set<BundleInfo> requiredBundles, File file) throws UpdateException {
		Updates updates = profile.getUpdates();
		String updateSite = updates.getUpdateSite();
		String libDirectory = updates.getLibDirectory();
		if (!libDirectory.endsWith("/")) {
			libDirectory = libDirectory + "/";
		}

		URI updateLibDirectory;
		try {
			updateLibDirectory = new URI(updateSite).resolve(libDirectory);
		} catch (URISyntaxException e) {
			throw new UpdateException(String.format("Update site URL (%s) is not a valid URL",
					updates.getUpdateSite()), e);
		}
		for (BundleInfo bundle : requiredBundles) {
			URI bundleURI = updateLibDirectory.resolve(bundle.getFileName());
			Path bundleDestination = new File(file, bundle.getFileName()).toPath();
			try {
				downloadManager.download(bundleURI, bundleDestination, DIGEST_ALGORITHM);
			} catch (DownloadException e) {
				throw new UpdateException(String.format("Error downloading %1$s to %2$s",
						bundleURI, bundleDestination), e);
			}
		}
	}