@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; FeaturePackSpec other = (FeaturePackSpec) obj; if (defPackages == null) { if (other.defPackages != null) return false; } else if (!defPackages.equals(other.defPackages)) return false; if (fpid == null) { if (other.fpid != null) return false; } else if (!fpid.equals(other.fpid)) return false; return true; }
if (p.hasNewPatches()) { for (FPID id : p.getNewPatches()) { patches.addLine(id.getBuild());
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FPID other = (FPID) obj; Object thisField = getChannel(); Object otherField = other.getChannel(); if (thisField == null) { if (otherField != null) return false; } else if (!thisField.equals(otherField)) return false; thisField = getBuild(); otherField = other.getBuild(); if (thisField == null) { if (otherField != null) return false; } else if (!thisField.equals(otherField)) return false; return true; }
gavs.put(Identity.buildOrigin(rt.getFPID().getProducer()), rt); for (PackageRuntime pkg : rt.getPackages()) { pkgBuilder.buildGroups(new PackageInfo(pkg, Identity. fromChannel(rt.getFPID().getProducer(), pkg.getName()), plugin), new PackageGroupsBuilder.PackageInfoBuilder() { @Override public PackageInfo build(Identity identity, PackageInfo parent) { fp.setPackagesRoot(Identity.buildOrigin(rt.getFPID().getProducer()), pkgBuilder.getPackagesRoot()); fp.setFeatureSpecRoot(Identity.buildOrigin(rt.getFPID().getProducer()), specsRoot);
boolean isProduct = true; for (FeaturePackLayout fpLayout2 : layout.getOrderedFeaturePacks()) { if (fpLayout2.getSpec().hasTransitiveDep(fpLayout.getFPID().getProducer()) || fpLayout2.getSpec().getFeaturePackDep(fpLayout.getFPID().getProducer()) != null) { isProduct = false; break; product = fpLayout; } else { dependencies.add(session.getExposedLocation(null, fpLayout.getFPID().getLocation())); session.getExposedLocation(null, product.getFPID().getLocation()));
} else if(!branchId.getBuild().equals(fpl.getBuild())) { fpl = fpl.replaceBuild(branchId.getBuild()); if(branchId == null && !fpl.getBuild().equals(fp.getFPID().getBuild())) { Set<FPID> versions = conflicts.get(fp.getFPID().getProducer()); if(versions != null) { versions.add(fpl.getFPID());
void build() throws ProvisioningException { final FeaturePackLocation fps = fpBuilder.getFPID().getLocation(); if(fps == null) { throw new ProvisioningDescriptionException("Feature-pack location has not been set");
switch (element) { case SPEC: readSpec(reader, LegacyGalleon1Universe.newFPID(group, artifact, version).getProducer(), config); break; default:
resolvedIdentity = Identity.fromChannel(currentRuntime.getFPID().getProducer(), identity.getName());
for (ResolvedFeatureSpec resolvedSpec : layout.getFeaturePack(fpid.getProducer()).getFeatureSpecs()) { ResolvedSpecId resolved = resolvedSpec.getId(); if (wantedSpecs == null || wantedSpecs.contains(resolved)) {
F patchTarget = featurePacks.get(fpSpec.getPatchFor().getProducer()); if(patchTarget == null || !patchTarget.getFPID().equals(fpSpec.getPatchFor())) { throw new ProvisioningException(Errors.patchNotApplicable(fpid, fpSpec.getPatchFor())); FeaturePackConfig installedFpConfig = config.getFeaturePackDep(fpSpec.getPatchFor().getProducer()); if(installedFpConfig == null) { installedFpConfig = config.getTransitiveDep(fpSpec.getPatchFor().getProducer()); FeaturePackConfig.transitiveBuilder(patchTarget.getFPID().getLocation()).addPatch(fpid).build()); final F installedFp = featurePacks.get(fpid.getProducer()); if(installedFp != null) { if(installedFp.isTransitiveDep() == fpConfig.isTransitive()) { if (config.hasTransitiveDep(fpid.getProducer())) { configBuilder.removeTransitiveDep(fpid); return configBuilder.addFeaturePackDep(getIndexForDepToInstall(configBuilder, fpid.getProducer()), fpConfig); configBuilder.removeFeaturePackDep(fpid.getLocation());
for(FPID patchId : featurePack.getPatches()) { final ElementNode patch = addElement(patches, Element.PATCH.getLocalName(), ns); addAttribute(patch, Attribute.ID, patchId.toString());
if (c.getLocation().getFPID().equals(fpid)) { config = c; break;
Cell patches = new Cell(); for (FPID p : c.getPatches()) { patches.addLine(p.getBuild());
Cell patches = new Cell(); for (FPID p : config.getPatches()) { patches.addLine(p.getBuild());
private ProvisioningConfig.Builder uninstall(FPID fpid, ProvisioningConfig.Builder configBuilder) throws ProvisioningException { if(allPatches.containsKey(fpid)) { final F patchFp = allPatches.get(fpid); final ProducerSpec patchTarget = patchFp.getSpec().getPatchFor().getProducer(); FeaturePackConfig targetConfig = config.getFeaturePackDep(patchTarget); if(targetConfig == null) { final F installedFp = featurePacks.get(fpid.getProducer()); if(installedFp == null) { throw new ProvisioningException(Errors.unknownFeaturePack(fpid)); if(fpid.getBuild() != null && !installedFp.getFPID().getBuild().equals(fpid.getBuild())) { throw new ProvisioningException(Errors.unknownFeaturePack(fpid)); final FeaturePackConfig fpConfig = config.getFeaturePackDep(fpid.getProducer()); if(fpConfig == null) { throw new ProvisioningException(Errors.unsatisfiedFeaturePackDep(fpid.getProducer())); configBuilder.removeFeaturePackDep(fpid.getLocation()); if (!configBuilder.hasFeaturePackDeps()) { configBuilder.clearFeaturePackDeps();
private <O extends FeaturePackLayout> ProvisioningLayout(ProvisioningLayout<O> other, FeaturePackLayoutFactory<F> fpFactory, FeaturePackLayoutTransformer<F, O> transformer) throws ProvisioningException { this.layoutFactory = other.layoutFactory; this.fpFactory = fpFactory; this.config = other.config; this.options = CollectionUtils.clone(other.options); // feature-packs are processed in the reverse order and then re-ordered again // this is necessary to properly analyze and include optional package and their external dependencies int i = other.ordered.size(); ordered.ensureCapacity(i); while(--i >= 0) { final O otherFp = other.ordered.get(i); final F fp = transformer.transform(otherFp); featurePacks.put(fp.getFPID().getProducer(), fp); ordered.add(fp); } Collections.reverse(ordered); if(!other.fpPatches.isEmpty()) { fpPatches = new HashMap<>(other.fpPatches.size()); for (Map.Entry<FPID, List<O>> patchEntry : other.fpPatches.entrySet()) { final List<O> patches = patchEntry.getValue(); final List<F> convertedPatches = new ArrayList<>(patches.size()); for(O o : patches) { convertedPatches.add(transformer.transform(o)); } fpPatches.put(patchEntry.getKey(), convertedPatches); } } this.handle = other.handle; handle.incrementRefs(); }
private FeaturePackConfig.Builder getFpcBuilder(FPID fpid) { FeaturePackConfig.Builder fpcBuilder = updatedDirectFps.get(fpid); if(fpcBuilder != null) { return fpcBuilder; } fpcBuilder = updatedTransitiveFps.get(fpid); if(fpcBuilder != null) { return fpcBuilder; } fpcBuilder = addedTransitiveFps.get(fpid); if(fpcBuilder != null) { return fpcBuilder; } FeaturePackConfig fpc = provisionedConfig.getFeaturePackDep(fpid.getProducer()); if(fpc != null) { fpcBuilder = FeaturePackConfig.builder(fpc); updatedDirectFps = CollectionUtils.put(updatedDirectFps, fpid, fpcBuilder); return fpcBuilder; } fpc = provisionedConfig.getTransitiveDep(fpid.getProducer()); if(fpc != null) { fpcBuilder = FeaturePackConfig.builder(fpc); updatedTransitiveFps = CollectionUtils.put(updatedTransitiveFps, fpid, fpcBuilder); return fpcBuilder; } fpcBuilder = FeaturePackConfig.transitiveBuilder(fpid.getLocation()); addedTransitiveFps = CollectionUtils.putLinked(addedTransitiveFps, fpid, fpcBuilder); return fpcBuilder; }
/** * 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())); }