use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class ProvisioningRuntimeBuilder method getFeatureGroupSpec.
/**
* NOTE: this method will change the current origin to the origin of the group!
*/
private FeatureGroup getFeatureGroupSpec(String name) throws ProvisioningException {
final FeatureGroup fg = getFeatureGroupSpec(currentOrigin, name);
clearFlag(FeaturePackRuntimeBuilder.VISIT);
if (fg == null) {
throw new ProvisioningDescriptionException("Failed to locate feature group '" + name + "' in " + (currentOrigin == null ? "the provisioning configuration" : currentOrigin.producer + " and its dependencies"));
}
return fg;
}
use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class ProvisioningRuntimeBuilder method doBuild.
private ProvisioningRuntime doBuild() throws ProvisioningException {
config = layout.getConfig();
fpConfigStack = new FpStack(config);
final String optionalPackages = layout.getOptionValue(ProvisioningOption.OPTIONAL_PACKAGES);
switch(optionalPackages) {
case Constants.ALL:
pkgDepMask = PKG_DEP_MASK_ALL;
includedPkgDeps = PKG_DEP_ALL;
break;
case Constants.PASSIVE_PLUS:
pkgDepMask = PKG_DEP_MASK_ALL;
includedPkgDeps = PKG_DEP_PASSIVE_PLUS;
break;
case Constants.PASSIVE:
pkgDepMask = PKG_DEP_MASK_PASSIVE;
includedPkgDeps = PKG_DEP_PASSIVE;
break;
case Constants.NONE:
pkgDepMask = PKG_DEP_MASK_REQUIRED;
includedPkgDeps = PKG_DEP_REQUIRED;
break;
default:
throw new ProvisioningDescriptionException(Errors.pluginOptionIllegalValue(ProvisioningOption.OPTIONAL_PACKAGES.getName(), optionalPackages, ProvisioningOption.OPTIONAL_PACKAGES.getValueSet()));
}
collectDefaultConfigs();
List<ConfigModelStack> configStacks = Collections.emptyList();
if (config.hasDefinedConfigs()) {
for (ConfigModel config : config.getDefinedConfigs()) {
if (config.getId().isModelOnly()) {
continue;
}
configStack = configsToBuild.get(config.getId());
configStacks = pushConfig(configStacks, config);
}
}
final boolean extendedStackLevel = processFpDepConfigs(config);
for (int i = configStacks.size() - 1; i >= 0; --i) {
final ConfigModelStack configStack = configStacks.get(i);
processConfig(configStack, popConfig(configStack));
}
if (extendedStackLevel) {
fpConfigStack.popLevel();
}
mergeModelOnlyConfigs();
return new ProvisioningRuntime(this, messageWriter);
}
use of org.jboss.galleon.ProvisioningDescriptionException 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;
}
use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class ResolvedFeatureSpec method resolveRefMapping.
private ResolvedFeatureSpec resolveRefMapping(ProvisioningRuntimeBuilder rt, FeaturePackRuntimeBuilder origin, FeatureReferenceSpec refSpec) throws ProvisioningException {
try {
if (refSpec.getOrigin() != null) {
origin = rt.layout.getFeaturePack(origin.getSpec().getFeaturePackDep(refSpec.getOrigin()).getLocation().getProducer());
}
final ResolvedFeatureSpec resolvedRefSpec = rt.getFeatureSpec(origin, refSpec.getFeature().getName());
assertRefParamMapping(refSpec, resolvedRefSpec);
return resolvedRefSpec;
} catch (ProvisioningDescriptionException e) {
throw new ProvisioningDescriptionException(Errors.failedToResolveFeatureReference(refSpec, id), e);
}
}
use of org.jboss.galleon.ProvisioningDescriptionException in project galleon by wildfly.
the class CapabilitySpec method fromString.
public static CapabilitySpec fromString(String str, boolean optional) throws ProvisioningDescriptionException {
if (str == null) {
throw new ProvisioningDescriptionException("str is null");
}
if (str.isEmpty()) {
throw new ProvisioningDescriptionException("str is empty");
}
List<String> elems = Collections.emptyList();
List<Boolean> isElemStatic = Collections.emptyList();
int strI = 0;
final StringBuilder buf = new StringBuilder();
boolean isStatic = true;
while (strI < str.length()) {
final char ch = str.charAt(strI++);
switch(ch) {
case '.':
{
if (buf.length() == 0) {
formatError(str);
}
if (isStatic) {
if (buf.charAt(buf.length() - 1) == '.') {
formatError(str);
}
if (strI < str.length() && str.charAt(strI) != '$') {
buf.append('.');
break;
}
}
elems = CollectionUtils.add(elems, buf.toString());
isElemStatic = CollectionUtils.add(isElemStatic, isStatic);
buf.setLength(0);
isStatic = true;
break;
}
case '$':
{
if (strI > 1 && str.charAt(strI - 2) != '.') {
formatError(str);
}
isStatic = false;
break;
}
default:
{
if (Character.isWhitespace(ch)) {
throw new ProvisioningDescriptionException("Whitespaces are not allowed in a capability expression '" + str + "'");
}
buf.append(ch);
}
}
}
if (buf.length() == 0) {
formatError(str);
}
elems = CollectionUtils.add(elems, buf.toString());
isElemStatic = CollectionUtils.add(isElemStatic, isStatic);
return new CapabilitySpec(elems, isElemStatic, optional);
}
Aggregations