org.jboss.staxmapper.XMLExtendedStreamReader Java Examples

The following examples show how to use org.jboss.staxmapper.XMLExtendedStreamReader. 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_7.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void parseDiscoveryOption(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> discoveryOptionNames) throws XMLStreamException {

        // Handle attributes
        final ModelNode addOp = parseDiscoveryOptionAttributes(reader, address, list, discoveryOptionNames);

        // Handle elements
        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            requireNamespace(reader, namespace);
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case PROPERTY: {
                    parseDiscoveryOptionProperty(reader, addOp.get(PROPERTIES));
                    break;
                }
                default:
                    throw unexpectedElement(reader);
            }
        }
    }
 
Example #2
Source File: ManagementXml_Legacy.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseKerberosAuthentication_3_0(final XMLExtendedStreamReader reader,
        final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException {
    ModelNode addr = realmAddress.clone().add(AUTHENTICATION, KERBEROS);
    ModelNode kerberos = Util.getEmptyOperation(ADD, addr);
    list.add(kerberos);

    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 REMOVE_REALM:
                    KerberosAuthenticationResourceDefinition.REMOVE_REALM.parseAndSetParameter(value, kerberos, reader);
                    break;
                default: {
                    throw unexpectedAttribute(reader, i);
                }
            }
        }
    }

    requireNoContent(reader);
}
 
Example #3
Source File: DomainXml_11.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseHostRelease(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException {

        boolean sawId = false;
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {

            final String value = reader.getAttributeValue(i);
            if (!isNoNamespaceAttribute(reader, i)) {
                throw ParseUtils.unexpectedAttribute(reader, i);
            }

            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            if (attribute == Attribute.ID) {
                sawId = true;
                HostExcludeResourceDefinition.HOST_RELEASE.parseAndSetParameter(value, addOp, reader);
            } else {
                throw unexpectedAttribute(reader, i);
            }
        }

        if (!sawId) {
            throw missingRequired(reader, Attribute.ID.getLocalName());
        }

        requireNoContent(reader);
    }
 
Example #4
Source File: ConfigLayerXml.java    From galleon with Apache License 2.0 6 votes vote down vote up
private static void readLayer(XMLExtendedStreamReader reader, ConfigLayerSpec.Builder builder) throws XMLStreamException {
    String name = null;
    boolean optional = false;
    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;
            case OPTIONAL:
                optional = Boolean.parseBoolean(reader.getAttributeValue(i));
                break;
            default:
                throw ParsingUtils.unexpectedContent(reader);
        }
    }
    if(name == null) {
        throw ParsingUtils.missingAttributes(reader.getLocation(), Collections.singleton(Attribute.NAME));
    }
    builder.addLayerDep(name, optional);
    ParsingUtils.parseNoContent(reader);
}
 
Example #5
Source File: DomainXml_7.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseHostRelease(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException {

        boolean sawId = false;
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {

            final String value = reader.getAttributeValue(i);
            if (!isNoNamespaceAttribute(reader, i)) {
                throw ParseUtils.unexpectedAttribute(reader, i);
            }

            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            if (attribute == Attribute.ID) {
                sawId = true;
                HostExcludeResourceDefinition.HOST_RELEASE.parseAndSetParameter(value, addOp, reader);
            } else {
                throw unexpectedAttribute(reader, i);
            }
        }

        if (!sawId) {
            throw missingRequired(reader, Attribute.ID.getLocalName());
        }

        requireNoContent(reader);
    }
 
Example #6
Source File: PatchXmlUtils.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
static void parseModules(final XMLExtendedStreamReader reader, final Collection<ContentModification> modifications) throws XMLStreamException {
    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        final Element element = Element.forName(reader.getLocalName());
        switch (element) {
            case ADDED:
                modifications.add(parseModuleModification(reader, ModificationType.ADD));
                break;
            case UPDATED:
                modifications.add(parseModuleModification(reader, ModificationType.MODIFY));
                break;
            case REMOVED:
                modifications.add(parseModuleModification(reader, ModificationType.REMOVE));
                break;
            default:
                throw unexpectedElement(reader);
        }
    }
}
 
Example #7
Source File: ManagementXml_Legacy.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 #8
Source File: HostXml_10.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseNativeManagementInterface(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list)  throws XMLStreamException {

        final ModelNode operationAddress = address.clone();
        operationAddress.add(MANAGEMENT_INTERFACE, NATIVE_INTERFACE);
        final ModelNode addOp = Util.getEmptyOperation(ADD, operationAddress);

        // Handle attributes
        parseNativeManagementInterfaceAttributes(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:
                    parseNativeManagementSocket(reader, addOp);
                    break;
                default:
                    throw unexpectedElement(reader);
            }
        }

        list.add(addOp);
    }
 
Example #9
Source File: HostXml_7.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseServersAttributes(final XMLExtendedStreamReader reader, final ModelNode parentAddress, final List<ModelNode> list) throws XMLStreamException {
    // Handle attributes
    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 DIRECTORY_GROUPING: {
                    final ModelNode address = parentAddress.clone();
                    list.add(Util.getWriteAttributeOperation(address, DIRECTORY_GROUPING, HostResourceDefinition.DIRECTORY_GROUPING.parse(value,reader)));
                    break;
                }
                default:
                    throw unexpectedAttribute(reader, i);
            }
        }
    }
}
 
Example #10
Source File: HostXml_13.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseNativeManagementInterface(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list)  throws XMLStreamException {

        final ModelNode operationAddress = address.clone();
        operationAddress.add(MANAGEMENT_INTERFACE, NATIVE_INTERFACE);
        final ModelNode addOp = Util.getEmptyOperation(ADD, operationAddress);

        // Handle attributes
        parseNativeManagementInterfaceAttributes(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:
                    parseNativeManagementSocket(reader, addOp);
                    break;
                default:
                    throw unexpectedElement(reader);
            }
        }

        list.add(addOp);
    }
 
Example #11
Source File: CamelIntegrationParser.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
private static void parseComponentElement(XMLExtendedStreamReader reader, CamelDeploymentSettings.Builder result, PropertyReplacer propertyReplacer) throws XMLStreamException {
    String value = getAttributeValue(reader, Attribute.NAME, propertyReplacer);
    if (value != null && !value.isEmpty()) {
        if( value.startsWith(CAMEL_COMPONENT_PREFIX) ) {
            value = value.substring(CAMEL_COMPONENT_PREFIX.length());
        }
        value = APACHE_CAMEL_COMPONENT_MODULE + "." + value;
        result.dependency(value);
    }
    switch (reader.nextTag()) {
        case XMLStreamConstants.END_ELEMENT: {
            return;
        }
        default: {
            throw unexpectedContent(reader);
        }
    }
}
 
Example #12
Source File: DomainXml_7.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 #13
Source File: DomainXml_13.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 #14
Source File: ManagementXml_4.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseKerberosAuthentication(final XMLExtendedStreamReader reader,
        final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException {
    ModelNode addr = realmAddress.clone().add(AUTHENTICATION, KERBEROS);
    ModelNode kerberos = Util.getEmptyOperation(ADD, addr);
    list.add(kerberos);

    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 REMOVE_REALM:
                    KerberosAuthenticationResourceDefinition.REMOVE_REALM.parseAndSetParameter(value, kerberos, reader);
                    break;
                default: {
                    throw unexpectedAttribute(reader, i);
                }
            }
        }
    }

    requireNoContent(reader);
}
 
Example #15
Source File: DomainXml_Legacy.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void readDomainElementAttributes_1_0(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException {
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        switch (Namespace.forUri(reader.getAttributeNamespace(i))) {
            case XML_SCHEMA_INSTANCE: {
                switch (Attribute.forName(reader.getAttributeLocalName(i))) {
                    case SCHEMA_LOCATION: {
                        parseSchemaLocations(reader, address, list, i);
                        break;
                    }
                    case NO_NAMESPACE_SCHEMA_LOCATION: {
                        // todo, jeez
                        break;
                    }
                    default: {
                        throw unexpectedAttribute(reader, i);
                    }
                }
                break;
            }
            default:
                throw unexpectedAttribute(reader, i);
        }
    }
}
 
Example #16
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
    // Require no attributes
    ParseUtils.requireNoAttributes(reader);
    ModelNode addKeycloakSub = Util.createAddOperation(PathAddress.pathAddress(KeycloakExtension.PATH_SUBSYSTEM));
    list.add(addKeycloakSub);

    while (reader.hasNext() && nextTag(reader) != END_ELEMENT) {
        if (reader.getLocalName().equals(RealmDefinition.TAG_NAME)) {
            readRealm(reader, list);
        }
        else if (reader.getLocalName().equals(SecureDeploymentDefinition.TAG_NAME)) {
            readDeployment(reader, list);
        }
    }
}
 
Example #17
Source File: HostXml_4.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseJvms(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list)
        throws XMLStreamException {

    requireNoAttributes(reader);

    final Set<String> names = new HashSet<String>();
    // Handle elements
    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        requireNamespace(reader, namespace);
        final Element element = Element.forName(reader.getLocalName());
        switch (element) {
            case JVM:
                JvmXml.parseJvm(reader, address, namespace, list, names, false);
                break;
            default:
                throw unexpectedElement(reader);
        }
    }
}
 
Example #18
Source File: DeploymentScannerParser_1_0.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/** {@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: {
                final String element = reader.getLocalName();
                switch (element) {
                    case CommonAttributes.DEPLOYMENT_SCANNER: {
                        //noinspection unchecked
                        parseScanner(reader, address, list);
                        break;
                    }
                    default: throw unexpectedElement(reader);
                }
                break;
            }
            default: throw unexpectedElement(reader);
        }
    }
}
 
Example #19
Source File: JMXExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseAuditLogHandlers(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException {
    ParseUtils.requireNoAttributes(reader);

    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        final String element = reader.getLocalName();
        switch (element) {
            case HANDLER:
                parseAuditLogHandler(reader, list);
                break;
            default: {
                throw ParseUtils.unexpectedElement(reader);
            }
        }
    }
}
 
Example #20
Source File: HostXml_14.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseServer(final XMLExtendedStreamReader reader, final ModelNode parentAddress, final List<ModelNode> list,
                         final Set<String> serverNames) throws XMLStreamException {

    // Handle attributes
    final ModelNode addUpdate = parseServerAttributes(reader, parentAddress, serverNames);
    final ModelNode address = addUpdate.require(OP_ADDR);
    list.add(addUpdate);

    // Handle elements
    parseServerContent(reader, addUpdate, address, list);
}
 
Example #21
Source File: ProvisioningXmlParser30.java    From galleon with Apache License 2.0 5 votes vote down vote up
static FeaturePackLocation parseFpl(XMLExtendedStreamReader reader, int i)
        throws XMLStreamException {
    try {
        return FeaturePackLocation.fromString(reader.getAttributeValue(i));
    } catch(IllegalArgumentException e) {
        throw ParsingUtils.error("Failed to parse feature-pack location " + reader.getAttributeValue(i), reader.getLocation(), e);
    }
}
 
Example #22
Source File: HostXml_14.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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);

        int socketCount = 0;
        int httpUpgradeCount = 0;

        // 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:
                    if (++socketCount > 1) {
                        throw unexpectedElement(reader);
                    }
                    parseHttpManagementSocket(reader, addOp);
                    break;
                case HTTP_UPGRADE:
                    if (++httpUpgradeCount > 1) {
                        throw unexpectedElement(reader);
                    }
                    parseHttpUpgrade(reader, addOp);
                    break;
                case CONSTANT_HEADERS:
                    parseConstantHeaders(reader, addOp);
                    break;
                default:
                    throw unexpectedElement(reader);
            }
        }

        list.add(addOp);
    }
 
Example #23
Source File: StandaloneXml_12.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseNativeRemotingManagementInterface(final XMLExtendedStreamReader reader, final ModelNode address,
                                                    final List<ModelNode> list) throws XMLStreamException {

    requireNoAttributes(reader);
    //requireNoContent(reader);

    final ModelNode connector = new ModelNode();
    connector.get(OP).set(ADD);
    ModelNode operationAddress = address.clone();
    operationAddress.add(MANAGEMENT_INTERFACE, NATIVE_REMOTING_INTERFACE);
    connector.get(OP_ADDR).set(operationAddress);
    list.add(connector);

    reader.discardRemainder();
}
 
Example #24
Source File: DomainXml_4.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseHostApiVersion(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException {

        Set<Attribute> required = EnumSet.of(Attribute.MAJOR_VERSION, Attribute.MINOR_VERSION);
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i++) {

            final String value = reader.getAttributeValue(i);
            if (!isNoNamespaceAttribute(reader, i)) {
                throw ParseUtils.unexpectedAttribute(reader, i);
            }

            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            if (attribute == Attribute.MAJOR_VERSION) {
                required.remove(attribute);
                HostExcludeResourceDefinition.MANAGEMENT_MAJOR_VERSION.parseAndSetParameter(value, addOp, reader);
            } else if (attribute == Attribute.MINOR_VERSION) {
                required.remove(attribute);
                HostExcludeResourceDefinition.MANAGEMENT_MINOR_VERSION.parseAndSetParameter(value, addOp, reader);
            } else if (attribute == Attribute.MICRO_VERSION) {
                HostExcludeResourceDefinition.MANAGEMENT_MICRO_VERSION.parseAndSetParameter(value, addOp, reader);
            } else {
                throw unexpectedAttribute(reader, i);
            }
        }

        if (!required.isEmpty()) {
            throw missingRequired(reader, required);
        }

        requireNoContent(reader);
    }
 
Example #25
Source File: AuditLogXml_Legacy.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseSizeRotatingFileAuditLogHandler(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException {
    final ModelNode add = Util.createAddOperation();
    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.SIZE_ROTATING_FILE_HANDLER, value);
                break;
            case MAX_FAILURE_COUNT:
                SizeRotatingFileAuditLogHandlerResourceDefinition.MAX_FAILURE_COUNT.parseAndSetParameter(value, add, reader);
                break;
            case FORMATTER:
                SizeRotatingFileAuditLogHandlerResourceDefinition.FORMATTER.parseAndSetParameter(value, add, reader);
                break;
            case PATH:
                SizeRotatingFileAuditLogHandlerResourceDefinition.PATH.parseAndSetParameter(value, add, reader);
                break;
            case RELATIVE_TO:
                SizeRotatingFileAuditLogHandlerResourceDefinition.RELATIVE_TO.parseAndSetParameter(value, add, reader);
                break;
            case ROTATE_SIZE:
                SizeRotatingFileAuditLogHandlerResourceDefinition.ROTATE_SIZE.parseAndSetParameter(value, add, reader);
                break;
            case MAX_BACKUP_INDEX:
                SizeRotatingFileAuditLogHandlerResourceDefinition.MAX_BACKUP_INDEX.parseAndSetParameter(value, add, reader);
                break;
            default:
                throw unexpectedAttribute(reader, i);
        }
    }

    requireNoContent(reader);
}
 
Example #26
Source File: HostXml_7.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@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 #27
Source File: StandaloneXml_4.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseHttpManagementSocketBinding(XMLExtendedStreamReader reader, ModelNode addOp) throws XMLStreamException {

        // Handle attributes

        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 HTTP: {
                        HttpManagementResourceDefinition.SOCKET_BINDING.parseAndSetParameter(value, addOp, reader);
                        break;
                    }
                    case HTTPS: {
                        HttpManagementResourceDefinition.SECURE_SOCKET_BINDING.parseAndSetParameter(value, addOp, reader);
                        break;
                    }
                    default:
                        throw unexpectedAttribute(reader, i);
                }
            }
        }

        requireNoContent(reader);
    }
 
Example #28
Source File: HostXml_5.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseServer(final XMLExtendedStreamReader reader, final ModelNode parentAddress, final List<ModelNode> list,
        final Set<String> serverNames) throws XMLStreamException {

    // Handle attributes
    final ModelNode addUpdate = parseServerAttributes(reader, parentAddress, serverNames);
    final ModelNode address = addUpdate.require(OP_ADDR);
    list.add(addUpdate);

    // Handle elements
    parseServerContent(reader, addUpdate, address, list);
}
 
Example #29
Source File: StandaloneXml_9.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseNativeRemotingManagementInterface(final XMLExtendedStreamReader reader, final ModelNode address,
                                                    final List<ModelNode> list) throws XMLStreamException {

    requireNoAttributes(reader);
    //requireNoContent(reader);

    final ModelNode connector = new ModelNode();
    connector.get(OP).set(ADD);
    ModelNode operationAddress = address.clone();
    operationAddress.add(MANAGEMENT_INTERFACE, NATIVE_REMOTING_INTERFACE);
    connector.get(OP_ADDR).set(operationAddress);
    list.add(connector);

    reader.discardRemainder();
}
 
Example #30
Source File: StandaloneXml_Legacy.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public boolean parseManagementInterfaces(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> operationsList)
        throws XMLStreamException {

    switch (namespace) {
        case DOMAIN_1_0:
            parseManagementInterfaces_1_0(reader, address, operationsList);
            break;
        default:
            parseManagementInterfaces_1_1(reader, address, operationsList);
    }

    return true;
}