public FeaturePackLocation getResolvedLocation(Path installation, String location) throws ProvisioningException { if (location.endsWith("" + FeaturePackLocation.FREQUENCY_START) || location.endsWith("" + FeaturePackLocation.BUILD_START)) { location = location.substring(0, location.length() - 1); } // A producer spec without any universe nor channel. if (!location.contains("" + FeaturePackLocation.UNIVERSE_START) && !location.contains("" + FeaturePackLocation.CHANNEL_START)) { location = new FeaturePackLocation(universe.getDefaultUniverseSpec(installation), location, null, null, null).toString(); } FeaturePackLocation loc = FeaturePackLocation.fromString(location); return getResolvedLocation(installation, loc); }
public FeaturePackLocation getUserConfiguredLocation(FeaturePackLocation fpl) { final UniverseSpec universeSource = fpl.getUniverse(); if(defaultUniverse != null && defaultUniverse.equals(universeSource)) { return new FeaturePackLocation(null, fpl.getProducerName(), fpl.getChannelName(), fpl.getFrequency(), fpl.getBuild()); } for (Map.Entry<String, UniverseSpec> entry : universeSpecs.entrySet()) { if (entry.getValue().equals(universeSource)) { return new FeaturePackLocation(new UniverseSpec(entry.getKey(), null), fpl.getProducerName(), fpl.getChannelName(), fpl.getFrequency(), fpl.getBuild()); } } return fpl; }
public static String formatChannel(FeaturePackLocation loc) { String channel = loc.getFrequency() == null ? loc.getChannel().getName() : loc.getChannel().getName() + "/" + loc.getFrequency(); return (loc.getUniverse() == null ? "" : loc.getUniverse() + "@") + channel; }
public static FPID newFPID(String producer, String channel, String build) { return new FeaturePackLocation(getUniverseSpec(), producer, channel, null, build).getFPID(); }
/** * Resolves feature-pack location to a path in a local repository * * @param fpl feature-pack location * @return local feature-pack path * @throws ProvisioningException in case the feature-pack could not be resolved */ public Path resolve(FeaturePackLocation fpl) throws ProvisioningException { if (localFeaturePacks.containsKey(fpl.getFPID())) { return localFeaturePacks.get(fpl.getFPID()); } return getUniverse(fpl.getUniverse()).getProducer(fpl.getProducerName()).getChannel(fpl.getChannelName()).resolve(fpl); }
@Override public void visit(Producer<?> producer, FeaturePackLocation loc) { try { if (resolvedOnly && !producer.getChannel(loc.getChannelName()).isResolved(loc)) { return; exception(loc.getUniverse(), ex); return; tracker.processing(loc.getFPID()); boolean canonicalMatch = compiledPattern.matcher(loc.toString()).matches(); boolean exposedMatch = compiledPattern.matcher(exposedLoc.toString()).matches(); if ((containsFrequency && loc.getFrequency() != null) || (!containsFrequency && loc.getFrequency() == null)) { Result result; if (exposedMatch) { Set<Result> locations = results.get(loc.getUniverse()); if (locations == null) { locations = new TreeSet<>(locComparator); results.put(loc.getUniverse(), locations); exception(loc.getUniverse(), ex); Set<Result> locations = results.get(loc.getUniverse()); if (locations == null) { locations = new TreeSet<>(locComparator); results.put(loc.getUniverse(), locations);
public ProducerSpec getProducer() { return FeaturePackLocation.this.getProducer(); }
@Override public FeaturePackLayout newFeaturePack(FeaturePackLocation fpl, FeaturePackSpec fpSpec, Path dir, int type) { return new FeaturePackLayout(fpl.getFPID(), dir, type) { @Override public FeaturePackSpec getSpec() { return fpSpec; } }; }}, false); }
static FeaturePackLocation parseFpl(XMLExtendedStreamReader reader, int i) throws XMLStreamException { try { return FeaturePackLocation.fromString(reader.getAttributeValue(i)); } catch(IllegalArgumentException e) { throw ParsingUtils.error("Failed to parse feature-pack location " + reader.getAttributeValue(i), reader.getLocation(), e); } } }
getResolvedLocation(mgr.getInstallationHome(), producer); if (loc.hasBuild()) { locs.add(loc); } else { resolved.add(loc.getProducer()); String update = p.hasNewLocation() ? p.getNewLocation().getBuild() : NONE; Cell patches = null; if (hasPatches) { line.add(new Cell(loc.getProducerName())); line.add(new Cell(loc.getBuild())); line.add(new Cell(update)); if (hasPatches) {
throw new ProvisioningDescriptionException("Feature-pack location has not been set"); if(fps.getProducerName() == null) { throw new ProvisioningDescriptionException("Feature-pack producer has not been set"); if(fps.getChannelName() == null) { throw new ProvisioningDescriptionException("Feature-pack channel has not been set"); if(fps.getBuild() == null) { throw new ProvisioningDescriptionException("Feature-pack build number has not been set"); final Path fpWorkDir = LayoutUtils.getFeaturePackDir(creator.getWorkDir(), fps.getFPID(), false); final FeaturePackSpec fpSpec; try { tasks.execute(FsTaskContext.builder().setTargetRoot(fpWorkDir.resolve(Constants.RESOURCES)).build()); creator.install(fps.getFPID(), fpWorkDir); } catch(ProvisioningDescriptionException e) { throw e;
public boolean isResolved(FeaturePackLocation fpl) throws ProvisioningException { return getUniverse(fpl.getUniverse()).getProducer(fpl.getProducerName()).getChannel(fpl.getChannelName()).isResolved(fpl); }
transitiveDeps.add(fpl.getProducer()); if(transitiveConfig.hasPatches()) { addPatches(transitiveConfig); if(branch.containsKey(fpl.getProducer())) { continue; if(fpl.getBuild() == null) { continue; branch.put(fpl.getProducer(), fpl.getFPID()); added = CollectionUtils.add(added, fpl.getProducer()); final FPID branchId = branch.get(fpl.getProducer()); if(branchId == null) { if(fpl.getBuild() == null) { fpl = layoutFactory.getUniverseResolver().resolveLatestBuild(fpl); if(resolvedVersions == null) { resolvedVersions = new LinkedHashMap<>(); resolvedVersions.put(fpl.getProducer(), fpl); } else if(!branchId.getBuild().equals(fpl.getBuild())) { fpl = fpl.replaceBuild(branchId.getBuild()); F fp = featurePacks.get(fpl.getProducer()); if(fp != null) { if(branchId == null && !fpl.getBuild().equals(fp.getFPID().getBuild())) { Set<FPID> versions = conflicts.get(fp.getFPID().getProducer());
Set<ProducerSpec> processed = new HashSet<>(updates.size()); for(FeaturePackConfig fpConfig : config.getFeaturePackDeps()) { 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 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()); uninstall(producer.getLocation().getFPID(), configBuilder);
@Override public void visit(Producer<?> producer, FeaturePackLocation loc) { if (loc.getFrequency() == null) { return; } if (allFrequencies || loc.getFrequency().equals(producer.getDefaultFrequency())) { Table table = tables.get(loc.getUniverse()); if (table == null) { table = new Table(Headers.PRODUCT, Headers.UPDATE_CHANNEL, Headers.LATEST_BUILD); tables.put(loc.getUniverse(), table); } loc = invoc.getPmSession().getExposedLocation(finalPath, loc); table.addLine(producer.getName(), StateInfoUtil.formatChannel(loc), (loc.getBuild() == null ? NONE : loc.getBuild())); } }
long lastUsage = Long.decode(time); Path p = LayoutUtils.getFeaturePackDir(config.getLayoutCache(), FeaturePackLocation.fromString(k).getFPID()); if (!Files.exists(p)) { toRemove.add(k); toRemove.add(k); try { cacheManager.remove(FeaturePackLocation.fromString(k).getFPID()); } catch (ProvisioningException ex) { CliLogging.exception(ex);
for (FeaturePackLocation d : dependencies) { List<Cell> line = new ArrayList<>(); line.add(new Cell(d.getProducerName())); line.add(new Cell(d.getBuild())); if (showPatches) { FeaturePackConfig config = configs.get(d.getFPID()); if (config != null && config.hasPatches()) { Cell patches = new Cell();
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; }
public static void printFeaturePack(PmCommandInvocation commandInvocation, FeaturePackLocation loc) { loc = commandInvocation.getPmSession().getExposedLocation(null, loc); Table t = new Table(Headers.PRODUCT, Headers.BUILD, Headers.UPDATE_CHANNEL); t.addLine(loc.getProducer().getName(), loc.getBuild(), formatChannel(loc)); commandInvocation.print(t.build()); }
specId = new ResolvedSpecId(FeaturePackLocation.fromString(str.substring(1, i)).getProducer(), str.substring(i + 1, colon)); } catch (IllegalArgumentException e) { throw new ProvisioningDescriptionException("Failed to parse the channel part of feature id '" + str + "'", e);