Search in sources :

Example 1 with SpecId

use of org.jboss.galleon.spec.SpecId in project galleon by wildfly.

the class FeatureGroupXmlWriter method addFeatureGroupIncludeExclude.

static void addFeatureGroupIncludeExclude(FeatureGroupSupport dep, String ns, final ElementNode depE) {
    if (dep.hasExcludedSpecs()) {
        for (SpecId spec : dep.getExcludedSpecs()) {
            final ElementNode excludeE = addElement(depE, Element.EXCLUDE.getLocalName(), ns);
            addAttribute(excludeE, Attribute.SPEC, spec.toString());
        }
    }
    if (dep.hasExcludedFeatures()) {
        for (Map.Entry<FeatureId, String> excluded : dep.getExcludedFeatures().entrySet()) {
            final ElementNode excludeE = addElement(depE, Element.EXCLUDE.getLocalName(), ns);
            addAttribute(excludeE, Attribute.FEATURE_ID, excluded.getKey().toString());
            if (excluded.getValue() != null) {
                addAttribute(excludeE, Attribute.PARENT_REF, excluded.getValue());
            }
        }
    }
    if (dep.hasIncludedSpecs()) {
        for (SpecId spec : dep.getIncludedSpecs()) {
            final ElementNode includeE = addElement(depE, Element.INCLUDE.getLocalName(), ns);
            addAttribute(includeE, Attribute.SPEC, spec.toString());
        }
    }
    if (dep.hasIncludedFeatures()) {
        for (Map.Entry<FeatureId, FeatureConfig> entry : dep.getIncludedFeatures().entrySet()) {
            final ElementNode includeE = addElement(depE, Element.INCLUDE.getLocalName(), ns);
            addAttribute(includeE, Attribute.FEATURE_ID, entry.getKey().toString());
            final FeatureConfig fc = entry.getValue();
            if (fc.getParentRef() != null) {
                addAttribute(includeE, Attribute.PARENT_REF, fc.getParentRef());
            }
            if (fc != null) {
                addFeatureConfigBody(includeE, entry.getKey(), fc, ns);
            }
        }
    }
}
Also used : FeatureId(org.jboss.galleon.spec.FeatureId) FeatureConfig(org.jboss.galleon.config.FeatureConfig) ElementNode(org.jboss.galleon.xml.util.ElementNode) SpecId(org.jboss.galleon.spec.SpecId) Map(java.util.Map)

Example 2 with SpecId

use of org.jboss.galleon.spec.SpecId in project galleon by wildfly.

the class FeatureGroupBuilderSupport method excludeSpec.

@SuppressWarnings("unchecked")
public B excludeSpec(String spec) throws ProvisioningDescriptionException {
    final SpecId specId = SpecId.fromString(spec);
    if (includedSpecs.contains(specId)) {
        throw new ProvisioningDescriptionException(specId + " spec has been inplicitly excluded");
    }
    excludedSpecs = CollectionUtils.add(excludedSpecs, specId);
    return (B) this;
}
Also used : SpecId(org.jboss.galleon.spec.SpecId) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Example 3 with SpecId

use of org.jboss.galleon.spec.SpecId in project galleon by wildfly.

the class FeatureGroupBuilderSupport method includeSpec.

@SuppressWarnings("unchecked")
public B includeSpec(String spec) throws ProvisioningDescriptionException {
    final SpecId specId = SpecId.fromString(spec);
    if (excludedSpecs.contains(specId)) {
        throw new ProvisioningDescriptionException(specId + " spec has been explicitly excluded");
    }
    includedSpecs = CollectionUtils.addLinked(includedSpecs, specId);
    return (B) this;
}
Also used : SpecId(org.jboss.galleon.spec.SpecId) ProvisioningDescriptionException(org.jboss.galleon.ProvisioningDescriptionException)

Aggregations

SpecId (org.jboss.galleon.spec.SpecId)3 ProvisioningDescriptionException (org.jboss.galleon.ProvisioningDescriptionException)2 Map (java.util.Map)1 FeatureConfig (org.jboss.galleon.config.FeatureConfig)1 FeatureId (org.jboss.galleon.spec.FeatureId)1 ElementNode (org.jboss.galleon.xml.util.ElementNode)1