public static UniverseSpec getUniverseSpec() { if(universeSource == null) { universeSource = new UniverseSpec(LegacyGalleon1UniverseFactory.ID, null); } return universeSource; }
if (other.universeSpec != null) return false; } else if (!universeSpec.equals(other.universeSpec)) return false; return true;
@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; } } } }
if (u.getFactory().equals(LegacyGalleon1UniverseFactory.ID)) { continue; if (!u.equals(defaultUniverse)) { getAllProducers(u.toString(), u, resolver.getUniverse(u), candidates); spec = pmSession.getUniverse().getDefaultUniverseSpec(installation); } else { spec = new UniverseSpec(parsedLocation.getUniverseFactory(), parsedLocation.getUniverseLocation());
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; }
protected UniverseSpec getConfiguredUniverse(FeaturePackLocation source) { return source.hasUniverse() ? universeSpecs.get(source.getUniverse().toString()) : defaultUniverse; }
producerEnd == universeEnd ? null : UniverseSpec.fromString(str.substring(producerEnd + 1, universeEnd)), str.substring(0, producerEnd), universeEnd == channelNameEnd ? null : str.substring(universeEnd + 1, channelNameEnd),
private ProducerSpec() { final int prime = 31; int hash = 1; hash = prime * hash + producer.hashCode(); hash = prime * hash + (universeSpec == null ? 0 : universeSpec.hashCode()); this.hash = hash; }
public FeaturePackLocation getExposedLocation(Path installation, FeaturePackLocation fplocation) { // Expose the default or name. UniverseSpec spec = fplocation.getUniverse(); boolean rewrite = false; String name = getUniverse().getUniverseName(installation, spec); if (name != null) { rewrite = true; spec = new UniverseSpec(name, null); } else if (getUniverse().getDefaultUniverseSpec(installation).equals(spec)) { rewrite = true; spec = null; } if (rewrite) { fplocation = new FeaturePackLocation(spec, fplocation.getProducerName(), fplocation.getChannelName(), fplocation.getFrequency(), fplocation.getBuild()); } return fplocation; } public void enableMavenTrace(boolean b) {
private UniverseSpec getConfiguredUniverse(FeaturePackLocation fpl) throws ProvisioningException, ProvisioningDescriptionException { final ProvisioningConfig config = getProvisioningConfig(); if(config == null) { return null; } if(fpl.hasUniverse()) { final String name = fpl.getUniverse().toString(); if(config.hasUniverse(name)) { return config.getUniverseSpec(name); } return null; } return config.getDefaultUniverse(); }
} else { invoc.getPmSession().getUniverse().visitUniverse(UniverseSpec. fromString(fromUniverse), visitor, true);
private ChannelSpec() { final int prime = 31; int hash = 1; hash = prime * hash + (channel == null ? 0 : channel.hashCode()); hash = prime * hash + producer.hashCode(); hash = prime * hash + (universeSpec == null ? 0 : universeSpec.hashCode()); this.hash = hash; }
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(); }
public static UniverseSpec fromString(String src) { if(src.charAt(src.length() - 1) == FeaturePackLocation.UNIVERSE_LOCATION_END) { final int start = src.indexOf(FeaturePackLocation.UNIVERSE_LOCATION_START); if(start < 2) { throw new IllegalArgumentException("Universe spec '" + src + "' does not follow format factory_id[(location)]"); } return new UniverseSpec(src.substring(0, start), src.substring(start + 1,src.length() - 1)); } return new UniverseSpec(src, null); }
@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; }
static FeaturePackLocation resolveUniverse(FeaturePackDepsConfigBuilder<?> builder, FeaturePackLocation location) throws XMLStreamException { if(location.getUniverse() == null) { if(!builder.hasDefaultUniverse()) { throw new XMLStreamException("Failed to parse feature-pack configuration for " + location + ": default universe was not configured"); } location = new FeaturePackLocation(builder.getDefaultUniverse(), location.getProducerName(), location.getChannelName(), location.getFrequency(), location.getBuild()); } else { final UniverseSpec resolvedConfig = builder.getUniverseSpec(location.getUniverse().toString()); if(resolvedConfig != null) { location = new FeaturePackLocation(resolvedConfig, location.getProducerName(), location.getChannelName(), location.getFrequency(), location.getBuild()); } } return location; }
if (fromUniverse != null) { invoc.getPmSession().getUniverse(). visitUniverse(UniverseSpec.fromString(fromUniverse), visitor, true); } else { invoc.getPmSession().getUniverse().
public FeaturePackLocation(UniverseSpec universeSpec, String producer, String channelName, String frequency, String build) { this.universeSpec = universeSpec; this.producer = producer; this.channel = channelName; this.frequency = frequency; this.build = build; final int prime = 31; int hash = 1; hash = prime * hash + ((build == null) ? 0 : build.hashCode()); hash = prime * hash + ((channel == null) ? 0 : channel.hashCode()); hash = prime * hash + ((frequency == null) ? 0 : frequency.hashCode()); hash = prime * hash + producer.hashCode(); hash = prime * hash + (universeSpec == null ? 0 : universeSpec.hashCode()); this.hash = hash; }
public Universe<?> getUniverse(UniverseSpec universeSpec) throws ProvisioningException { final UniverseFactory factory = getUniverseFactory(universeSpec.getFactory()); return factory.getUniverse(getArtifactResolver(factory.getRepositoryId()), universeSpec.getLocation()); }
public static FeaturePackLocation toFpl(String groupId, String artifactId, String version) { if(version == null) { return new FeaturePackLocation( new UniverseSpec(LegacyGalleon1UniverseFactory.ID, null), groupId + ':' + artifactId, null, null, version); } final int i = version.indexOf('.'); return new FeaturePackLocation( new UniverseSpec(LegacyGalleon1UniverseFactory.ID, null), groupId + ':' + artifactId, i > 0 ? version.substring(0, i) : version, null, version); }