Search in sources :

Example 21 with ProducerSpec

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;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 22 with ProducerSpec

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;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) ProvisioningException(org.jboss.galleon.ProvisioningException)

Example 23 with ProducerSpec

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;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 24 with ProducerSpec

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());
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Test(org.junit.Test)

Aggregations

ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)24 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)9 ProvisioningException (org.jboss.galleon.ProvisioningException)8 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)8 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)5 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)4 UniverseSpec (org.jboss.galleon.universe.UniverseSpec)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)2 Table (org.jboss.galleon.cli.cmd.Table)2 FeaturePackSpec (org.jboss.galleon.spec.FeaturePackSpec)2 Path (java.nio.file.Path)1