use of org.jboss.as.patching.metadata.impl.PatchElementImpl in project wildfly-core by wildfly.
the class IdentityPatchContext method createPatchElement.
/**
* Copy a patch element
*
* @param entry the patch entry
* @param patchId the patch id for the element
* @param modifications the element modifications
* @return the new patch element
*/
protected static PatchElement createPatchElement(final PatchEntry entry, String patchId, final List<ContentModification> modifications) {
final PatchElement patchElement = entry.element;
final PatchElementImpl element = new PatchElementImpl(patchId);
element.setProvider(patchElement.getProvider());
// Add all the rollback actions
element.getModifications().addAll(modifications);
element.setDescription(patchElement.getDescription());
return element;
}
use of org.jboss.as.patching.metadata.impl.PatchElementImpl in project wildfly-core by wildfly.
the class PatchXmlUtils method parseElement.
static void parseElement(final XMLExtendedStreamReader reader, final PatchBuilder builder) throws XMLStreamException {
String id = null;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
if (Attribute.ID == attribute) {
id = value;
} else {
throw unexpectedAttribute(reader, i);
}
}
final PatchElementImpl patchElement = new PatchElementImpl(id);
try {
builder.addElement(patchElement);
} catch (IllegalStateException e) {
throw new XMLStreamException(e);
}
final List<ContentModification> modifications = patchElement.getModifications();
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch(element) {
case DESCRIPTION:
patchElement.setDescription(reader.getElementText());
break;
case UPGRADE:
parseElementProvider(reader, patchElement, Patch.PatchType.CUMULATIVE);
break;
case NO_UPGRADE:
parseElementProvider(reader, patchElement, Patch.PatchType.ONE_OFF);
break;
case MODULES:
parseModules(reader, modifications);
break;
case BUNDLES:
parseBundles(reader, modifications);
break;
case MISC_FILES:
parseMiscFiles(reader, modifications);
break;
default:
throw unexpectedElement(reader);
}
}
}
Aggregations