Search in sources :

Example 26 with ProvisioningDescriptionException

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;
}
Also used : FeatureGroup(org.jboss.galleon.config.FeatureGroup) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 27 with ProvisioningDescriptionException

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);
}
Also used : ConfigModel(org.jboss.galleon.config.ConfigModel) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 28 with ProvisioningDescriptionException

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;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 29 with ProvisioningDescriptionException

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);
    }
}
Also used : ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 30 with ProvisioningDescriptionException

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);
}
Also used : ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Aggregations

ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)41 XMLStreamException (javax.xml.stream.XMLStreamException)19 Path (java.nio.file.Path)12 IOException (java.io.IOException)9 ProvisioningException (org.jboss.galleon.ProvisioningException)8 BufferedReader (java.io.BufferedReader)6 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)6 ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)5 HashMap (java.util.HashMap)4 FeatureGroup (org.jboss.galleon.config.FeatureGroup)4 FeaturePackSpec (org.jboss.galleon.spec.FeaturePackSpec)4 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)4 UnsatisfiedPackageDependencyException (org.jboss.galleon.UnsatisfiedPackageDependencyException)3 ConfigId (org.jboss.galleon.config.ConfigId)3 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)3 Reader (java.io.Reader)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 ConfigModel (org.jboss.galleon.config.ConfigModel)2 FeatureConfig (org.jboss.galleon.config.FeatureConfig)2