Search in sources :

Example 11 with ParserException

use of org.jboss.as.connector.util.ParserException in project wildfly by wildfly.

the class DsParser method parseDataSource_1_0.

private void parseDataSource_1_0(final XMLExtendedStreamReader reader, final List<ModelNode> list, final ModelNode parentAddress) throws XMLStreamException, ParserException, ValidateException {
    String poolName = null;
    final ModelNode operation = new ModelNode();
    operation.get(OP).set(ADD);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        if (!isNoNamespaceAttribute(reader, i)) {
            throw unexpectedAttribute(reader, i);
        }
        final DataSource.Attribute attribute = DataSource.Attribute.forName(reader.getAttributeLocalName(i));
        switch(attribute) {
            case ENABLED:
                {
                    final String value = rawAttributeText(reader, ENABLED.getXmlName());
                    if (value != null) {
                        ENABLED.parseAndSetParameter(value, operation, reader);
                    }
                    break;
                }
            case JNDI_NAME:
                {
                    final String jndiName = rawAttributeText(reader, JNDI_NAME.getXmlName());
                    JNDI_NAME.parseAndSetParameter(jndiName, operation, reader);
                    break;
                }
            case POOL_NAME:
                {
                    poolName = rawAttributeText(reader, POOLNAME_NAME);
                    break;
                }
            case USE_JAVA_CONTEXT:
                {
                    final String value = rawAttributeText(reader, USE_JAVA_CONTEXT.getXmlName());
                    if (value != null) {
                        USE_JAVA_CONTEXT.parseAndSetParameter(value, operation, reader);
                    }
                    break;
                }
            case SPY:
                {
                    final String value = rawAttributeText(reader, SPY.getXmlName());
                    if (value != null) {
                        SPY.parseAndSetParameter(value, operation, reader);
                    }
                    break;
                }
            case USE_CCM:
                {
                    final String value = rawAttributeText(reader, USE_CCM.getXmlName());
                    if (value != null) {
                        USE_CCM.parseAndSetParameter(value, operation, reader);
                    }
                    break;
                }
            case JTA:
                {
                    final String value = rawAttributeText(reader, JTA.getXmlName());
                    if (value != null) {
                        JTA.parseAndSetParameter(value, operation, reader);
                    }
                    break;
                }
            default:
                throw ParseUtils.unexpectedAttribute(reader, i);
        }
    }
    final ModelNode dsAddress = parentAddress.clone();
    dsAddress.add(DATA_SOURCE, poolName);
    dsAddress.protect();
    operation.get(OP_ADDR).set(dsAddress);
    List<ModelNode> configPropertiesOperations = new ArrayList<ModelNode>(0);
    //elements reading
    while (reader.hasNext()) {
        switch(reader.nextTag()) {
            case END_ELEMENT:
                {
                    if (DataSources.Tag.forName(reader.getLocalName()) == DataSources.Tag.DATASOURCE) {
                        list.add(operation);
                        list.addAll(configPropertiesOperations);
                        return;
                    } else {
                        if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.UNKNOWN) {
                            throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                        }
                    }
                    break;
                }
            case START_ELEMENT:
                {
                    switch(DataSource.Tag.forName(reader.getLocalName())) {
                        case CONNECTION_PROPERTY:
                            {
                                String name = rawAttributeText(reader, "name");
                                String value = rawElementText(reader);
                                final ModelNode configOperation = new ModelNode();
                                configOperation.get(OP).set(ADD);
                                final ModelNode configAddress = dsAddress.clone();
                                configAddress.add(CONNECTION_PROPERTIES.getName(), name);
                                configAddress.protect();
                                configOperation.get(OP_ADDR).set(configAddress);
                                CONNECTION_PROPERTY_VALUE.parseAndSetParameter(value, configOperation, reader);
                                configPropertiesOperations.add(configOperation);
                                break;
                            }
                        case CONNECTION_URL:
                            {
                                String value = rawElementText(reader);
                                CONNECTION_URL.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case DRIVER_CLASS:
                            {
                                String value = rawElementText(reader);
                                DRIVER_CLASS.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case DATASOURCE_CLASS:
                            {
                                String value = rawElementText(reader);
                                DATASOURCE_CLASS.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case DRIVER:
                            {
                                String value = rawElementText(reader);
                                DATASOURCE_DRIVER.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case POOL:
                            {
                                parsePool(reader, operation);
                                break;
                            }
                        case NEW_CONNECTION_SQL:
                            {
                                String value = rawElementText(reader);
                                NEW_CONNECTION_SQL.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case URL_DELIMITER:
                            {
                                String value = rawElementText(reader);
                                URL_DELIMITER.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case URL_SELECTOR_STRATEGY_CLASS_NAME:
                            {
                                String value = rawElementText(reader);
                                URL_SELECTOR_STRATEGY_CLASS_NAME.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case TRANSACTION_ISOLATION:
                            {
                                String value = rawElementText(reader);
                                TRANSACTION_ISOLATION.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case SECURITY:
                            {
                                parseDsSecurity(reader, operation);
                                break;
                            }
                        case STATEMENT:
                            {
                                parseStatementSettings(reader, operation);
                                break;
                            }
                        case TIMEOUT:
                            {
                                parseTimeOutSettings(reader, operation);
                                break;
                            }
                        case VALIDATION:
                            {
                                parseValidationSetting(reader, operation);
                                break;
                            }
                        default:
                            throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
                    }
                    break;
                }
        }
    }
    throw new ParserException(bundle.unexpectedEndOfDocument());
}
Also used : ParserException(org.jboss.as.connector.util.ParserException) ArrayList(java.util.ArrayList) ModelNode(org.jboss.dmr.ModelNode) XaDataSource(org.jboss.jca.common.api.metadata.ds.XaDataSource) DataSource(org.jboss.jca.common.api.metadata.ds.DataSource)

Example 12 with ParserException

use of org.jboss.as.connector.util.ParserException in project wildfly by wildfly.

the class ResourceAdapterParser method parseWorkManagerSecurity_5_0.

protected WorkManagerSecurity parseWorkManagerSecurity_5_0(final ModelNode operation, final XMLStreamReader reader) throws XMLStreamException, ParserException, ValidateException {
    boolean mappingRequired = false;
    String domain = null;
    boolean elytronEnabled = false;
    String defaultPrincipal = null;
    List<String> defaultGroups = null;
    Map<String, String> userMappings = null;
    Map<String, String> groupMappings = null;
    boolean userMappingEnabled = false;
    while (reader.hasNext()) {
        switch(reader.nextTag()) {
            case END_ELEMENT:
                {
                    if (WorkManager.Tag.forName(reader.getLocalName()) == WorkManager.Tag.SECURITY) {
                        return new WorkManagerSecurityImpl(mappingRequired, domain, elytronEnabled, defaultPrincipal, defaultGroups, userMappings, groupMappings);
                    } else {
                        if (WorkManagerSecurity.Tag.forName(reader.getLocalName()) == WorkManagerSecurity.Tag.UNKNOWN) {
                            throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                        }
                    }
                    break;
                }
            case START_ELEMENT:
                {
                    switch(WorkManagerSecurity.Tag.forName(reader.getLocalName())) {
                        case DEFAULT_GROUPS:
                        case MAPPINGS:
                            {
                                // Skip
                                break;
                            }
                        case MAPPING_REQUIRED:
                            {
                                String value = rawElementText(reader);
                                WM_SECURITY_MAPPING_REQUIRED.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case DOMAIN:
                            {
                                String value = domain = rawElementText(reader);
                                WM_SECURITY_DOMAIN.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case ELYTRON_SECURITY_DOMAIN:
                            {
                                elytronEnabled = true;
                                String value = domain = rawElementText(reader);
                                WM_ELYTRON_SECURITY_DOMAIN.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case DEFAULT_PRINCIPAL:
                            {
                                String value = rawElementText(reader);
                                WM_SECURITY_DEFAULT_PRINCIPAL.parseAndSetParameter(value, operation, reader);
                                break;
                            }
                        case GROUP:
                            {
                                String value = rawElementText(reader);
                                operation.get(WM_SECURITY_DEFAULT_GROUPS.getName()).add(WM_SECURITY_DEFAULT_GROUP.parse(value, reader));
                                break;
                            }
                        case USERS:
                            {
                                userMappingEnabled = true;
                                break;
                            }
                        case GROUPS:
                            {
                                userMappingEnabled = false;
                                break;
                            }
                        case MAP:
                            {
                                if (userMappingEnabled) {
                                    String from = rawAttributeText(reader, WorkManagerSecurity.Attribute.FROM.getLocalName());
                                    if (from == null || from.trim().equals(""))
                                        throw new ParserException(bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.FROM.getLocalName(), reader.getLocalName()));
                                    String to = rawAttributeText(reader, WorkManagerSecurity.Attribute.TO.getLocalName());
                                    if (to == null || to.trim().equals(""))
                                        throw new ParserException(bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.TO.getLocalName(), reader.getLocalName()));
                                    ModelNode object = new ModelNode();
                                    WM_SECURITY_MAPPING_FROM.parseAndSetParameter(from, object, reader);
                                    WM_SECURITY_MAPPING_TO.parseAndSetParameter(to, object, reader);
                                    operation.get(WM_SECURITY_MAPPING_USERS.getName()).add(object);
                                } else {
                                    String from = rawAttributeText(reader, WorkManagerSecurity.Attribute.FROM.getLocalName());
                                    if (from == null || from.trim().equals(""))
                                        throw new ParserException(bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.FROM.getLocalName(), reader.getLocalName()));
                                    String to = rawAttributeText(reader, WorkManagerSecurity.Attribute.TO.getLocalName());
                                    if (to == null || to.trim().equals(""))
                                        throw new ParserException(bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.TO.getLocalName(), reader.getLocalName()));
                                    ModelNode object = new ModelNode();
                                    WM_SECURITY_MAPPING_FROM.parseAndSetParameter(from, object, reader);
                                    WM_SECURITY_MAPPING_TO.parseAndSetParameter(to, object, reader);
                                    operation.get(WM_SECURITY_MAPPING_GROUPS.getName()).add(object);
                                }
                                break;
                            }
                        default:
                            throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
                    }
                    break;
                }
        }
    }
    throw new ParserException(bundle.unexpectedEndOfDocument());
}
Also used : ParserException(org.jboss.as.connector.util.ParserException) WorkManagerSecurityImpl(org.jboss.as.connector.metadata.resourceadapter.WorkManagerSecurityImpl) ModelNode(org.jboss.dmr.ModelNode)

Example 13 with ParserException

use of org.jboss.as.connector.util.ParserException in project wildfly by wildfly.

the class CommonIronJacamarParser method parseConnectionDefinitions_3_0.

/**
     * parse a single connection-definition tag
     *
     * @param reader the reader
     * @throws javax.xml.stream.XMLStreamException
     *                         XMLStreamException
     * @throws ParserException ParserException
     * @throws org.jboss.jca.common.api.validator.ValidateException
     *                         ValidateException
     */
protected void parseConnectionDefinitions_3_0(final XMLExtendedStreamReader reader, final Map<String, ModelNode> map, final Map<String, HashMap<String, ModelNode>> configMap, final boolean isXa) throws XMLStreamException, ParserException, ValidateException {
    final ModelNode connectionDefinitionNode = new ModelNode();
    connectionDefinitionNode.get(OP).set(ADD);
    String poolName = null;
    String jndiName = null;
    int attributeSize = reader.getAttributeCount();
    boolean poolDefined = Boolean.FALSE;
    for (int i = 0; i < attributeSize; i++) {
        ConnectionDefinition.Attribute attribute = ConnectionDefinition.Attribute.forName(reader.getAttributeLocalName(i));
        String value = reader.getAttributeValue(i);
        switch(attribute) {
            case ENABLED:
                {
                    ENABLED.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case CONNECTABLE:
                {
                    CONNECTABLE.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case TRACKING:
                {
                    TRACKING.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case JNDI_NAME:
                {
                    jndiName = value;
                    JNDINAME.parseAndSetParameter(jndiName, connectionDefinitionNode, reader);
                    break;
                }
            case POOL_NAME:
                {
                    poolName = value;
                    break;
                }
            case USE_JAVA_CONTEXT:
                {
                    USE_JAVA_CONTEXT.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case USE_CCM:
                {
                    USE_CCM.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case SHARABLE:
                {
                    SHARABLE.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case ENLISTMENT:
                {
                    ENLISTMENT.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case CLASS_NAME:
                {
                    CLASS_NAME.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            default:
                throw ParseUtils.unexpectedAttribute(reader, i);
        }
    }
    if (poolName == null || poolName.trim().equals("")) {
        if (jndiName != null && jndiName.trim().length() != 0) {
            if (jndiName.contains("/")) {
                poolName = jndiName.substring(jndiName.lastIndexOf("/") + 1);
            } else {
                poolName = jndiName.substring(jndiName.lastIndexOf(":") + 1);
            }
        } else {
            throw ParseUtils.missingRequired(reader, EnumSet.of(ConnectionDefinition.Attribute.JNDI_NAME));
        }
    }
    while (reader.hasNext()) {
        switch(reader.nextTag()) {
            case END_ELEMENT:
                {
                    if (Activation.Tag.forName(reader.getLocalName()) == Activation.Tag.CONNECTION_DEFINITION) {
                        map.put(poolName, connectionDefinitionNode);
                        return;
                    } else {
                        if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.UNKNOWN) {
                            throw ParseUtils.unexpectedEndElement(reader);
                        }
                    }
                    break;
                }
            case START_ELEMENT:
                {
                    switch(ConnectionDefinition.Tag.forName(reader.getLocalName())) {
                        case CONFIG_PROPERTY:
                            {
                                if (!configMap.containsKey(poolName)) {
                                    configMap.put(poolName, new HashMap<String, ModelNode>(0));
                                }
                                parseConfigProperties(reader, configMap.get(poolName));
                                break;
                            }
                        case SECURITY:
                            {
                                parseSecuritySettings(reader, connectionDefinitionNode);
                                break;
                            }
                        case TIMEOUT:
                            {
                                parseTimeOut(reader, isXa, connectionDefinitionNode);
                                break;
                            }
                        case VALIDATION:
                            {
                                parseValidation(reader, connectionDefinitionNode);
                                break;
                            }
                        case XA_POOL:
                            {
                                if (!isXa) {
                                    throw ParseUtils.unexpectedElement(reader);
                                }
                                if (poolDefined) {
                                    throw new ParserException(bundle.multiplePools());
                                }
                                parseXaPool(reader, connectionDefinitionNode);
                                poolDefined = true;
                                break;
                            }
                        case POOL:
                            {
                                if (isXa) {
                                    throw ParseUtils.unexpectedElement(reader);
                                }
                                if (poolDefined) {
                                    throw new ParserException(bundle.multiplePools());
                                }
                                parsePool(reader, connectionDefinitionNode);
                                poolDefined = true;
                                break;
                            }
                        case RECOVERY:
                            {
                                parseRecovery(reader, connectionDefinitionNode);
                                break;
                            }
                        default:
                            throw ParseUtils.unexpectedElement(reader);
                    }
                    break;
                }
        }
    }
    throw ParseUtils.unexpectedEndElement(reader);
}
Also used : ParserException(org.jboss.as.connector.util.ParserException) ConnectionDefinition(org.jboss.jca.common.api.metadata.resourceadapter.ConnectionDefinition) ModelNode(org.jboss.dmr.ModelNode)

Example 14 with ParserException

use of org.jboss.as.connector.util.ParserException in project wildfly by wildfly.

the class CommonIronJacamarParser method parseConnectionDefinitions_5_0.

/**
     * parse a single connection-definition tag
     *
     * @param reader the reader
     * @throws javax.xml.stream.XMLStreamException
     *                         XMLStreamException
     * @throws ParserException ParserException
     * @throws org.jboss.jca.common.api.validator.ValidateException
     *                         ValidateException
     */
protected void parseConnectionDefinitions_5_0(final XMLExtendedStreamReader reader, final Map<String, ModelNode> map, final Map<String, HashMap<String, ModelNode>> configMap, final boolean isXa) throws XMLStreamException, ParserException, ValidateException {
    final ModelNode connectionDefinitionNode = new ModelNode();
    connectionDefinitionNode.get(OP).set(ADD);
    final String poolName = parseConnectionAttributes_5_0(reader, connectionDefinitionNode);
    boolean poolDefined = Boolean.FALSE;
    while (reader.hasNext()) {
        switch(reader.nextTag()) {
            case END_ELEMENT:
                {
                    if (Activation.Tag.forName(reader.getLocalName()) == Activation.Tag.CONNECTION_DEFINITION) {
                        map.put(poolName, connectionDefinitionNode);
                        return;
                    } else {
                        if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.UNKNOWN) {
                            throw ParseUtils.unexpectedEndElement(reader);
                        }
                    }
                    break;
                }
            case START_ELEMENT:
                {
                    switch(ConnectionDefinition.Tag.forName(reader.getLocalName())) {
                        case CONFIG_PROPERTY:
                            {
                                if (!configMap.containsKey(poolName)) {
                                    configMap.put(poolName, new HashMap<String, ModelNode>(0));
                                }
                                parseConfigProperties(reader, configMap.get(poolName));
                                break;
                            }
                        case SECURITY:
                            {
                                parseElytronSupportedSecuritySettings(reader, connectionDefinitionNode);
                                break;
                            }
                        case TIMEOUT:
                            {
                                parseTimeOut(reader, isXa, connectionDefinitionNode);
                                break;
                            }
                        case VALIDATION:
                            {
                                parseValidation(reader, connectionDefinitionNode);
                                break;
                            }
                        case XA_POOL:
                            {
                                if (!isXa) {
                                    throw ParseUtils.unexpectedElement(reader);
                                }
                                if (poolDefined) {
                                    throw new ParserException(bundle.multiplePools());
                                }
                                parseXaPool(reader, connectionDefinitionNode);
                                poolDefined = true;
                                break;
                            }
                        case POOL:
                            {
                                if (isXa) {
                                    throw ParseUtils.unexpectedElement(reader);
                                }
                                if (poolDefined) {
                                    throw new ParserException(bundle.multiplePools());
                                }
                                parsePool(reader, connectionDefinitionNode);
                                poolDefined = true;
                                break;
                            }
                        case RECOVERY:
                            {
                                parseElytronSupportedRecovery(reader, connectionDefinitionNode);
                                break;
                            }
                        default:
                            throw ParseUtils.unexpectedElement(reader);
                    }
                    break;
                }
        }
    }
    throw ParseUtils.unexpectedEndElement(reader);
}
Also used : ParserException(org.jboss.as.connector.util.ParserException) ModelNode(org.jboss.dmr.ModelNode)

Example 15 with ParserException

use of org.jboss.as.connector.util.ParserException in project wildfly by wildfly.

the class CommonIronJacamarParser method parseConnectionDefinitions_1_0.

/**
         * parse a single connection-definition tag
         *
         * @param reader the reader
         * @throws javax.xml.stream.XMLStreamException
         *                         XMLStreamException
         * @throws ParserException ParserException
         * @throws org.jboss.jca.common.api.validator.ValidateException
         *                         ValidateException
         */
protected void parseConnectionDefinitions_1_0(final XMLExtendedStreamReader reader, final Map<String, ModelNode> map, final Map<String, HashMap<String, ModelNode>> configMap, final boolean isXa) throws XMLStreamException, ParserException, ValidateException {
    final ModelNode connectionDefinitionNode = new ModelNode();
    connectionDefinitionNode.get(OP).set(ADD);
    String poolName = null;
    String jndiName = null;
    int attributeSize = reader.getAttributeCount();
    boolean poolDefined = Boolean.FALSE;
    for (int i = 0; i < attributeSize; i++) {
        ConnectionDefinition.Attribute attribute = ConnectionDefinition.Attribute.forName(reader.getAttributeLocalName(i));
        String value = reader.getAttributeValue(i);
        switch(attribute) {
            case ENABLED:
                {
                    ENABLED.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case JNDI_NAME:
                {
                    jndiName = value;
                    JNDINAME.parseAndSetParameter(jndiName, connectionDefinitionNode, reader);
                    break;
                }
            case POOL_NAME:
                {
                    poolName = value;
                    break;
                }
            case USE_JAVA_CONTEXT:
                {
                    USE_JAVA_CONTEXT.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case USE_CCM:
                {
                    USE_CCM.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case SHARABLE:
                {
                    SHARABLE.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case ENLISTMENT:
                {
                    ENLISTMENT.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            case CLASS_NAME:
                {
                    CLASS_NAME.parseAndSetParameter(value, connectionDefinitionNode, reader);
                    break;
                }
            default:
                throw ParseUtils.unexpectedAttribute(reader, i);
        }
    }
    if (poolName == null || poolName.trim().equals("")) {
        if (jndiName != null && jndiName.trim().length() != 0) {
            if (jndiName.contains("/")) {
                poolName = jndiName.substring(jndiName.lastIndexOf("/") + 1);
            } else {
                poolName = jndiName.substring(jndiName.lastIndexOf(":") + 1);
            }
        } else {
            throw ParseUtils.missingRequired(reader, EnumSet.of(ConnectionDefinition.Attribute.JNDI_NAME));
        }
    }
    while (reader.hasNext()) {
        switch(reader.nextTag()) {
            case END_ELEMENT:
                {
                    if (Activation.Tag.forName(reader.getLocalName()) == Activation.Tag.CONNECTION_DEFINITION) {
                        map.put(poolName, connectionDefinitionNode);
                        return;
                    } else {
                        if (ConnectionDefinition.Tag.forName(reader.getLocalName()) == ConnectionDefinition.Tag.UNKNOWN) {
                            throw ParseUtils.unexpectedEndElement(reader);
                        }
                    }
                    break;
                }
            case START_ELEMENT:
                {
                    switch(ConnectionDefinition.Tag.forName(reader.getLocalName())) {
                        case CONFIG_PROPERTY:
                            {
                                if (!configMap.containsKey(poolName)) {
                                    configMap.put(poolName, new HashMap<String, ModelNode>(0));
                                }
                                parseConfigProperties(reader, configMap.get(poolName));
                                break;
                            }
                        case SECURITY:
                            {
                                parseSecuritySettings(reader, connectionDefinitionNode);
                                break;
                            }
                        case TIMEOUT:
                            {
                                parseTimeOut(reader, isXa, connectionDefinitionNode);
                                break;
                            }
                        case VALIDATION:
                            {
                                parseValidation(reader, connectionDefinitionNode);
                                break;
                            }
                        case XA_POOL:
                            {
                                if (!isXa) {
                                    throw ParseUtils.unexpectedElement(reader);
                                }
                                if (poolDefined) {
                                    throw new ParserException(bundle.multiplePools());
                                }
                                parseXaPool(reader, connectionDefinitionNode);
                                poolDefined = true;
                                break;
                            }
                        case POOL:
                            {
                                if (isXa) {
                                    throw ParseUtils.unexpectedElement(reader);
                                }
                                if (poolDefined) {
                                    throw new ParserException(bundle.multiplePools());
                                }
                                parsePool(reader, connectionDefinitionNode);
                                poolDefined = true;
                                break;
                            }
                        case RECOVERY:
                            {
                                parseRecovery(reader, connectionDefinitionNode);
                                break;
                            }
                        default:
                            throw ParseUtils.unexpectedElement(reader);
                    }
                    break;
                }
        }
    }
    throw ParseUtils.unexpectedEndElement(reader);
}
Also used : ParserException(org.jboss.as.connector.util.ParserException) ConnectionDefinition(org.jboss.jca.common.api.metadata.resourceadapter.ConnectionDefinition) ModelNode(org.jboss.dmr.ModelNode)

Aggregations

ParserException (org.jboss.as.connector.util.ParserException)25 ModelNode (org.jboss.dmr.ModelNode)16 ArrayList (java.util.ArrayList)8 XaDataSource (org.jboss.jca.common.api.metadata.ds.XaDataSource)8 DataSource (org.jboss.jca.common.api.metadata.ds.DataSource)4 ConnectionDefinition (org.jboss.jca.common.api.metadata.resourceadapter.ConnectionDefinition)3 WorkManagerSecurityImpl (org.jboss.as.connector.metadata.resourceadapter.WorkManagerSecurityImpl)2 HashMap (java.util.HashMap)1 Driver (org.jboss.jca.common.api.metadata.ds.Driver)1