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()); final ElementNode excludeE = addElement(depE, Element.EXCLUDE.getLocalName(), ns); addAttribute(excludeE, Attribute.FEATURE_ID, excluded.getKey().toString()); if(excluded.getValue() != null) { final ElementNode includeE = addElement(depE, Element.INCLUDE.getLocalName(), ns); addAttribute(includeE, Attribute.SPEC, spec.toString()); final ElementNode includeE = addElement(depE, Element.INCLUDE.getLocalName(), ns); addAttribute(includeE, Attribute.FEATURE_ID, entry.getKey().toString()); final FeatureConfig fc = entry.getValue();
final Element element = Element.of(reader.getName().getLocalPart()); switch (element) { case DEPENDS:
final Element element = Element.of(reader.getName().getLocalPart()); switch (element) { case FEATURE_GROUP:
return; case XMLStreamConstants.START_ELEMENT: final Element element = Element.of(reader.getName().getLocalPart()); switch (element) { case DEPENDS:
return; case XMLStreamConstants.START_ELEMENT: final Element element = Element.of(reader.getName().getLocalPart()); switch (element) { case INCLUDE:
final Element element = Element.of(reader.getName().getLocalPart()); switch (element) { case FEATURE_GROUP:
private static void addFeatureConfigBody(ElementNode fcE, FeatureId id, FeatureConfig fc, String ns) { if(fc.hasFeatureDeps()) { for(FeatureDependencySpec depSpec : fc.getFeatureDeps()) { final ElementNode depE = addElement(fcE, Element.DEPENDS.getLocalName(), ns); if(depSpec.getOrigin() != null) { addAttribute(depE, Attribute.ORIGIN, depSpec.getOrigin()); continue; final ElementNode paramE = addElement(fcE, Element.PARAM.getLocalName(), ns); addAttribute(paramE, Attribute.NAME, name); addAttribute(paramE, Attribute.VALUE, param.getValue()); final ElementNode paramE = addElement(fcE, Element.RESET_PARAM.getLocalName(), ns); addAttribute(paramE, Attribute.PARAM, param); final ElementNode paramE = addElement(fcE, Element.UNSET_PARAM.getLocalName(), ns); addAttribute(paramE, Attribute.PARAM, param);
static void writeFeatureGroupSpecBody(final ElementNode configE, ConfigItemContainer featureGroup, String ns) { if(!featureGroup.hasItems()) { return; } String currentOrigin = null; ElementNode parent = configE; for(ConfigItem item : featureGroup.getItems()) { final String itemOrigin = item.getOrigin(); if(itemOrigin != null) { if (!itemOrigin.equals(currentOrigin)) { parent = addElement(configE, Element.ORIGIN.getLocalName(), ns); addAttribute(parent, Attribute.NAME, itemOrigin); currentOrigin = itemOrigin; } } else if(currentOrigin != null) { currentOrigin = null; parent = configE; } if(item.isGroup()) { writeFeatureGroupDependency(parent, (FeatureGroup) item, ns); } else { addFeatureConfig(parent, (FeatureConfig) item, ns); } } }
public static boolean handleFeatureGroupBodyElement(XMLExtendedStreamReader reader, FeatureGroupBuilderSupport<?> builder) throws XMLStreamException { final Element element = Element.of(reader.getName().getLocalPart()); switch (element) { case INCLUDE: readInclude(reader, null, builder); break; case EXCLUDE: readExclude(reader, null, builder); break; case ORIGIN: readOriginIncludeExclude(reader, builder); break; case FEATURE_GROUP: builder.addFeatureGroup(readFeatureGroupDependency(null, reader)); break; case FEATURE: final FeatureConfig nested = new FeatureConfig(); readFeatureConfig(reader, nested); builder.addFeature(nested); break; case PACKAGES: PackageDepsSpecXmlParser.parsePackageDeps(Element.PACKAGES, reader, builder); break; default: return false; } return true; }
public static void addFeatureGroupDepBody(FeatureGroupSupport dep, final ElementNode depE, String ns) { if(dep.getName() != null) { addAttribute(depE, Attribute.NAME, dep.getName()); } if(!dep.isInheritFeatures()) { addAttribute(depE, Attribute.INHERIT_FEATURES, FALSE); } addFeatureGroupIncludeExclude(dep, ns, depE); writeFeatureGroupSpecBody(depE, dep, ns); if(dep.hasExternalFeatureGroups()) { for(Map.Entry<String, FeatureGroup> entry : dep.getExternalFeatureGroups().entrySet()) { final ElementNode fpE = addElement(depE, Element.ORIGIN.getLocalName(), ns); addAttribute(fpE, Attribute.NAME, entry.getKey()); addFeatureGroupIncludeExclude(entry.getValue(), ns, fpE); } } if(dep.hasPackageDeps()) { PackageXmlWriter.writePackageDeps(dep, addElement(depE, Element.PACKAGES.getLocalName(), ns)); } }
private static void writeFeatureGroupDependency(ElementNode depsE, FeatureGroup dep, String ns) { final ElementNode depE = addElement(depsE, Element.FEATURE_GROUP.getLocalName(), ns); addFeatureGroupDepBody(dep, depE, ns); }
public static void addFeatureConfig(ElementNode parentE, FeatureConfig fc, String ns) { final ElementNode fcE = addElement(parentE, Element.FEATURE.getLocalName(), ns); addAttribute(fcE, Attribute.SPEC, fc.getSpecId().toString()); if(fc.getParentRef() != null) { addAttribute(fcE, Attribute.PARENT_REF, fc.getParentRef()); } addFeatureConfigBody(fcE, null, fc, ns); } }
protected ElementNode toElement(FeatureGroup featureGroup, String ns) { final ElementNode fgE = addElement(null, Element.FEATURE_GROUP_SPEC.getLocalName(), ns); if(featureGroup.getName() != null) { addAttribute(fgE, Attribute.NAME, featureGroup.getName()); } //addFeatureGroupIncludeExclude(featureGroup, ns, fgE); writeFeatureGroupSpecBody(fgE, featureGroup, ns); if(featureGroup.hasPackageDeps()) { PackageXmlWriter.writePackageDeps(featureGroup, addElement(fgE, Element.PACKAGES.getLocalName(), ns)); } return fgE; }