use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class ProvisioningRuntimeBuilder method popLayer.
private FeatureGroupSupport popLayer(ConfigModelStack layerStack) throws ProvisioningException {
final FeatureGroupSupport fg = layerStack.peekAtGroup();
if (!(fg instanceof ConfigLayerSpec)) {
throw new ProvisioningException("Expected config layer but got " + fg);
}
final ConfigLayerSpec layer = (ConfigLayerSpec) fg;
if (layer.hasLayerDeps()) {
for (ConfigLayerDependency dep : layer.getLayerDeps()) {
layerStack.addLayerDep(dep);
}
}
layerStack.popGroup();
return fg;
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class ProvisioningRuntimeBuilder method processConfig.
private void processConfig(ConfigModelStack configStack, ConfigModel config) throws ProvisioningException {
this.configStack = configStack;
configStack.overwriteProps(config.getProperties());
configStack.overwriteConfigDeps(config.getConfigDeps());
try {
if (config.hasPackageDeps()) {
if (currentOrigin == null) {
throw new ProvisioningDescriptionException(Errors.topConfigsCantDefinePackageDeps(config.getId()));
}
processPackageDeps(config, null);
}
processConfigItemContainer(config);
this.configStack = null;
} catch (ProvisioningException e) {
throw new ProvisioningException(Errors.failedToResolveConfigSpec(config.getModel(), config.getName()), e);
}
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class CapabilityResolver method resolve.
List<String> resolve(CapabilitySpec capSpec, ResolvedFeature feature) throws ProvisioningException {
if (capSpec.isStatic()) {
return Collections.singletonList(capSpec.toString());
}
if (capBuf == null) {
capBuf = new StringBuilder();
}
this.feature = feature;
this.capSpec = capSpec;
try {
if (!capSpec.resolve(this)) {
return Collections.emptyList();
}
if (capList == null) {
return capBuf.length() == 0 ? Collections.emptyList() : Collections.singletonList(capBuf.toString());
}
List<String> resolved = new ArrayList<>(capList.size());
for (int i = 0; i < capList.size(); ++i) {
resolved.add(capList.get(i).toString());
}
return resolved;
} catch (ProvisioningException e) {
throw new ProvisioningException(Errors.failedToResolveCapability(feature, capSpec), e);
} finally {
reset();
}
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class DefaultBranchedConfigArranger method orderCapabilityProviders.
private List<CircularRefInfo> orderCapabilityProviders(ResolvedFeature feature, List<CircularRefInfo> circularRefs) throws ProvisioningException {
for (CapabilitySpec capSpec : feature.spec.xmlSpec.getRequiredCapabilities()) {
final List<String> resolvedCaps = capResolver.resolve(capSpec, feature);
if (resolvedCaps.isEmpty()) {
continue;
}
for (String resolvedCap : resolvedCaps) {
final CapabilityProviders providers;
try {
providers = getProviders(resolvedCap, false);
} catch (ProvisioningException e) {
throw new ProvisioningException(Errors.noCapabilityProvider(feature, capSpec, resolvedCap));
}
circularRefs = CollectionUtils.addAll(circularRefs, orderProviders(providers));
if (providers.isProvided()) {
feature.addBranchDep(providers.branches.iterator().next(), false);
// System.out.println("added branch dep on cap provider " + feature.getId() + " -> " + providers.branches);
} else {
providers.addBranchDependee(feature);
}
}
}
return circularRefs;
}
use of org.jboss.galleon.ProvisioningException in project galleon by wildfly.
the class DefaultBranchedConfigArranger method orderFeatures.
List<ResolvedFeature> orderFeatures() throws ProvisioningException {
try {
doOrder(configStack.rt);
} catch (ProvisioningException e) {
throw new ProvisioningException(Errors.failedToBuildConfigSpec(configStack.id.getModel(), configStack.id.getName()), e);
}
orderedFeatures = new ArrayList<>(features.size());
if (getBooleanProp(configStack.props, ConfigModel.MERGE_SAME_DEPS_BRANCHES, false)) {
this.branchesByDeps = new LinkedHashMap<>(featureBranches.size());
for (ConfigFeatureBranch branch : featureBranches) {
orderAndMergeBranchesWithSameDeps(branch);
}
for (List<ResolvedFeature> features : branchesByDeps.values()) {
if (features.size() == 1) {
final ResolvedFeature feature = features.get(0);
if (feature.isBatchStart()) {
feature.clearBatchStart();
feature.clearBatchEnd();
}
orderedFeatures.add(feature);
} else {
orderedFeatures.addAll(features);
}
}
return orderedFeatures;
}
for (ConfigFeatureBranch branch : featureBranches) {
orderBranches(branch);
}
if (!mergeIndependentBranches) {
return orderedFeatures;
}
List<ResolvedFeature> result = new ArrayList<>(features.size());
if (!independentNonBatchBranch.isEmpty()) {
result.addAll(independentNonBatchBranch);
}
if (!independentBatchBranch.isEmpty()) {
if (independentBatchBranch.size() == 1) {
final ResolvedFeature firstFeature = independentBatchBranch.get(0);
firstFeature.clearBatchStart();
firstFeature.clearBatchEnd();
} else {
independentBatchBranch.get(0).startBatch();
independentBatchBranch.get(independentBatchBranch.size() - 1).endBatch();
}
result.addAll(independentBatchBranch);
}
result.addAll(orderedFeatures);
return result;
}
Aggregations