use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class ProvisioningRuntimeBuilder method collectDefaultConfigs.
private void collectDefaultConfigs(FeaturePackConfig fpConfig) throws ProvisioningException {
thisOrigin = layout.getFeaturePack(fpConfig.getLocation().getProducer());
final FeaturePackRuntimeBuilder parentFp = setOrigin(thisOrigin);
try {
if (fpConfig.hasDefinedConfigs()) {
for (ConfigModel config : fpConfig.getDefinedConfigs()) {
final ConfigId id = config.getId();
if (id.isModelOnly() || fpConfigStack.isFilteredOut(thisOrigin.producer, id, true)) {
continue;
}
ConfigModelStack configStack = configsToBuild.get(id);
if (configStack == null) {
configStack = getConfigStack(id);
configsToBuild = CollectionUtils.putLinked(configsToBuild, id, configStack);
}
}
}
if (!fpConfig.isTransitive()) {
if (fpConfig.hasIncludedConfigs()) {
for (ConfigId id : fpConfig.getIncludedConfigs()) {
collectConfigIfNotFiltered(thisOrigin.producer, id);
}
}
final FeaturePackSpec currentSpec = currentOrigin.getSpec();
if (currentSpec.hasDefinedConfigs()) {
for (ConfigModel config : currentSpec.getDefinedConfigs()) {
collectConfigIfNotFiltered(thisOrigin.producer, config.getId());
}
}
if (currentSpec.hasFeaturePackDeps()) {
boolean extendedStackLevel = false;
if (currentSpec.hasTransitiveDeps()) {
for (FeaturePackConfig fpDep : currentSpec.getTransitiveDeps()) {
extendedStackLevel |= fpConfigStack.push(fpDep, extendedStackLevel);
}
}
for (FeaturePackConfig fpDep : currentSpec.getFeaturePackDeps()) {
extendedStackLevel |= fpConfigStack.push(fpDep, extendedStackLevel);
}
if (extendedStackLevel) {
while (fpConfigStack.hasNext()) {
collectDefaultConfigs(fpConfigStack.next());
}
}
if (extendedStackLevel) {
fpConfigStack.popLevel();
}
}
}
} finally {
this.thisOrigin = parentFp;
setOrigin(parentFp);
}
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class ProvisioningRuntimeBuilder method resolveModelOnlyConfig.
private ConfigModelStack resolveModelOnlyConfig(FeaturePackConfig fpConfig, ConfigModelStack modelOnlyStack, ConfigId configId) throws ProvisioningException {
final FeaturePackRuntimeBuilder fp = layout.getFeaturePack(fpConfig.getLocation().getProducer());
if (!setFlag(fp, FeaturePackRuntimeBuilder.RESOLVE_MODEL_ONLY_CONFIG)) {
return modelOnlyStack;
}
final FeaturePackRuntimeBuilder prevOrigin = currentOrigin;
try {
int pushedCount = 0;
ConfigModel config = fpConfig.getDefinedConfig(configId);
if (config != null) {
if (modelOnlyStack == null) {
modelOnlyStack = new ConfigModelStack(configId, this);
}
modelOnlyStack.pushConfig(config);
++pushedCount;
}
config = fp.getSpec().getDefinedConfig(configId);
if (config != null) {
if (modelOnlyStack == null) {
modelOnlyStack = new ConfigModelStack(configId, this);
}
modelOnlyStack.pushConfig(config);
++pushedCount;
}
config = fp.getConfig(configId);
if (config != null) {
if (modelOnlyStack == null) {
modelOnlyStack = new ConfigModelStack(configId, this);
}
modelOnlyStack.pushConfig(config);
++pushedCount;
}
boolean extendedStackLevel = false;
if (fp.getSpec().hasTransitiveDeps()) {
for (FeaturePackConfig fpDep : fp.getSpec().getTransitiveDeps()) {
extendedStackLevel |= fpConfigStack.push(fpDep, extendedStackLevel);
}
}
if (fp.getSpec().hasFeaturePackDeps()) {
for (FeaturePackConfig fpDep : fp.getSpec().getFeaturePackDeps()) {
extendedStackLevel |= fpConfigStack.push(fpDep, extendedStackLevel);
if (fpDep.isConfigModelExcluded(configId) || !fpDep.isInheritModelOnlyConfigs() && !fpDep.isConfigModelIncluded(configId)) {
continue;
}
modelOnlyStack = resolveModelOnlyConfig(fpDep, modelOnlyStack, configId);
}
}
while (pushedCount > 0) {
setOrigin(fp);
processConfig(modelOnlyStack, popConfig(modelOnlyStack));
--pushedCount;
}
if (extendedStackLevel) {
fpConfigStack.popLevel();
}
} finally {
setOrigin(prevOrigin);
}
return modelOnlyStack;
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class ProvisioningRuntimeBuilder method resolveConfigLayer.
private ConfigModelStack resolveConfigLayer(ConfigId layerId) throws ProvisioningException {
ConfigModelStack layerStack = layers.get(layerId);
if (layerStack == null) {
layerStack = new ConfigModelStack(layerId, this);
boolean resolved = false;
for (FeaturePackConfig fpConfig : config.getFeaturePackDeps()) {
resolved |= resolveConfigLayer(fpConfig.getLocation().getProducer(), layerStack, layerId);
}
clearFlag(FeaturePackRuntimeBuilder.RESOLVE_LAYER);
if (!resolved) {
throw new ProvisioningException(Errors.layerNotFound(layerId));
}
layers = CollectionUtils.put(layers, layerId, layerStack);
}
return layerStack;
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class ProvisioningDiffProvider method getFpcBuilder.
private FeaturePackConfig.Builder getFpcBuilder(FPID fpid) {
FeaturePackConfig.Builder fpcBuilder = updatedDirectFps.get(fpid);
if (fpcBuilder != null) {
return fpcBuilder;
}
fpcBuilder = updatedTransitiveFps.get(fpid);
if (fpcBuilder != null) {
return fpcBuilder;
}
fpcBuilder = addedTransitiveFps.get(fpid);
if (fpcBuilder != null) {
return fpcBuilder;
}
FeaturePackConfig fpc = provisionedConfig.getFeaturePackDep(fpid.getProducer());
if (fpc != null) {
fpcBuilder = FeaturePackConfig.builder(fpc);
updatedDirectFps = CollectionUtils.put(updatedDirectFps, fpid, fpcBuilder);
return fpcBuilder;
}
fpc = provisionedConfig.getTransitiveDep(fpid.getProducer());
if (fpc != null) {
fpcBuilder = FeaturePackConfig.builder(fpc);
updatedTransitiveFps = CollectionUtils.put(updatedTransitiveFps, fpid, fpcBuilder);
return fpcBuilder;
}
fpcBuilder = FeaturePackConfig.transitiveBuilder(fpid.getLocation());
addedTransitiveFps = CollectionUtils.putLinked(addedTransitiveFps, fpid, fpcBuilder);
return fpcBuilder;
}
use of org.jboss.galleon.config.FeaturePackConfig in project galleon by wildfly.
the class ProvisioningLayout method addFpDeps.
protected void addFpDeps(final ProvisioningConfig.Builder builder, Collection<FeaturePackConfig> deps) throws ProvisioningDescriptionException {
for (FeaturePackConfig fpConfig : deps) {
final ProducerSpec producer = fpConfig.getLocation().getProducer();
final FeaturePackLocation resolvedFpl = resolvedVersions.remove(producer);
if (resolvedFpl != null) {
builder.addFeaturePackDep(config.originOf(producer), FeaturePackConfig.builder(resolvedFpl).init(fpConfig).build());
} else {
builder.addFeaturePackDep(config.originOf(producer), fpConfig);
}
}
}
Aggregations