in taverna-update-impl/src/main/java/org/apache/taverna/update/impl/UpdateManagerImpl.java [118:166]
public boolean update() throws UpdateException {
if (updateAvailable) {
ApplicationProfile applicationProfile = applicationConfiguration.getApplicationProfile();
Updates updates = applicationProfile.getUpdates();
URI profileURL;
try {
URI updateSiteURI = new URI(updates.getUpdateSite());
profileURL = updateSiteURI.resolve(latestVersion.getFile());
} catch (URISyntaxException e) {
throw new UpdateException(String.format("Update site URL (%s) is not a valid URL",
updates.getUpdateSite()), e);
}
File updateDirectory = applicationConfiguration.getApplicationHomeDir().resolve(
"updates").toFile();
updateDirectory.mkdirs();
File latestProfileFile = new File(updateDirectory, "ApplicationProfile-"
+ latestVersion.getVersion() + ".xml");
try {
downloadManager.download(profileURL, latestProfileFile.toPath(), DIGEST_ALGORITHM);
} catch (DownloadException e) {
throw new UpdateException(String.format("Error downloading %1$s",
profileURL), e);
}
ApplicationProfile latestProfile;
try {
latestProfile = (ApplicationProfile) unmarshaller.unmarshal(latestProfileFile);
} catch (JAXBException e) {
throw new UpdateException(String.format("Error reading %s",
latestProfileFile.getName()), e);
}
Set<BundleInfo> requiredBundles = getRequiredBundles(
applicationConfiguration.getApplicationProfile(), latestProfile);
downloadBundles(latestProfile, requiredBundles, applicationConfiguration.getStartupDir().resolve("lib").toFile());
File applicationProfileFile = applicationConfiguration.getStartupDir().resolve("ApplicationProfile.xml").toFile();
try {
FileUtils.copyFile(latestProfileFile, applicationProfileFile);
} catch (IOException e) {
throw new UpdateException(String.format("Error copying %1$s to %2$s",
latestProfileFile.getName(), applicationProfileFile.getName()), e);
}
// eventAdmin.postEvent(new Event("UpdateManagerEvent", new HashMap()));
updateAvailable = false;
return true;
}
return false;
}