Search in sources :

Example 21 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec in project galleon by wildfly.

the class UniverseManager method addUniverse.

public void addUniverse(Path installation, String name, String factory, String location) throws ProvisioningException, IOException {
    UniverseSpec u = new UniverseSpec(factory, location);
    ProvisioningManager mgr = getProvisioningManager(installation);
    if (name != null) {
        mgr.addUniverse(name, u);
    } else {
        mgr.setDefaultUniverse(u);
    }
    resolveUniverse(u);
}
Also used : ProvisioningManager(org.jboss.galleon.ProvisioningManager) UniverseSpec(org.jboss.galleon.universe.UniverseSpec)

Example 22 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec in project galleon by wildfly.

the class UniverseManager method addUniverse.

public void addUniverse(String name, String factory, String location) throws ProvisioningException, IOException {
    UniverseSpec u = new UniverseSpec(factory, location);
    pmSession.getState().addUniverse(pmSession, name, factory, location);
    resolveUniverse(u);
}
Also used : UniverseSpec(org.jboss.galleon.universe.UniverseSpec)

Example 23 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec in project galleon by wildfly.

the class UniverseManager method visitAllUniverses.

public void visitAllUniverses(UniverseVisitor visitor, boolean allBuilds, Path installation) {
    try {
        visit(visitor, getUniverse(builtinUniverseSpec), builtinUniverseSpec, allBuilds);
    } catch (ProvisioningException ex) {
        visitor.exception(builtinUniverseSpec, ex);
    }
    UniverseSpec defaultUniverse = getDefaultUniverseSpec(null);
    try {
        if (defaultUniverse != null && !builtinUniverseSpec.equals(defaultUniverse)) {
            visit(visitor, getUniverse(defaultUniverse), defaultUniverse, allBuilds);
        }
    } catch (ProvisioningException ex) {
        visitor.exception(defaultUniverse, ex);
    }
    Set<String> universes = getUniverseNames(installation);
    for (String u : universes) {
        UniverseSpec universeSpec = getUniverseSpec(installation, u);
        try {
            visit(visitor, getUniverse(universeSpec), universeSpec, allBuilds);
        } catch (ProvisioningException ex) {
            visitor.exception(universeSpec, ex);
        }
    }
}
Also used : ProvisioningException(org.jboss.galleon.ProvisioningException) UniverseSpec(org.jboss.galleon.universe.UniverseSpec)

Example 24 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec in project galleon by wildfly.

the class ProvisioningXmlWriter method writeUniverseSpecs.

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());
        }
    }
}
Also used : ElementNode(org.jboss.galleon.xml.util.ElementNode) UniverseSpec(org.jboss.galleon.universe.UniverseSpec) Map(java.util.Map)

Example 25 with UniverseSpec

use of org.jboss.galleon.universe.UniverseSpec 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)

Aggregations

UniverseSpec (org.jboss.galleon.universe.UniverseSpec)29 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)18 Test (org.junit.Test)14 ProvisioningException (org.jboss.galleon.ProvisioningException)6 ProvisioningManager (org.jboss.galleon.ProvisioningManager)4 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)4 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)4 Path (java.nio.file.Path)3 ChannelSpec (org.jboss.galleon.universe.FeaturePackLocation.ChannelSpec)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)2 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)2 UniverseVisitor (org.jboss.galleon.cli.UniverseManager.UniverseVisitor)2 Table (org.jboss.galleon.cli.cmd.Table)2 Producer (org.jboss.galleon.universe.Producer)2 IOException (java.io.IOException)1 Comparator (java.util.Comparator)1