Java Code Examples for org.jboss.staxmapper.XMLExtendedStreamReader#nextTag()
The following examples show how to use
org.jboss.staxmapper.XMLExtendedStreamReader#nextTag() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HostXml_11.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
protected void parseDiscoveryOptions(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> staticDiscoveryOptionNames, final Set<String> discoveryOptionNames) throws XMLStreamException { requireNoAttributes(reader); // Handle elements while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case DISCOVERY_OPTION: parseDiscoveryOption(reader, address, list, discoveryOptionNames); break; case STATIC_DISCOVERY: parseStaticDiscoveryOption(reader, address, list, staticDiscoveryOptionNames); break; default: throw unexpectedElement(reader); } } }
Example 2
Source File: HostXml_14.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private void parseServers(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException { parseServersAttributes(reader, address, list); // Handle elements final Set<String> names = new HashSet<String>(); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case SERVER: parseServer(reader, address, list, names); break; default: throw unexpectedElement(reader); } } }
Example 3
Source File: DomainXml_14.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private void parseManagementClientContent(XMLExtendedStreamReader reader, ModelNode address, Namespace expectedNs, List<ModelNode> list) throws XMLStreamException { requireNoAttributes(reader); boolean rolloutPlansAdded = false; while (reader.nextTag() != END_ELEMENT) { requireNamespace(reader, expectedNs); Element element = Element.forName(reader.getLocalName()); switch (element) { case ROLLOUT_PLANS: { parseRolloutPlans(reader, address, list); rolloutPlansAdded = true; break; } default: { throw unexpectedElement(reader); } } } if (!rolloutPlansAdded) { initializeRolloutPlans(address, list); } }
Example 4
Source File: HostXml_Legacy.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private void parseServers_1_0(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException { // Handle elements final Set<String> names = new HashSet<String>(); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case SERVER: parseServer(reader, address, list, names); break; default: throw unexpectedElement(reader); } } }
Example 5
Source File: ManagementXml_4.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private void parsePlugIns(final XMLExtendedStreamReader reader, final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException { while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case PLUG_IN: { ModelNode plugIn = new ModelNode(); plugIn.get(OP).set(ADD); String moduleValue = readStringAttributeElement(reader, Attribute.MODULE.getLocalName()); final ModelNode newAddress = realmAddress.clone(); newAddress.add(PLUG_IN, moduleValue); plugIn.get(OP_ADDR).set(newAddress); list.add(plugIn); break; } default: { throw unexpectedElement(reader); } } } }
Example 6
Source File: StandaloneXml_13.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void parseHttpManagementInterface(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException { final ModelNode operationAddress = address.clone(); operationAddress.add(MANAGEMENT_INTERFACE, HTTP_INTERFACE); final ModelNode addOp = Util.getEmptyOperation(ADD, operationAddress); // Handle attributes parseHttpManagementInterfaceAttributes(reader, addOp); // Handle elements while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case SOCKET: throw ControllerLogger.ROOT_LOGGER.unsupportedElement(reader.getName(),reader.getLocation(), SOCKET_BINDING); case SOCKET_BINDING: parseHttpManagementSocketBinding(reader, addOp); break; case HTTP_UPGRADE: parseHttpUpgrade(reader, addOp); break; case CONSTANT_HEADERS: parseConstantHeaders(reader, addOp); break; default: throw unexpectedElement(reader); } } list.add(addOp); }
Example 7
Source File: RemotingSubsystem11Parser.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException { final PathAddress address = PathAddress.pathAddress(SUBSYSTEM, RemotingExtension.SUBSYSTEM_NAME); final ModelNode subsystem = Util.createAddOperation(address); list.add(subsystem); requireNoAttributes(reader); // Handle elements while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); switch (element) { case WORKER_THREAD_POOL: parseWorkerThreadPool(reader, subsystem); break; case CONNECTOR: { // Add connector updates parseConnector(reader, address.toModelNode(), list); break; } case OUTBOUND_CONNECTIONS: { // parse the outbound-connections this.parseOutboundConnections(reader, address.toModelNode(), list); break; } default: { throw unexpectedElement(reader); } } } }
Example 8
Source File: HostXml_5.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public boolean parseManagementInterfaces(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> operationsList) throws XMLStreamException { requireNoAttributes(reader); boolean interfaceDefined = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case NATIVE_INTERFACE: { interfaceDefined = true; parseNativeManagementInterface(reader, address, operationsList); break; } case HTTP_INTERFACE: { interfaceDefined = true; parseHttpManagementInterface(reader, address, operationsList); break; } default: { throw unexpectedElement(reader); } } } if (!interfaceDefined) { throw missingOneOf(reader, EnumSet.of(Element.NATIVE_INTERFACE, Element.HTTP_INTERFACE)); } return true; }
Example 9
Source File: ProvisionedStateXmlParser30.java From galleon with Apache License 2.0 | 5 votes |
@Override public void readElement(XMLExtendedStreamReader reader, ProvisionedState.Builder builder) throws XMLStreamException { ParsingUtils.parseNoAttributes(reader); while (reader.hasNext()) { switch (reader.nextTag()) { case XMLStreamConstants.END_ELEMENT: { return; } case XMLStreamConstants.START_ELEMENT: { final Element element = Element.of(reader.getName()); switch (element) { case FEATURE_PACK: builder.addFeaturePack(readFeaturePack(reader)); break; case CONFIG: final ProvisionedConfigBuilder configBuilder = ProvisionedConfigBuilder.builder(); ProvisionedConfigXmlParser30.read(reader, configBuilder); builder.addConfig(configBuilder.build()); break; default: throw ParsingUtils.unexpectedContent(reader); } break; } default: { throw ParsingUtils.unexpectedContent(reader); } } } throw ParsingUtils.endOfDocument(reader.getLocation()); }
Example 10
Source File: AuditLogXml_5.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void parseAuditLogHandlersReference(final XMLExtendedStreamReader reader, final ModelNode address, final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException { requireNamespace(reader, expectedNs); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, expectedNs); final Element element = Element.forName(reader.getLocalName()); switch (element) { case HANDLER:{ requireNamespace(reader, expectedNs); final ModelNode add = new ModelNode(); add.get(OP).set(ADD); list.add(add); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw unexpectedAttribute(reader, i); } final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NAME: { add.get(OP_ADDR).set(address).add(ModelDescriptionConstants.HANDLER, value); break; } default: { throw unexpectedAttribute(reader, i); } } requireNoContent(reader); } break; } default: throw unexpectedElement(reader); } } }
Example 11
Source File: ManagementXml_Legacy.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void parseServerIdentities_1_0(final XMLExtendedStreamReader reader, final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException { while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case SECRET: { parseSecret(reader, realmAddress, list); break; } case SSL: { if (namespace.getMajorVersion() == 1) { // This is only needed until we port version 1.7 of the schema from EAP to here // and then the 1.x versions will also be listed in the switch below. parseSSL_1_0(reader, realmAddress, list); } else { switch (namespace) { case DOMAIN_2_0: case DOMAIN_2_1: parseSSL_1_0(reader, realmAddress, list); break; default: parseSSL_1_7_and_2_2(reader, realmAddress, list); break; } } break; } default: { throw unexpectedElement(reader); } } } }
Example 12
Source File: DeploymentScannerParser_1_1.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@inheritDoc} */ @Override public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException { // no attributes requireNoAttributes(reader); final ModelNode address = new ModelNode(); address.add(ModelDescriptionConstants.SUBSYSTEM, DeploymentScannerExtension.SUBSYSTEM_NAME); address.protect(); final ModelNode subsystem = new ModelNode(); subsystem.get(OP).set(ADD); subsystem.get(OP_ADDR).set(address); list.add(subsystem); // elements while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { switch (Namespace.forUri(reader.getNamespaceURI())) { case DEPLOYMENT_SCANNER_1_0: case DEPLOYMENT_SCANNER_1_1: { final String element = reader.getLocalName(); switch (element) { case DEPLOYMENT_SCANNER: { //noinspection unchecked parseScanner(reader, address, list); break; } default: throw unexpectedElement(reader); } break; } default: throw unexpectedElement(reader); } } }
Example 13
Source File: StandaloneXml_Legacy.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private void parseManagementInterface2_0(XMLExtendedStreamReader reader, ModelNode address, boolean http, List<ModelNode> list) throws XMLStreamException { final ModelNode operationAddress = address.clone(); operationAddress.add(MANAGEMENT_INTERFACE, http ? HTTP_INTERFACE : NATIVE_INTERFACE); final ModelNode addOp = Util.getEmptyOperation(ADD, operationAddress); // Handle attributes switch (namespace.getMajorVersion()) { case 2: if (http) { parseHttpManagementInterfaceAttributes2_0(reader, addOp); } else { parseNativeManagementInterfaceAttributes2_0(reader, addOp); } break; default: if (http) { parseHttpManagementInterfaceAttributes3_0(reader, addOp); } else { parseNativeManagementInterfaceAttributes3_0(reader, addOp); } } // Handle elements while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case SOCKET: if (http) { parseHttpManagementSocket(reader); } else { parseNativeManagementSocket(reader); } break; case SOCKET_BINDING: if (http) { parseHttpManagementSocketBinding(reader, addOp); } else { parseNativeManagementSocketBinding(reader, addOp); } break; default: throw unexpectedElement(reader); } } list.add(addOp); }
Example 14
Source File: LoggingSubsystemParser_1_2.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
void parseLoggingProfileElement(final XMLExtendedStreamReader reader, final List<ModelNode> operations, final Set<String> profileNames) throws XMLStreamException { // Attributes String name = null; final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); required.remove(attribute); switch (attribute) { case NAME: { name = value; break; } default: throw unexpectedAttribute(reader, i); } } if (!required.isEmpty()) { throw missingRequired(reader, required); } if (!profileNames.add(name)) { throw duplicateNamedElement(reader, name); } // Setup the address final PathAddress profileAddress = SUBSYSTEM_ADDRESS.append(LOGGING_PROFILE, name); operations.add(Util.createAddOperation(profileAddress)); final List<ModelNode> loggerOperations = new ArrayList<>(); final List<ModelNode> asyncHandlerOperations = new ArrayList<>(); final List<ModelNode> handlerOperations = new ArrayList<>(); final Set<String> loggerNames = new HashSet<>(); final Set<String> handlerNames = new HashSet<>(); boolean gotRoot = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); switch (element) { case LOGGER: { parseLoggerElement(reader, profileAddress, loggerOperations, loggerNames); break; } case ROOT_LOGGER: { if (gotRoot) { throw unexpectedElement(reader); } gotRoot = true; parseRootLoggerElement(reader, profileAddress, loggerOperations); break; } case CONSOLE_HANDLER: { parseConsoleHandlerElement(reader, profileAddress, handlerOperations, handlerNames); break; } case FILE_HANDLER: { parseFileHandlerElement(reader, profileAddress, handlerOperations, handlerNames); break; } case CUSTOM_HANDLER: { parseCustomHandlerElement(reader, profileAddress, handlerOperations, handlerNames); break; } case PERIODIC_ROTATING_FILE_HANDLER: { parsePeriodicRotatingFileHandlerElement(reader, profileAddress, handlerOperations, handlerNames); break; } case SIZE_ROTATING_FILE_HANDLER: { parseSizeRotatingHandlerElement(reader, profileAddress, handlerOperations, handlerNames); break; } case ASYNC_HANDLER: { parseAsyncHandlerElement(reader, profileAddress, asyncHandlerOperations, handlerNames); break; } case SYSLOG_HANDLER: { parseSyslogHandler(reader, profileAddress, handlerOperations, handlerNames); break; } default: { reader.handleAny(operations); break; } } } operations.addAll(handlerOperations); operations.addAll(asyncHandlerOperations); operations.addAll(loggerOperations); }
Example 15
Source File: HostXml_11.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private void parseConstantHeaders(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException { // Attributes requireNoAttributes(reader); ModelNode constantHeaders= new ModelNode(); // Content while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); if (Element.forName(reader.getLocalName()) != Element.HEADER_MAPPING) { throw unexpectedElement(reader); } ModelNode headerMapping = new ModelNode(); requireSingleAttribute(reader, Attribute.PATH.getLocalName()); // After double checking the name of the only attribute we can retrieve it. HttpManagementResourceDefinition.PATH.parseAndSetParameter(reader.getAttributeValue(0), headerMapping, reader); ModelNode headers = new ModelNode(); boolean headerFound = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); if (Element.forName(reader.getLocalName()) != Element.HEADER) { throw unexpectedElement(reader); } headerFound = true; ModelNode header= new ModelNode(); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw unexpectedAttribute(reader, i); } else { final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NAME: { HttpManagementResourceDefinition.HEADER_NAME.parseAndSetParameter(value, header, reader); break; } case VALUE: { HttpManagementResourceDefinition.HEADER_VALUE.parseAndSetParameter(value, header, reader); break; } default: throw unexpectedAttribute(reader, i); } } } headers.add(header); requireNoContent(reader); } if (headerFound == false) { throw missingRequiredElement(reader, Collections.singleton(Element.HEADER.getLocalName())); } headerMapping.get(ModelDescriptionConstants.HEADERS).set(headers); constantHeaders.add(headerMapping); } addOp.get(ModelDescriptionConstants.CONSTANT_HEADERS).set(constantHeaders); }
Example 16
Source File: HostXml_5.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private void parseDomainController(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final ModelNode hostAddOp) throws XMLStreamException { requireNoAttributes(reader); boolean hasLocal = false; boolean hasRemote = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case LOCAL: { if (hasLocal) { throw ControllerLogger.ROOT_LOGGER.childAlreadyDeclared(element.getLocalName(), Element.DOMAIN_CONTROLLER.getLocalName(), reader.getLocation()); } else if (hasRemote) { throw ControllerLogger.ROOT_LOGGER.childAlreadyDeclared(Element.REMOTE.getLocalName(), Element.DOMAIN_CONTROLLER.getLocalName(), reader.getLocation()); } hostAddOp.get(IS_DOMAIN_CONTROLLER).set(true); parseLocalDomainController(reader, address, list); hasLocal = true; break; } case REMOTE: { if (hasRemote) { throw ControllerLogger.ROOT_LOGGER.childAlreadyDeclared(element.getLocalName(), Element.DOMAIN_CONTROLLER.getLocalName(), reader.getLocation()); } else if (hasLocal) { throw ControllerLogger.ROOT_LOGGER.childAlreadyDeclared(Element.LOCAL.getLocalName(), Element.DOMAIN_CONTROLLER.getLocalName(), reader.getLocation()); } hostAddOp.get(IS_DOMAIN_CONTROLLER).set(false); parseRemoteDomainController(reader, address, list); hasRemote = true; break; } default: throw unexpectedElement(reader); } } if (!hasLocal && !hasRemote) { throw ControllerLogger.ROOT_LOGGER.domainControllerMustBeDeclared(Element.REMOTE.getLocalName(), Element.LOCAL.getLocalName(), reader.getLocation()); } }
Example 17
Source File: ProvisionedConfigXmlParser30.java From galleon with Apache License 2.0 | 4 votes |
private static void readSpec(XMLExtendedStreamReader reader, ProducerSpec producer, ProvisionedConfigBuilder config) throws XMLStreamException { String name = null; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); switch (attribute) { case NAME: name = reader.getAttributeValue(i); break; default: throw ParsingUtils.unexpectedContent(reader); } } if (name == null) { throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.NAME)); } final ResolvedSpecId specId = new ResolvedSpecId(producer, name); while (reader.hasNext()) { switch (reader.nextTag()) { case XMLStreamConstants.END_ELEMENT: { return; } case XMLStreamConstants.START_ELEMENT: { final Element element = Element.of(reader.getName()); switch (element) { case FEATURE: readFeature(reader, specId, config); break; default: throw ParsingUtils.unexpectedContent(reader); } break; } default: { throw ParsingUtils.unexpectedContent(reader); } } } throw ParsingUtils.endOfDocument(reader.getLocation()); }
Example 18
Source File: ManagementXml_Legacy.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private void parseAuthorization_1_5_and_2_0(final XMLExtendedStreamReader reader, final ModelNode realmAdd, final List<ModelNode> list) throws XMLStreamException { ModelNode realmAddress = realmAdd.get(OP_ADDR); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw unexpectedAttribute(reader, i); } else { final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case MAP_GROUPS_TO_ROLES: SecurityRealmResourceDefinition.MAP_GROUPS_TO_ROLES.parseAndSetParameter(value, realmAdd, reader); break; default: { throw unexpectedAttribute(reader, i); } } } } boolean authzFound = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); // Only a single element within the authorization element is currently supported. if (authzFound) { throw unexpectedElement(reader); } switch (element) { case PROPERTIES: { parsePropertiesAuthorization(reader, realmAddress, list); authzFound = true; break; } case PLUG_IN: { ModelNode parentAddress = realmAddress.clone().add(AUTHORIZATION); parsePlugIn_Authorization(reader, parentAddress, list); authzFound = true; break; } case LDAP: { parseLdapAuthorization_1_5(reader, realmAddress, list); authzFound = true; break; } default: { throw unexpectedElement(reader); } } } }
Example 19
Source File: ManagementXml_5.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private void parseLdapAuthentication(final XMLExtendedStreamReader reader, final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException { ModelNode addr = realmAddress.clone().add(AUTHENTICATION, LDAP); ModelNode ldapAuthentication = Util.getEmptyOperation(ADD, addr); list.add(ldapAuthentication); parseLdapAuthenticationAttributes(reader, ldapAuthentication); ModelNode addLdapCache = null; boolean choiceFound = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { if (choiceFound) { throw unexpectedElement(reader); } requireNamespace(reader, namespace); final Element element = Element.forName(reader.getLocalName()); switch (element) { case CACHE: if (addLdapCache != null) { throw unexpectedElement(reader); } addLdapCache = parseLdapCache(reader); break; case ADVANCED_FILTER: choiceFound = true; String filter = readStringAttributeElement(reader, Attribute.FILTER.getLocalName()); LdapAuthenticationResourceDefinition.ADVANCED_FILTER.parseAndSetParameter(filter, ldapAuthentication, reader); break; case USERNAME_FILTER: { choiceFound = true; String usernameAttr = readStringAttributeElement(reader, Attribute.ATTRIBUTE.getLocalName()); LdapAuthenticationResourceDefinition.USERNAME_FILTER.parseAndSetParameter(usernameAttr, ldapAuthentication, reader); break; } default: { throw unexpectedElement(reader); } } } if (!choiceFound) { throw missingOneOf(reader, EnumSet.of(Element.ADVANCED_FILTER, Element.USERNAME_FILTER)); } if (addLdapCache != null) { correctCacheAddress(ldapAuthentication, addLdapCache); list.add(addLdapCache); } }
Example 20
Source File: PatchXmlUtils.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
protected void doReadElement(final XMLExtendedStreamReader reader, final PatchBuilder builder, InstalledIdentity originalIdentity) throws XMLStreamException { final PatchBuilder patch = builder; 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) { patch.setPatchId(value); } else { throw unexpectedAttribute(reader, i); } } final Collection<ContentModification> modifications = patch.getModifications(); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final String localName = reader.getLocalName(); final Element element = Element.forName(localName); switch (element) { case DESCRIPTION: patch.setDescription(reader.getElementText()); break; case LINK: final String link = readStringAttributeElement(reader, Attribute.URL.name); builder.setLink(link); break; case UPGRADE: parseIdentity(reader, patch, Patch.PatchType.CUMULATIVE); break; case NO_UPGRADE: parseIdentity(reader, patch, Patch.PatchType.ONE_OFF); break; case PATCH_ELEMENT: parseElement(reader, patch); break; case MODULES: parseModules(reader, modifications); break; case BUNDLES: parseBundles(reader, modifications); break; case MISC_FILES: parseMiscFiles(reader, modifications); break; default: handleRootElement(localName, reader, patch, originalIdentity); } } }