Search in sources :

Example 1 with FeaturePackPlugin

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

the class FeaturePackXmlWriter method toElement.

protected ElementNode toElement(FeaturePackSpec fpSpec) {
    final ElementNode fp = addElement(null, Element.FEATURE_PACK);
    addAttribute(fp, Attribute.LOCATION, fpSpec.getFPID().toString());
    ProvisioningXmlWriter.writeUniverseSpecs(fpSpec, fp);
    if (fpSpec.isPatch()) {
        final ElementNode patchFor = addElement(fp, Element.PATCH);
        addAttribute(patchFor, Attribute.FOR, fpSpec.getPatchFor().toString());
    }
    if (fpSpec.hasTransitiveDeps()) {
        final ElementNode transitives = addElement(fp, Element.TRANSITIVE);
        for (FeaturePackConfig dep : fpSpec.getTransitiveDeps()) {
            final ElementNode depElement = addElement(transitives, Element.DEPENDENCY);
            ProvisioningXmlWriter.writeFeaturePackConfig(depElement, fpSpec.getUserConfiguredLocation(dep.getLocation()), dep, fpSpec.originOf(dep.getLocation().getProducer()));
        }
    }
    if (fpSpec.hasFeaturePackDeps()) {
        final ElementNode deps = addElement(fp, Element.DEPENDENCIES);
        for (FeaturePackConfig dep : fpSpec.getFeaturePackDeps()) {
            final ElementNode depElement = addElement(deps, Element.DEPENDENCY);
            ProvisioningXmlWriter.writeFeaturePackConfig(depElement, fpSpec.getUserConfiguredLocation(dep.getLocation()), dep, fpSpec.originOf(dep.getLocation().getProducer()));
        }
    }
    ProvisioningXmlWriter.writeConfigCustomizations(fp, Element.FEATURE_PACK.getNamespace(), fpSpec);
    if (fpSpec.hasDefaultPackages()) {
        final ElementNode pkgs = addElement(fp, Element.DEFAULT_PACKAGES);
        final String[] pkgNames = fpSpec.getDefaultPackageNames().toArray(new String[0]);
        Arrays.sort(pkgNames);
        for (String name : pkgNames) {
            addAttribute(addElement(pkgs, Element.PACKAGE), Attribute.NAME, name);
        }
    }
    if (fpSpec.hasPlugins()) {
        final ElementNode plugins = addElement(fp, Element.PLUGINS);
        for (FeaturePackPlugin plugin : fpSpec.getPlugins().values()) {
            final ElementNode pluginE = addElement(plugins, Element.PLUGIN);
            addAttribute(pluginE, Attribute.ID, plugin.getId());
            addAttribute(pluginE, Attribute.LOCATION, plugin.getLocation());
        }
    }
    return fp;
}
Also used : FeaturePackPlugin(org.jboss.galleon.spec.FeaturePackPlugin) ElementNode(org.jboss.galleon.xml.util.ElementNode) FeaturePackConfig(org.jboss.galleon.config.FeaturePackConfig)

Aggregations

FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)1 FeaturePackPlugin (org.jboss.galleon.spec.FeaturePackPlugin)1 ElementNode (org.jboss.galleon.xml.util.ElementNode)1