Search in sources :

Example 16 with ProducerSpec

use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.

the class FpStack method isRelevant.

private boolean isRelevant(FeaturePackConfig fpConfig) {
    if (isEmpty()) {
        return true;
    }
    final ProducerSpec producer = fpConfig.getLocation().getProducer();
    final int inheritPkgs = isInheritPackages(producer);
    if (inheritPkgs == INHERIT_PKGS_NOT_FOUND || inheritPkgs == INHERIT_PKGS_TRANSITIVE && !fpConfig.isTransitive()) {
        return true;
    }
    if (inheritPkgs > 0) {
        if (fpConfig.hasExcludedPackages()) {
            for (String excluded : fpConfig.getExcludedPackages()) {
                if (!isPackageExcluded(producer, excluded) && !isPackageIncluded(producer, excluded)) {
                    return true;
                }
            }
        }
        if (fpConfig.hasIncludedPackages()) {
            for (String included : fpConfig.getIncludedPackages()) {
                if (!isPackageIncluded(producer, included) && !isPackageExcluded(producer, included)) {
                    return true;
                }
            }
        }
    }
    if (fpConfig.hasDefinedConfigs()) {
        boolean configsInherited = true;
        for (int i = levels.size() - 1; i >= 0; --i) {
            if (!levels.get(i).isInheritConfigs()) {
                configsInherited = false;
                break;
            }
        }
        if (configsInherited) {
            return true;
        }
    }
    if (fpConfig.hasModelOnlyConfigs()) {
        boolean configsInherited = true;
        for (int i = levels.size() - 1; i >= 0; --i) {
            if (!levels.get(i).isInheritModelOnlyConfigs()) {
                configsInherited = false;
                break;
            }
        }
        if (configsInherited) {
            return true;
        }
    }
    return false;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)

Example 17 with ProducerSpec

use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.

the class FpStack method isIncludedInTransitiveDeps.

boolean isIncludedInTransitiveDeps(ProducerSpec producer, ConfigId configId) {
    final int end = levels.size() - 1;
    int i = 0;
    while (i < end) {
        final Level level = levels.get(i++);
        final ProducerSpec levelProducer = level.getCurrentConfig().getLocation().getProducer();
        for (int j = 0; j <= i; ++j) {
            final Boolean included = levels.get(j).isIncludedInTransitive(levelProducer, configId);
            if (included != null) {
                return included;
            }
        }
    }
    return false;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)

Example 18 with ProducerSpec

use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.

the class ProvisioningRuntimeBuilder method resolveFeatureGroupConfig.

ResolvedFeatureGroupConfig resolveFeatureGroupConfig(ConfigModelStack configStack, FeatureGroupSupport fg) throws ProvisioningException {
    ProducerSpec fgOrigin = null;
    if (!(fg.isConfig() || fg.isLayer())) {
        final FeaturePackRuntimeBuilder originalOrigin = currentOrigin;
        getFeatureGroupSpec(fg.getName());
        fgOrigin = currentOrigin.producer;
        currentOrigin = originalOrigin;
    }
    final ResolvedFeatureGroupConfig resolvedFgc = new ResolvedFeatureGroupConfig(configStack, fg, fgOrigin);
    resolvedFgc.inheritFeatures = fg.isInheritFeatures();
    if (fg.hasExcludedSpecs()) {
        resolvedFgc.excludedSpecs = resolveSpecIds(resolvedFgc.excludedSpecs, fg.getExcludedSpecs());
    }
    if (fg.hasIncludedSpecs()) {
        resolvedFgc.includedSpecs = resolveSpecIds(resolvedFgc.includedSpecs, fg.getIncludedSpecs());
    }
    if (fg.hasExcludedFeatures()) {
        resolvedFgc.excludedFeatures = resolveExcludedIds(resolvedFgc.excludedFeatures, fg.getExcludedFeatures());
    }
    if (fg.hasIncludedFeatures()) {
        resolvedFgc.includedFeatures = resolveIncludedIds(resolvedFgc.includedFeatures, fg.getIncludedFeatures());
    }
    if (fg.hasExternalFeatureGroups()) {
        final FeaturePackRuntimeBuilder originalOrigin = currentOrigin;
        for (Map.Entry<String, FeatureGroup> entry : fg.getExternalFeatureGroups().entrySet()) {
            final FeatureGroup extFg = entry.getValue();
            setOrigin(entry.getKey());
            try {
                if (extFg.hasExcludedSpecs()) {
                    resolvedFgc.excludedSpecs = resolveSpecIds(resolvedFgc.excludedSpecs, extFg.getExcludedSpecs());
                }
                if (extFg.hasIncludedSpecs()) {
                    resolvedFgc.includedSpecs = resolveSpecIds(resolvedFgc.includedSpecs, extFg.getIncludedSpecs());
                }
                if (extFg.hasExcludedFeatures()) {
                    resolvedFgc.excludedFeatures = resolveExcludedIds(resolvedFgc.excludedFeatures, extFg.getExcludedFeatures());
                }
                if (extFg.hasIncludedFeatures()) {
                    resolvedFgc.includedFeatures = resolveIncludedIds(resolvedFgc.includedFeatures, extFg.getIncludedFeatures());
                }
            } finally {
                setOrigin(originalOrigin);
            }
        }
    }
    return resolvedFgc;
}
Also used : FeatureGroup(org.jboss.galleon.config.FeatureGroup) ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 19 with ProducerSpec

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

Example 20 with ProducerSpec

use of org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec in project galleon by wildfly.

the class ProvisioningLayout method getUpdatesInternal.

private ProvisioningPlan getUpdatesInternal(Collection<ProducerSpec> producers) throws ProvisioningException {
    final ProvisioningPlan plan = ProvisioningPlan.builder();
    updatesTracker = getUpdatesTracker();
    updatesTracker.starting(producers.size());
    for (ProducerSpec producer : producers) {
        updatesTracker.processing(producer);
        final FeaturePackUpdatePlan fpPlan = getFeaturePackUpdate(producer);
        if (!fpPlan.isEmpty()) {
            plan.update(fpPlan);
        }
        updatesTracker.processed(producer);
    }
    updatesTracker.complete();
    return plan;
}
Also used : ProducerSpec(org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)

Aggregations

ProducerSpec (org.jboss.galleon.universe.FeaturePackLocation.ProducerSpec)24 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)9 ProvisioningException (org.jboss.galleon.ProvisioningException)8 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)8 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)5 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)4 UniverseSpec (org.jboss.galleon.universe.UniverseSpec)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)2 Table (org.jboss.galleon.cli.cmd.Table)2 FeaturePackSpec (org.jboss.galleon.spec.FeaturePackSpec)2 Path (java.nio.file.Path)1