static String featurePackVersionConflict(Collection<FeaturePackLocation.FPID> fpids) { final Iterator<FeaturePackLocation.FPID> i = fpids.iterator(); FeaturePackLocation.FPID fpid = i.next(); final StringBuilder buf = new StringBuilder("Please pick the desired build number for ") .append(fpid.getProducer()) .append(" explicitly in the provisioning config. Current configuration references the following versions ") .append(fpid.getBuild()); while(i.hasNext()) { fpid = i.next(); buf.append(", ").append(fpid.getBuild()); } return buf.toString(); }
public Builder setPatchFor(FPID patchFor) { if(patchFor.getBuild() == null) { throw new IllegalArgumentException("FPID is missing build number"); } this.patchFor = patchFor; return this; }
@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; }
if (p.hasNewPatches()) { for (FPID id : p.getNewPatches()) { patches.addLine(id.getBuild());
Cell patches = new Cell(); for (FPID p : config.getPatches()) { patches.addLine(p.getBuild());
Cell patches = new Cell(); for (FPID p : c.getPatches()) { patches.addLine(p.getBuild());
private void parsePatchFor(final XMLExtendedStreamReader reader, FeaturePackSpec.Builder builder) throws XMLStreamException { final int count = reader.getAttributeCount(); FPID patchFor = null; for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i).getLocalPart()); switch (attribute) { case FOR: final FeaturePackLocation location; try { location = FeaturePackLocation.fromString(reader.getAttributeValue(i)); } catch(IllegalArgumentException e) { throw new XMLStreamException("Failed to parse patch for FPID '" + reader.getAttributeValue(i) + "'", e); } patchFor = ProvisioningXmlParser20.resolveUniverse(builder, location).getFPID(); break; default: throw ParsingUtils.unexpectedContent(reader); } } if (patchFor == null) { throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.FOR)); } ParsingUtils.parseNoContent(reader); if(patchFor.getBuild() == null) { throw new XMLStreamException("Build number is missing for the version the patch is applied to: " + patchFor); } builder.setPatchFor(patchFor); }
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 static FeatureContainer fromFeaturePackId(PmSession session, FPID fpid, String name) throws ProvisioningException, IOException { if (fpid.getBuild() == null) { FeaturePackLocation loc = session.getUniverse().resolveLatestBuild(fpid.getLocation()); fpid = loc.getFPID(); } FeatureContainer fp = Caches.getFeaturePackInfo(fpid); if (fp != null) { return fp; } try (ProvisioningRuntime rt = buildFullRuntime(fpid, session)) { fp = new FeaturePackInfo(name, fpid, rt.getProvisioningConfig()); populateFeatureContainer(fp, session, rt, true); Caches.addFeaturePackInfo(fpid, fp); } return fp; }
public static Path getFeaturePackDir(Path fpLayoutDir, FPID fpid, boolean existing) throws ProvisioningDescriptionException { final FeaturePackLocation fps = fpid.getLocation(); final UniverseSpec universe = fps.getUniverse(); Path fpPath = fpLayoutDir.resolve(universe.getFactory()); if (universe.getLocation() != null) { fpPath = fpPath.resolve(ensureValidFileName(universe.getLocation())); } fpPath = fpPath.resolve(ensureValidFileName(fps.getProducerName())).resolve(fps.getChannelName()).resolve(ensureValidFileName(fpid.getBuild())); if (existing && !Files.exists(fpPath)) { throw new ProvisioningDescriptionException(Errors.pathDoesNotExist(fpPath)); } return fpPath; }