static void writeUniverseSpecs(FeaturePackDepsConfig fpDeps, final ElementNode parent) { ElementNode universesEl = null; UniverseSpec universeSpec = fpDeps.getDefaultUniverse(); if(universeSpec != null) { universesEl = addElement(parent, Element.UNIVERSES.getLocalName(), parent.getNamespace()); writeUniverseConfig(universesEl, null, universeSpec.getFactory(), universeSpec.getLocation()); } if(fpDeps.hasUniverseNamedSpecs()) { if(universesEl == null) { universesEl = addElement(parent, Element.UNIVERSES.getLocalName(), parent.getNamespace()); } for(Map.Entry<String, UniverseSpec> universe : fpDeps.getUniverseNamedSpecs().entrySet()) { writeUniverseConfig(universesEl, universe.getKey(), universe.getValue().getFactory(), universe.getValue().getLocation()); } } }
private static void writeUniverseConfig(ElementNode universesEl, String name, String factory, String location) { final ElementNode universeEl = addElement(universesEl, Element.UNIVERSE.getLocalName(), universesEl.getNamespace()); if(name != null) { addAttribute(universeEl, Attribute.NAME, name); } addAttribute(universeEl, Attribute.FACTORY, factory); if(location != null) { addAttribute(universeEl, Attribute.LOCATION, location); } }
protected ElementNode toElement(ProvisioningConfig config) { final ElementNode install = addElement(null, Element.INSTALLATION); final ElementNode transitives = addElement(install, Element.TRANSITIVE); for(FeaturePackConfig dep : config.getTransitiveDeps()) { writeFeaturePackConfig(addElement(transitives, Element.FEATURE_PACK), config.getUserConfiguredLocation(dep.getLocation()), dep, config.originOf(dep.getLocation().getProducer())); final ElementNode fpElement = addElement(install, Element.FEATURE_PACK); writeFeaturePackConfig(fpElement, config.getUserConfiguredLocation(fp.getLocation()), fp, config.originOf(fp.getLocation().getProducer())); final String[] names = pluginOptions.keySet().toArray(new String[pluginOptions.size()]); Arrays.sort(names); final ElementNode optionsE = addElement(install, Element.OPTIONS); for(String name : names) { final ElementNode optionE = addElement(optionsE, Element.OPTION); addAttribute(optionE, Attribute.NAME, name); final String value = pluginOptions.get(name);
addAttribute(fp, Attribute.LOCATION, location.toString()); if(origin != null) { addElement(fp, Element.ORIGIN.getLocalName(), ns).addChild(new TextNode(origin)); final ElementNode patches = addElement(fp, Element.PATCHES.getLocalName(), ns); for(FPID patchId : featurePack.getPatches()) { final ElementNode patch = addElement(patches, Element.PATCH.getLocalName(), ns); addAttribute(patch, Attribute.ID, patchId.toString()); packages = addElement(fp, Element.PACKAGES.getLocalName(), ns); addAttribute(packages, Attribute.INHERIT, FALSE); packages = addElement(fp, Element.PACKAGES.getLocalName(), ns); final ElementNode exclude = addElement(packages, Element.EXCLUDE.getLocalName(), ns); addAttribute(exclude, Attribute.NAME, excluded); packages = addElement(fp, Element.PACKAGES.getLocalName(), ns); final ElementNode include = addElement(packages, Element.INCLUDE.getLocalName(), ns); addAttribute(include, Attribute.NAME, included.getName());
defConfigsE = addElement(parent, Element.DEFAULT_CONFIGS.getLocalName(), ns); addAttribute(defConfigsE, Attribute.INHERIT, FALSE); defConfigsE = addElement(parent, Element.DEFAULT_CONFIGS.getLocalName(), ns); defConfigsE = addElement(parent, Element.DEFAULT_CONFIGS.getLocalName(), ns); final ElementNode exclude = addElement(defConfigsE, Element.EXCLUDE.getLocalName(), ns); addAttribute(exclude, Attribute.MODEL, excluded.getKey()); if(!excluded.getValue()) { defConfigsE = addElement(parent, Element.DEFAULT_CONFIGS.getLocalName(), ns); final ElementNode included = addElement(defConfigsE, Element.INCLUDE.getLocalName(), ns); addAttribute(included, Attribute.MODEL, modelName); defConfigsE = addElement(parent, Element.DEFAULT_CONFIGS.getLocalName(), ns); final ElementNode excluded = addElement(defConfigsE, Element.EXCLUDE.getLocalName(), ns); if(configId.getModel() != null) { addAttribute(excluded, Attribute.MODEL, configId.getModel()); defConfigsE = addElement(parent, Element.DEFAULT_CONFIGS.getLocalName(), ns); final ElementNode includeElement = addElement(defConfigsE, Element.INCLUDE.getLocalName(), ns); if(config.getModel() != null) { addAttribute(includeElement, Attribute.MODEL, config.getModel());