public boolean isEmpty() { return !(hasNewLocation() || hasNewPatches()); }
public static Request request(FeaturePackLocation installedFpl, Set<FPID> installedPatches) { return request(installedFpl, installedPatches, false); }
public static Request request(FeaturePackLocation installedFpl, Set<FPID> installedPatches, boolean transitive) { return new FeaturePackUpdatePlan(installedFpl, installedPatches, transitive).newRequest(); }
if (p.hasNewPatches()) { hasPatches = true; break; FeaturePackLocation loc = p.getInstalledLocation(); String update = p.hasNewLocation() ? p.getNewLocation().getBuild() : NONE; Cell patches = null; if (hasPatches) { patches = new Cell(); if (p.hasNewPatches()) { for (FPID id : p.getNewPatches()) { patches.addLine(id.getBuild()); line.add(new Cell(p.isTransitive() ? "Y" : "N")); FeaturePackLocation newLocation = session.getPmSession().getExposedLocation(mgr.getInstallationHome(), p.getNewLocation()); line.add(new Cell(StateInfoUtil.formatChannel(newLocation))); updates.t.addCellsLine(line);
final ProducerSpec producer = fpConfig.getLocation().getProducer(); final FeaturePackUpdatePlan fpPlan = updates.get(producer); if(fpPlan != null && !fpPlan.isEmpty()) { if(!fpPlan.getInstalledLocation().equals(fpConfig.getLocation())) { throw new ProvisioningException("Location in the update plan " + fpPlan.getInstalledLocation() + " does not match the installed location " + fpConfig.getLocation()); final FeaturePackConfig.Builder fpBuilder = FeaturePackConfig.builder(fpPlan.getNewLocation()).init(fpConfig); if(fpPlan.hasNewPatches()) { for(FPID patchId : fpPlan.getNewPatches()) { fpBuilder.addPatch(patchId); final ProducerSpec producer = fpConfig.getLocation().getProducer(); final FeaturePackUpdatePlan fpPlan = updates.get(producer); if(fpPlan != null && !fpPlan.isEmpty()) { if(fpConfig.getLocation().getBuild() != null && !fpPlan.getInstalledLocation().equals(fpConfig.getLocation())) { throw new ProvisioningException("Update plan build " + fpPlan.getInstalledLocation() + " does not match the installed build " + fpConfig.getLocation()); final FeaturePackConfig.Builder fpBuilder = FeaturePackConfig.transitiveBuilder(fpPlan.getNewLocation()).init(fpConfig); if(fpPlan.hasNewPatches()) { for(FPID patchId : fpPlan.getNewPatches()) { fpBuilder.addPatch(patchId); final FeaturePackConfig.Builder fpBuilder = FeaturePackConfig.transitiveBuilder(update.getNewLocation()); if (update.hasNewPatches()) { for (FPID patchId : update.getNewPatches()) { fpBuilder.addPatch(patchId);
private static void addCustomUpdates(ProvisioningPlan plan, List<FeaturePackLocation> custom, ProvisioningManager mgr) throws ProvisioningException { try (ProvisioningLayout<?> layout = mgr.getLayoutFactory().newConfigLayout(mgr.getProvisioningConfig())) { for (FeaturePackLocation loc : custom) { FeaturePackLayout fpl = layout.getFeaturePack(loc.getProducer()); FeaturePackLocation current = fpl.getFPID().getLocation(); FeaturePackUpdatePlan fpPlan = FeaturePackUpdatePlan.request(current, fpl.isTransitiveDep()).setNewLocation(loc).buildPlan(); if (fpPlan.hasNewLocation()) { plan.update(fpPlan); } } } }
public String toString() { final StringBuilder buf = new StringBuilder(); buf.append("[update "); if(transitive) { buf.append("transitive "); } buf.append(installedFpl); if(hasNewLocation()) { buf.append(" to ").append(newFpl); } if(!newPatches.isEmpty()) { buf.append(" with "); StringUtils.append(buf, newPatches); } return buf.append(']').toString(); } }
public ProvisioningPlan update(FeaturePackUpdatePlan fpPlan) throws ProvisioningDescriptionException { final ProducerSpec producer = fpPlan.getInstalledLocation().getProducer(); if(install.containsKey(producer) || uninstall.contains(producer)) { throw new ProvisioningDescriptionException(producer + " has already been added to the plan"); } updates = CollectionUtils.putLinked(updates, producer, fpPlan); return this; }
private ProvisioningPlan getUpdatesInternal(Collection<ProducerSpec> producers) throws ProvisioningException { final ProvisioningPlan plan = ProvisioningPlan.builder(); updatesTracker = getUpdatesTracker(); updatesTracker.starting(producers.size()); for(ProducerSpec producer : producers) { updatesTracker.processing(producer); final FeaturePackUpdatePlan fpPlan = getFeaturePackUpdate(producer); if(!fpPlan.isEmpty()) { plan.update(fpPlan); } updatesTracker.processed(producer); } updatesTracker.complete(); return plan; }
public static Request request(FeaturePackLocation installedFpl, boolean transitive) { return request(installedFpl, Collections.emptySet(), transitive); }
public static Request request(FeaturePackLocation installedFpl) { return request(installedFpl, Collections.emptySet(), false); }
/** * Query for available version update and patches for the specific producer. * * @param producer the producer to check the updates for * @return available updates for the producer * @throws ProvisioningException in case of a failure */ public FeaturePackUpdatePlan getFeaturePackUpdate(ProducerSpec producer) throws ProvisioningException { final F f = featurePacks.get(producer); if(f == null) { throw new ProvisioningException(Errors.unknownFeaturePack(producer.getLocation().getFPID())); } final FeaturePackLocation fpl = f.getFPID().getLocation(); final Universe<?> universe = layoutFactory.getUniverseResolver().getUniverse(fpl.getUniverse()); final Channel channel = universe.getProducer(fpl.getProducerName()).getChannel(fpl.getChannelName()); final List<F> patches = fpPatches.get(fpl.getFPID()); final Set<FPID> patchIds; if (patches == null || patches.isEmpty()) { patchIds = Collections.emptySet(); } else if (patches.size() == 1) { patchIds = Collections.singleton(patches.get(0).getFPID()); } else { final Set<FPID> tmp = new HashSet<>(patches.size()); for (F p : patches) { tmp.add(p.getFPID()); } patchIds = CollectionUtils.unmodifiable(tmp); } return channel.getUpdatePlan(FeaturePackUpdatePlan.request(fpl, patchIds, f.isTransitiveDep())); }