private AddonActionRequest createRequest(final AddonInfo requestedAddonInfo, final AddonInfo addonInfo,
final MutableAddonRepository repository,
final Map<AddonId, AddonRepository> installedAddons)
{
final AddonActionRequest request;
AddonId addon = addonInfo.getAddon();
if (installedAddons.containsKey(addon))
{
// Already contains the installed addon. Update ONLY if the version is SNAPSHOT and if it is the requested
// addon
if (Versions.isSnapshot(addonInfo.getAddon().getVersion()) && addonInfo.equals(requestedAddonInfo))
{
AddonRepository addonRepository = installedAddons.get(addon);
if (repository.equals(addonRepository))
{
request = createUpdateRequest(addonInfo, addonInfo, repository, furnace);
}
else
{
request = createDeployRequest(addonInfo, repository, furnace);
}
}
else
{
request = null;
}
}
else
{
Entry<AddonId, AddonRepository> differentVersionEntry = null;
for (Entry<AddonId, AddonRepository> addonEntry : installedAddons.entrySet())
{
AddonId addonId = addonEntry.getKey();
if (addonId.getName().equals(addon.getName()))
{
differentVersionEntry = addonEntry;
break;
}
}