newConfig = ProvisioningConfig.builder(config); newConfig.removeTransitiveDep(producer.getLocation().getFPID()); continue;
FeaturePackLocation loc = commandInvocation.getPmSession().getExposedLocation(installation, c.getLocation()); List<Cell> line = new ArrayList<>(); line.add(new Cell(loc.getProducer().getName())); line.add(new Cell(loc.getBuild())); if (showPatches) {
session, entry.getKey().getLocation().getFPID(), fp.getFPID(), pkgBuilder.getPackages(), false, entry.getValue()); for (ResolvedSpecId rs : entry.getValue()) {
uninstall(producer.getLocation().getFPID(), configBuilder);
FeaturePackRuntime(FeaturePackRuntimeBuilder builder, ProvisioningRuntimeBuilder rt) throws ProvisioningException { super(builder.producer.getLocation().getFPID(), builder.getDir(), builder.getType()); this.spec = builder.getSpec(); this.featureSpecs = builder.featureSpecs;
currentOrigin.setVisited(false); throw new ProvisioningDescriptionException(Errors.packageNotFound(currentOrigin.producer.getLocation().getFPID(), pkgName));
if (lastHandledSpecId == null || !feature.spec.id.producer.equals(lastHandledSpecId.producer)) { handler.nextFeaturePack(feature.spec.id.producer.getLocation().getFPID());
private void processConfigItemContainer(ConfigItemContainer ciContainer) throws ProvisioningException { if(!ciContainer.hasItems()) { return; } final FeaturePackRuntimeBuilder prevFpOrigin = ciContainer.isResetFeaturePackOrigin() ? setThisOrigin(currentOrigin) : null; for (ConfigItem item : ciContainer.getItems()) { final FeaturePackRuntimeBuilder originalFp = setOrigin(item.getOrigin()); try { if (item.isGroup()) { processFeatureGroup((FeatureGroup) item); } else { resolveFeature(configStack, (FeatureConfig) item); } } catch (ProvisioningException e) { if (currentOrigin == null) { throw e; } throw new ProvisioningException( item.isGroup() ? Errors.failedToProcess(currentOrigin.producer.getLocation().getFPID(), ((FeatureGroup) item).getName()) : Errors.failedToProcess(currentOrigin.producer.getLocation().getFPID(), (FeatureConfig) item), e); } finally { setOrigin(originalFp); } } if(prevFpOrigin != null) { setThisOrigin(prevFpOrigin); } }
/** * 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())); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ProducerSpec other = (ProducerSpec) obj; Object otherField = other.getName(); if (producer == null) { if (otherField != null) return false; } else if (!producer.equals(otherField)) return false; otherField = other.getUniverse(); if (universeSpec == null) { if (otherField != null) return false; } else if (!universeSpec.equals(otherField)) return false; return true; }
void processIncludedFeatures(final ResolvedFeatureGroupConfig pushedFgConfig) throws ProvisioningException { if (pushedFgConfig.includedFeatures.isEmpty()) { return; } for (Map.Entry<ResolvedFeatureId, FeatureConfig> feature : pushedFgConfig.includedFeatures.entrySet()) { final FeatureConfig includedFc = feature.getValue(); if (includedFc != null && includedFc.hasParams()) { final ResolvedFeatureId includedId = feature.getKey(); if (pushedFgConfig.configStack.isFilteredOut(includedId.specId, includedId)) { continue; } // make sure the included ID is in fact present on the feature group branch if (!pushedFgConfig.configStack.includes(includedId)) { throw new ProvisioningException(Errors.featureNotInScope(includedId, pushedFgConfig.fg.getId() == null ? "'anonymous'" : pushedFgConfig.fg.getId().toString(), currentOrigin == null ? null : currentOrigin.producer.getLocation().getFPID())); } resolveFeature(pushedFgConfig.configStack, includedFc); } } }
public static String buildPatches(PmCommandInvocation invoc, ProvisioningLayout<FeaturePackLayout> layout) throws ProvisioningException { if (!layout.hasPatches()) { return null; } Table table = new Table(Headers.PATCH, Headers.PATCH_FOR, Headers.UPDATE_CHANNEL); for (FeaturePackLayout fpLayout : layout.getOrderedFeaturePacks()) { List<FeaturePackLayout> patches = layout.getPatches(fpLayout.getFPID()); for (FeaturePackLayout patch : patches) { FeaturePackLocation loc = invoc.getPmSession().getExposedLocation(null, patch.getFPID().getLocation()); FPID patchFor = patch.getSpec().getPatchFor(); table.addLine(patch.getFPID().getBuild(), patchFor.getProducer().getName() + FeaturePackLocation.BUILD_START + patchFor.getBuild(), formatChannel(loc)); } } if (!table.isEmpty()) { table.sort(Table.SortType.ASCENDANT); return table.build(); } return null; }
public int getFeaturePackDepIndex(FeaturePackLocation fpl) throws ProvisioningException { fpl = resolveUniverseSpec(fpl); final ProducerSpec producer = fpl.getProducer(); final FeaturePackConfig fpDep = fpDeps.get(producer); if (fpDep == null) { throw new ProvisioningException(Errors.unknownFeaturePack(fpl.getFPID())); } if (!fpDep.getLocation().equals(fpl)) { throw new ProvisioningException(Errors.unknownFeaturePack(fpl.getFPID())); } int i = 0; for (ProducerSpec depProducer : fpDeps.keySet()) { if (depProducer.equals(producer)) { break; } i += 1; } return i; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResolvedSpecId other = (ResolvedSpecId) obj; if (producer == null) { if (other.producer != null) return false; } else if (!producer.equals(other.producer)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; }
@Override public void handle(ProvisionedConfigHandler handler) throws ProvisioningException { if (!hasFeatures()) { return; } handler.prepare(this); ResolvedSpecId lastHandledSpecId = null; for(ProvisionedFeature feature : features) { if(!feature.getSpecId().equals(lastHandledSpecId)) { if (lastHandledSpecId == null || !feature.getSpecId().getProducer().equals(lastHandledSpecId.getProducer())) { handler.nextFeaturePack(feature.getSpecId().getProducer().getLocation().getFPID()); } // TODO: complete spec isn't available here, but specId is enough for marshalling handler.nextSpec(new ResolvedFeatureSpec(feature.getSpecId(), null, FeatureSpec.builder().build())); lastHandledSpecId = feature.getSpecId(); } handler.nextFeature(feature); } handler.done(); }
private boolean isRelevant(ResolvedFeatureGroupConfig resolvedFg) { if(resolvedFg.fg.getId() == null) { return true; } for(int i = groupStack.size() - 1; i >= 0; --i) { final ResolvedFeatureGroupConfig stacked = groupStack.get(i); if (stacked.fg.getId() == null || stacked.producer == null || resolvedFg.producer == null || !stacked.producer.equals(resolvedFg.producer) || !stacked.fg.getId().equals(resolvedFg.fg.getId())) { continue; } return !resolvedFg.isSubsetOf(stacked); } return true; }
public ProducerSpec getProducer() { return producerSpec == null ? producerSpec = new ProducerSpec() : producerSpec; }
public static String getDefaultOriginName(FeaturePackLocation fpl) { return fpl.getProducer().toString(); }
@Override protected String processingContent(ProgressTracker<ProducerSpec> tracker) { return session.getExposedLocation(null, tracker.getItem().getLocation()).toString(); }