use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.
the class ProvisioningPlan method install.
public ProvisioningPlan install(FeaturePackConfig fpConfig) throws ProvisioningDescriptionException {
final ProducerSpec producer = fpConfig.getLocation().getProducer();
if (uninstall.contains(producer) || updates.containsKey(producer)) {
throw new ProvisioningDescriptionException(producer + " has already been added to the plan");
}
install = CollectionUtils.putLinked(install, producer, fpConfig);
return this;
}
use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.
the class FeaturePackDepsConfigBuilder method removeFeaturePackDep.
@SuppressWarnings("unchecked")
public B removeFeaturePackDep(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().getFPID().equals(fpl.getFPID())) {
throw new ProvisioningException(Errors.unknownFeaturePack(fpl.getFPID()));
}
if (fpDeps.size() == 1) {
fpDeps = Collections.emptyMap();
} else {
fpDeps = CollectionUtils.remove(fpDeps, producer);
}
updateOriginMappings(producer);
return (B) this;
}
use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.
the class FeaturePackDepsConfigBuilder method addFeaturePackDep.
@SuppressWarnings("unchecked")
public B addFeaturePackDep(int index, FeaturePackConfig dependency) throws ProvisioningDescriptionException {
if (index >= fpDeps.size()) {
addFeaturePackDep(dependency);
return (B) this;
}
FeaturePackLocation fpl = dependency.getLocation();
final UniverseSpec resolvedUniverse = getConfiguredUniverse(fpl);
if (resolvedUniverse != null) {
fpl = fpl.replaceUniverse(resolvedUniverse);
dependency = FeaturePackConfig.builder(fpl).init(dependency).build();
}
if (fpDeps.containsKey(fpl.getProducer())) {
throw new ProvisioningDescriptionException(Errors.featurePackAlreadyConfigured(fpl.getProducer()));
}
// reconstruct the linkedMap.
Map<ProducerSpec, FeaturePackConfig> tmp = Collections.emptyMap();
int i = 0;
for (Entry<ProducerSpec, FeaturePackConfig> entry : fpDeps.entrySet()) {
if (i == index) {
tmp = CollectionUtils.putLinked(tmp, fpl.getProducer(), dependency);
}
tmp = CollectionUtils.putLinked(tmp, entry.getKey(), entry.getValue());
i += 1;
}
fpDeps = tmp;
return (B) this;
}
use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.
the class FeaturePackLocationStringTestCase method testMavenProducerWithUniverseToString.
@Test
public void testMavenProducerWithUniverseToString() throws Exception {
final ProducerSpec producer = new FeaturePackLocation(new UniverseSpec("maven", "org.jboss.universe:jboss-universe:1.0.0.Final"), "producer", "channel", "frequency", "build").getProducer();
Assert.assertEquals("producer@maven(org.jboss.universe:jboss-universe:1.0.0.Final)", producer.toString());
}
Aggregations