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);
}
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);
}
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);
}
}
}
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());
}
}
}
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;
}
Aggregations