Java Code Examples for org.jboss.as.controller.parsing.ParseUtils#requireAttributes()
The following examples show how to use
org.jboss.as.controller.parsing.ParseUtils#requireAttributes() .
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: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
private void readSpi(final List<ModelNode> list, final XMLExtendedStreamReader reader) throws XMLStreamException { String spiName = ParseUtils.requireAttributes(reader, "name")[0]; ModelNode addSpi = new ModelNode(); addSpi.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME), PathElement.pathElement(SpiResourceDefinition.TAG_NAME, spiName)); addSpi.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode()); list.add(addSpi); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { if (reader.getLocalName().equals(DEFAULT_PROVIDER.getXmlName())) { DEFAULT_PROVIDER.parseAndSetParameter(reader.getElementText(), addSpi, reader); } else if (reader.getLocalName().equals(ProviderResourceDefinition.TAG_NAME)) { readProvider(list, spiName, reader); } } }
Example 2
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
private void readProvider(final List<ModelNode> list, String spiName, final XMLExtendedStreamReader reader) throws XMLStreamException { String[] attributes = ParseUtils.requireAttributes(reader, "name", ENABLED.getXmlName()); String providerName = attributes[0]; String enabled = attributes[1]; ModelNode addProvider = new ModelNode(); addProvider.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME), PathElement.pathElement(SpiResourceDefinition.TAG_NAME, spiName), PathElement.pathElement(ProviderResourceDefinition.TAG_NAME, providerName)); addProvider.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode()); addProvider.get(ENABLED.getName()).set(Boolean.valueOf(enabled)); list.add(addProvider); while (nextTag(reader) != END_ELEMENT) { if (reader.getLocalName().equals(PROPERTIES.getXmlName())) { readProperties(PROPERTIES, addProvider, reader); } } }
Example 3
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readRoleMappingsProvider(final ModelNode addServiceProvider, final XMLExtendedStreamReader reader) throws XMLStreamException { String providerId = readRequiredAttribute(reader, Constants.XML.ID); ServiceProviderDefinition.ROLE_MAPPINGS_PROVIDER_ID.parseAndSetParameter(providerId, addServiceProvider, reader); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (!Constants.XML.PROPERTY.equals(tagName)) { throw ParseUtils.unexpectedElement(reader); } final String[] array = ParseUtils.requireAttributes(reader, Constants.XML.NAME, Constants.XML.VALUE); ServiceProviderDefinition.ROLE_MAPPINGS_PROVIDER_CONFIG.parseAndAddParameterElement(array[0], array[1], addServiceProvider, reader); ParseUtils.requireNoContent(reader); } }
Example 4
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readRoleMappingsProvider(final ModelNode addServiceProvider, final XMLExtendedStreamReader reader) throws XMLStreamException { String providerId = readRequiredAttribute(reader, Constants.XML.ID); ServiceProviderDefinition.ROLE_MAPPINGS_PROVIDER_ID.parseAndSetParameter(providerId, addServiceProvider, reader); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (!Constants.XML.PROPERTY.equals(tagName)) { throw ParseUtils.unexpectedElement(reader); } final String[] array = ParseUtils.requireAttributes(reader, Constants.XML.NAME, Constants.XML.VALUE); ServiceProviderDefinition.ROLE_MAPPINGS_PROVIDER_CONFIG.parseAndAddParameterElement(array[0], array[1], addServiceProvider, reader); ParseUtils.requireNoContent(reader); } }