}
}
for (Resource installedResource : installedResources.values()) {
ResourceIdentity identity = installedResource.getIdentity();
ResourceHandle resourceHandle = resourcehandleMap.get(identity);
if (resourceHandle == null) {
// TODO should not really happen when we can ask about the installed Resources
LOGGER.warn("TODO: Cannot uninstall " + installedResource + " as we have no handle!");
} else {
LOGGER.info("Uninstalling " + installedResource);
resourceHandle.uninstall();
resourcehandleMap.remove(identity);
LOGGER.info("Uninstalled " + installedResource);
}
}
if (resourcesToInstall.size() > 0) {
LOGGER.info("Installing " + resourcesToInstall.size() + " resource(s)");
Set<ResourceHandle> resourceHandles = new LinkedHashSet<>();
ResourceInstaller.Context context = new DefaultInstallerContext(resourcesToInstall, requirements);
for (Resource resource : resourcesToInstall) {
resourceHandles.add(resourceInstaller.installResource(context, resource));
}
LOGGER.info("Got " + resourceHandles.size() + " resource handle(s)");
for (ResourceHandle resourceHandle : resourceHandles) {
resourcehandleMap.put(resourceHandle.getResource().getIdentity(), resourceHandle);
}
}
return resourceUrisInstalled;
}