private static String buildUniverses(ProvisioningConfig config) throws ProvisioningException { UniverseSpec defaultUniverse = config.getDefaultUniverse(); StringBuilder builder = new StringBuilder(); if (defaultUniverse != null || !config.getUniverseNamedSpecs().isEmpty()) { builder.append("Universes").append(Config.getLineSeparator()); Table t = new Table(Headers.NAME, Headers.UNIVERSE_FACTORY, Headers.UNIVERSE_LOCATION); if (defaultUniverse != null) { t.addLine("<default>", defaultUniverse.getFactory(), defaultUniverse.getLocation()); } for (Entry<String, UniverseSpec> entry : config.getUniverseNamedSpecs().entrySet()) { t.addLine(entry.getKey(), entry.getValue().getFactory(), entry.getValue().getLocation()); } t.sort(Table.SortType.ASCENDANT); builder.append(t.build()); } return builder.length() == 0 ? null : builder.toString(); }
@Override public void completeUniverseLocation(FPLocationParser.ParsedFPLocation parsedLocation, String universeLocation) throws FPLocationParserException, ProvisioningException { for (String name : aliases) { UniverseSpec spec = pmSession.getUniverse().getUniverseSpec(installation, name); if (spec == null || spec.getFactory().equals(LegacyGalleon1UniverseFactory.ID)) { continue; } if (!candidates.contains(spec.getLocation())) { if (spec.getFactory().equals(parsedLocation.getUniverseFactory()) && resolver.getUniverse(spec).hasProducer(parsedLocation.getProducer())) { if (spec.getLocation().equals(universeLocation)) { candidates.add(spec.getLocation() + FeaturePackLocation.UNIVERSE_LOCATION_END); } else if (spec.getLocation().startsWith(universeLocation)) { candidates.add(spec.getLocation()); } break; } } } }
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; }
static void writeUniverseSpecs(FeaturePackDepsConfig fpDeps, final ElementNode parent) { ElementNode universesEl = null; UniverseSpec universeSpec = fpDeps.getDefaultUniverse(); if(universeSpec != null) { universesEl = addElement(parent, Element.UNIVERSES.getLocalName(), parent.getNamespace()); writeUniverseConfig(universesEl, null, universeSpec.getFactory(), universeSpec.getLocation()); } if(fpDeps.hasUniverseNamedSpecs()) { if(universesEl == null) { universesEl = addElement(parent, Element.UNIVERSES.getLocalName(), parent.getNamespace()); } for(Map.Entry<String, UniverseSpec> universe : fpDeps.getUniverseNamedSpecs().entrySet()) { writeUniverseConfig(universesEl, universe.getKey(), universe.getValue().getFactory(), universe.getValue().getLocation()); } } }
public Universe<?> getUniverse(UniverseSpec universeSpec) throws ProvisioningException { final UniverseFactory factory = getUniverseFactory(universeSpec.getFactory()); return factory.getUniverse(getArtifactResolver(factory.getRepositoryId()), universeSpec.getLocation()); }
private FeaturePackLocation getResolvedLocation(Path installation, FeaturePackLocation fplocation) throws ProvisioningException { UniverseSpec spec = fplocation.getUniverse(); if (spec != null) { if (spec.getLocation() == null) { spec = universe.getUniverseSpec(installation, spec.getFactory()); if (spec == null) { throw new ProvisioningException("Unknown universe for " + fplocation); } } } else { spec = universe.getDefaultUniverseSpec(installation); } return new FeaturePackLocation(spec, fplocation.getProducerName(), fplocation.getChannelName(), fplocation.getFrequency(), fplocation.getBuild()); }
if (u.getFactory().equals(LegacyGalleon1UniverseFactory.ID)) { continue;