picketlink/src/main/java/org/wildfly/extension/picketlink/federation/model/parser/AbstractFederationSubsystemReader.java
protected ModelNode parseConfig(XMLExtendedStreamReader reader, ModelElement xmlElement, String key, ModelNode lastNode,
        List<SimpleAttributeDefinition> attributes, List<ModelNode> addOperations) throws XMLStreamException {
        if (!reader.getLocalName().equals(xmlElement.getName())) {
            return null;
        }

        ModelNode modelNode = Util.getEmptyOperation(ADD, null);

        int attributeCount = reader.getAttributeCount();

        for (int i = 0; i < attributeCount; i++) {
            String attributeLocalName = reader.getAttributeLocalName(i);

            if (ModelElement.forName(attributeLocalName) == null) {
                throw unexpectedAttribute(reader, i);
            }
        }

        for (SimpleAttributeDefinition simpleAttributeDefinition : attributes) {
            String attributeValue = reader.getAttributeValue("", simpleAttributeDefinition.getXmlName());
            simpleAttributeDefinition.parseAndSetParameter(attributeValue, modelNode, reader);
        }

        String name = xmlElement.getName();

        if (key != null) {
            name = key;

            if (modelNode.hasDefined(key)) {
                name = modelNode.get(key).asString();
            } else {
                String attributeValue = reader.getAttributeValue("", key);

                if (attributeValue != null) {
                    name = attributeValue;
                }
            }
        }

        modelNode.get(ModelDescriptionConstants.OP_ADDR).set(lastNode.clone().get(OP_ADDR).add(xmlElement.getName(), name));

        addOperations.add(modelNode);

        return modelNode;
    }
protected ModelNode parseConfig(XMLExtendedStreamReader reader, ModelElement xmlElement, String key, ModelNode lastNode,
        List<SimpleAttributeDefinition> attributes, List<ModelNode> addOperations) throws XMLStreamException {
        if (!reader.getLocalName().equals(xmlElement.getName())) {
            return null;
        }

        ModelNode modelNode = Util.getEmptyOperation(ADD, null);

        int attributeCount = reader.getAttributeCount();

        for (int i = 0; i < attributeCount; i++) {
            String attributeLocalName = reader.getAttributeLocalName(i);

            if (ModelElement.forName(attributeLocalName) == null) {
                throw unexpectedAttribute(reader, i);
            }
        }

        for (SimpleAttributeDefinition simpleAttributeDefinition : attributes) {
            String attributeValue = reader.getAttributeValue("", simpleAttributeDefinition.getXmlName());
            simpleAttributeDefinition.parseAndSetParameter(attributeValue, modelNode, reader);
        }

        String name = xmlElement.getName();

        if (key != null) {
            name = key;

            if (modelNode.hasDefined(key)) {
                name = modelNode.get(key).asString();
            } else {
                String attributeValue = reader.getAttributeValue("", key);

                if (attributeValue != null) {
                    name = attributeValue;
                }
            }
        }

        modelNode.get(ModelDescriptionConstants.OP_ADDR).set(lastNode.clone().get(OP_ADDR).add(xmlElement.getName(), name));

        addOperations.add(modelNode);

        return modelNode;
    }
protected ModelNode parseConfig ( XMLExtendedStreamReader reader , ModelElement xmlElement , String key , ModelNode lastNode , List < SimpleAttributeDefinition > attributes , List < ModelNode > addOperations ) throws XMLStreamException { if ( ! reader . getLocalName ( ) . equals ( xmlElement . getName ( ) ) ) { return null ; } ModelNode modelNode = Util . getEmptyOperation ( ADD , null ) ; int attributeCount = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < attributeCount ; i ++ ) { String attributeLocalName = reader . getAttributeLocalName ( i ) ; if ( ModelElement . forName ( attributeLocalName ) == null ) { throw unexpectedAttribute ( reader , i ) ; } } for ( SimpleAttributeDefinition simpleAttributeDefinition : attributes ) { String attributeValue = reader . getAttributeValue ( "" , simpleAttributeDefinition . getXmlName ( ) ) ; simpleAttributeDefinition . parseAndSetParameter ( attributeValue , modelNode , reader ) ; } String name = xmlElement . getName ( ) ; if ( key != null ) { name = key ; if ( modelNode . hasDefined ( key ) ) { name = modelNode . get ( key ) . asString ( ) ; } else { String attributeValue = reader . getAttributeValue ( "" , key ) ; if ( attributeValue != null ) { name = attributeValue ; } } } modelNode . get ( ModelDescriptionConstants . OP_ADDR ) . set ( lastNode . clone ( ) . get ( OP_ADDR ) . add ( xmlElement . getName ( ) , name ) ) ; addOperations . add ( modelNode ) ; return modelNode ; }
Reads a element from the stream considering the parameters.

@param reader XMLExtendedStreamReader instance from which the elements are read.
@param xmlElement Name of the Model Element to be parsed.
@param key Name of the attribute to be used to as the key for the model.
@param addOperations List of operations.
@param lastNode Parent ModelNode instance.
@param attributes AttributeDefinition instances to be used to extract the attributes and populate the resulting model.

@return A ModelNode instance populated.

@throws javax.xml.stream.XMLStreamException
Reads a element from the stream considering the parameters .