Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2010, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.jboss.as.connector.subsystems.datasources;
 
 import static org.jboss.as.connector.ConnectorLogger.SUBSYSTEM_DATASOURCES_LOGGER;
 import static org.jboss.as.connector.pool.Constants.BACKGROUNDVALIDATION;
 import static org.jboss.as.connector.pool.Constants.BACKGROUNDVALIDATIONMILLIS;
 import static org.jboss.as.connector.pool.Constants.BLOCKING_TIMEOUT_WAIT_MILLIS;
 import static org.jboss.as.connector.pool.Constants.IDLETIMEOUTMINUTES;
 import static org.jboss.as.connector.pool.Constants.MAX_POOL_SIZE;
 import static org.jboss.as.connector.pool.Constants.MIN_POOL_SIZE;
 import static org.jboss.as.connector.pool.Constants.POOL_FLUSH_STRATEGY;
 import static org.jboss.as.connector.pool.Constants.POOL_PREFILL;
 import static org.jboss.as.connector.pool.Constants.POOL_USE_STRICT_MIN;
 import static org.jboss.as.connector.pool.Constants.USE_FAST_FAIL;
 import static org.jboss.as.connector.subsystems.datasources.AbstractDataSourceAdd.populateAddModel;
 import static org.jboss.as.connector.subsystems.datasources.Constants.ALLOCATION_RETRY;
 import static org.jboss.as.connector.subsystems.datasources.Constants.ALLOCATION_RETRY_WAIT_MILLIS;
 import static org.jboss.as.connector.subsystems.datasources.Constants.CHECKVALIDCONNECTIONSQL;
 import static org.jboss.as.connector.subsystems.datasources.Constants.CONNECTION_PROPERTIES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.CONNECTION_URL;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DATASOURCES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DATASOURCE_CLASS;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DATASOURCE_DRIVER;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DATA_SOURCE;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_CLASS;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_CLASS_NAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_DATASOURCE_CLASS_NAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_MAJOR_VERSION;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_MINOR_VERSION;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_MODULE_NAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_NAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_XA_DATASOURCE_CLASS_NAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.ENABLED;
 import static org.jboss.as.connector.subsystems.datasources.Constants.EXCEPTIONSORTERCLASSNAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.EXCEPTIONSORTER_PROPERTIES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.INTERLEAVING;
 import static org.jboss.as.connector.subsystems.datasources.Constants.JDBC_DRIVER_NAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.JNDINAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.JTA;
 import static org.jboss.as.connector.subsystems.datasources.Constants.NEW_CONNECTION_SQL;
 import static org.jboss.as.connector.subsystems.datasources.Constants.NOTXSEPARATEPOOL;
 import static org.jboss.as.connector.subsystems.datasources.Constants.NO_RECOVERY;
 import static org.jboss.as.connector.subsystems.datasources.Constants.PAD_XID;
 import static org.jboss.as.connector.subsystems.datasources.Constants.PASSWORD;
 import static org.jboss.as.connector.subsystems.datasources.Constants.PREPAREDSTATEMENTSCACHESIZE;
 import static org.jboss.as.connector.subsystems.datasources.Constants.QUERYTIMEOUT;
 import static org.jboss.as.connector.subsystems.datasources.Constants.REAUTHPLUGIN_CLASSNAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.REAUTHPLUGIN_PROPERTIES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.RECOVERLUGIN_CLASSNAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.RECOVERLUGIN_PROPERTIES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.RECOVERY_PASSWORD;
 import static org.jboss.as.connector.subsystems.datasources.Constants.RECOVERY_SECURITY_DOMAIN;
 import static org.jboss.as.connector.subsystems.datasources.Constants.RECOVERY_USERNAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.SAME_RM_OVERRIDE;
 import static org.jboss.as.connector.subsystems.datasources.Constants.SECURITY_DOMAIN;
 import static org.jboss.as.connector.subsystems.datasources.Constants.SETTXQUERYTIMEOUT;
 import static org.jboss.as.connector.subsystems.datasources.Constants.SHAREPREPAREDSTATEMENTS;
 import static org.jboss.as.connector.subsystems.datasources.Constants.SPY;
 import static org.jboss.as.connector.subsystems.datasources.Constants.STALECONNECTIONCHECKERCLASSNAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.STALECONNECTIONCHECKER_PROPERTIES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.TRACKSTATEMENTS;
 import static org.jboss.as.connector.subsystems.datasources.Constants.TRANSACTION_ISOLATION;
 import static org.jboss.as.connector.subsystems.datasources.Constants.URL_DELIMITER;
 import static org.jboss.as.connector.subsystems.datasources.Constants.URL_SELECTOR_STRATEGY_CLASS_NAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.USERNAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.USETRYLOCK;
 import static org.jboss.as.connector.subsystems.datasources.Constants.USE_CCM;
 import static org.jboss.as.connector.subsystems.datasources.Constants.USE_JAVA_CONTEXT;
 import static org.jboss.as.connector.subsystems.datasources.Constants.VALIDATEONMATCH;
 import static org.jboss.as.connector.subsystems.datasources.Constants.VALIDCONNECTIONCHECKERCLASSNAME;
 import static org.jboss.as.connector.subsystems.datasources.Constants.VALIDCONNECTIONCHECKER_PROPERTIES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.WRAP_XA_RESOURCE;
 import static org.jboss.as.connector.subsystems.datasources.Constants.XADATASOURCECLASS;
 import static org.jboss.as.connector.subsystems.datasources.Constants.XADATASOURCE_PROPERTIES;
 import static org.jboss.as.connector.subsystems.datasources.Constants.XA_DATASOURCE;
 import static org.jboss.as.connector.subsystems.datasources.Constants.XA_RESOURCE_TIMEOUT;
 import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.ADD_CONNECTION_PROPERTIES_DESC;
 import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.ADD_DATA_SOURCE_DESC;
 import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.ADD_JDBC_DRIVER_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.ADD_XADATASOURCE_PROPERTIES_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.ADD_XA_DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.CONNECTION_PROPERTIES_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.DATASOURCE_ATTRIBUTE;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.DISABLE_DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.DISABLE_XA_DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.ENABLE_DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.ENABLE_XA_DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.FLUSH_ALL_CONNECTION_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.FLUSH_IDLE_CONNECTION_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.GET_INSTALLED_DRIVER_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.INSTALLED_DRIVERS_LIST_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.JDBC_DRIVER_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.REMOVE_CONNECTION_PROPERTIES_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.REMOVE_DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.REMOVE_JDBC_DRIVER_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.REMOVE_XADATASOURCE_PROPERTIES_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.REMOVE_XA_DATA_SOURCE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.SUBSYSTEM;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.SUBSYSTEM_ADD_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.SUBSYSTEM_REMOVE_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.TEST_CONNECTION_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.XADATASOURCE_PROPERTIES_DESC;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.XA_DATASOURCE_ATTRIBUTE;
import static org.jboss.as.connector.subsystems.datasources.DataSourcesSubsystemProviders.XA_DATA_SOURCE_DESC;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIBE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DISABLE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ENABLE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PERSISTENT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOVE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE;
import static org.jboss.as.controller.parsing.ParseUtils.requireNoContent;

Author(s):
Stefano Maestri
Darran Lofthouse
John Bailey
public class DataSourcesExtension implements Extension {
    public static final String SUBSYSTEM_NAME = .;
    @Override
    public void initialize(final ExtensionContext context) {
        .debugf("Initializing Datasources Extension");
        // Register the remoting subsystem
        final SubsystemRegistration registration = context.registerSubsystem();
        // Remoting subsystem description and operation handlers
        final ManagementResourceRegistration subsystem = registration.registerSubsystemModel();
        subsystem.registerOperationHandler("installed-drivers-list".,
                );
        subsystem.registerOperationHandler("get-installed-driver".,
                );
        final ManagementResourceRegistration jdbcDrivers = subsystem.registerSubModel(PathElement.pathElement(),
                );
        final ManagementResourceRegistration dataSources = subsystem.registerSubModel(PathElement.pathElement(),
                );
        dataSources.registerOperationHandler("flush-idle-connection-in-pool",
        dataSources.registerOperationHandler("flush-all-connection-in-pool",
        dataSources.registerOperationHandler("test-connection-in-pool"..,
                false);
        final ManagementResourceRegistration configAdapter = dataSources.registerSubModel(PathElement.pathElement(.getName()), );
            if (..contains(attribute.getName())) {
               dataSources.registerReadWriteAttribute(attribute.getName(), .,
            } else {
               dataSources.registerReadWriteAttribute(attribute.getName(), nullnew DisableRequiredWriteAttributeHandler() , .);
            }
        }
        final ManagementResourceRegistration xaDataSources = subsystem.registerSubModel(PathElement.pathElement(),
                );
        xaDataSources.registerOperationHandler("flush-idle-connection-in-pool",
        xaDataSources.registerOperationHandler("flush-all-connection-in-pool",
        xaDataSources.registerOperationHandler("test-connection-in-pool"..,
                false);
        final ManagementResourceRegistration xadatasourcePropertyAdapter = xaDataSources.registerSubModel(PathElement.pathElement(.getName()), );
        xadatasourcePropertyAdapter.registerOperationHandler(.false);
            if (..contains(attribute.getName())) {
               xaDataSources.registerReadWriteAttribute(attribute.getName(), .,
            } else {
               xaDataSources.registerReadWriteAttribute(attribute.getName(), nullnew DisableRequiredWriteAttributeHandler() , .);
            }
        }
    }
    @Override
    public void initializeParsers(final ExtensionParsingContext context) {
    }
    public static final class NewDataSourceSubsystemParser implements XMLStreamConstantsXMLElementReader<List<ModelNode>>,
        static final NewDataSourceSubsystemParser INSTANCE = new NewDataSourceSubsystemParser();

        
        @Override
        public void writeContent(XMLExtendedStreamWriter writerSubsystemMarshallingContext contextthrows XMLStreamException {
            context.startSubsystemElement(..getUriString(), false);
            ModelNode node = context.getModelNode();
            writer.writeStartElement();
            if (node.hasDefined() || node.hasDefined()) {
                boolean isXADataSource = false;
                if (node.hasDefined()) {
                    writeDS(writerfalsenode.get().asPropertyList());
                }
                if (node.hasDefined()) {
                    writeDS(writertruenode.get().asPropertyList());
                }
            }
            if (node.hasDefined()) {
                writer.writeStartElement(...getLocalName());
                for (Property driverProperty : node.get().asPropertyList()) {
                    writer.writeStartElement(...getLocalName());
                    writer.writeAttribute(...getLocalName(), driverProperty.getValue().require(.getName()).asString());
                    writeAttributeIfHas(writerdriverProperty.getValue(), ...getName());
                    writeAttributeIfHas(writerdriverProperty.getValue(), ...getName());
                    writeAttributeIfHas(writerdriverProperty.getValue(), ...getName());
                    writeElementIfHas(writerdriverProperty.getValue(), ...getLocalName(), .getName());
                    writeElementIfHas(writerdriverProperty.getValue(), ...getLocalName(), .getName());
                    writer.writeEndElement();
                }
                writer.writeEndElement();
            }
            writer.writeEndElement();
            writer.writeEndElement();
        }
        private void writeDS(XMLExtendedStreamWriter writerboolean isXADataSourceList<PropertypropertyListthrows XMLStreamException {
            for (Property property : propertyList) {
                final ModelNode dataSourceNode = property.getValue();
                writer.writeStartElement(isXADataSource ? ...getLocalName()
                        : ...getLocalName());
                .marshallAsAttribute(dataSourceNodewriter);
                writer.writeAttribute("pool-name"property.getName());
                .marshallAsAttribute(dataSourceNodewriter);
                .marshallAsAttribute(dataSourceNodewriter);
                .marshallAsAttribute(dataSourceNodewriter);
                .marshallAsAttribute(dataSourceNodewriter);
                .marshallAsAttribute(dataSourceNodewriter);
                if (!isXADataSource) {
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    if (dataSourceNode.hasDefined(.getName())) {
                        for (Property connectionProperty : dataSourceNode.get(.getName()).asPropertyList()) {
                            writeProperty(writerdataSourceNodeconnectionProperty.getName(), connectionProperty
                                    .getValue().get("value").asString(), ...getLocalName());
                        }
                    }
                }
                if (isXADataSource) {
                    if (dataSourceNode.hasDefined(.getName())) {
                        for (Property prop : dataSourceNode.get(.getName()).asPropertyList()) {
                            writeProperty(writerdataSourceNodeprop.getName(), prop
                                    .getValue().get("value").asString(), ...getLocalName());
                        }
                    }
                    .marshallAsElement(dataSourceNodewriter);
                }
                .marshallAsElement(dataSourceNodewriter);
                if (isXADataSource) {
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                }
                .marshallAsElement(dataSourceNodewriter);
                .marshallAsElement(dataSourceNodewriter);
                if (!isXADataSource) {
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                }
                boolean poolRequired = .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode);
                if (isXADataSource) {
                    poolRequired = poolRequired
                            || .isMarshallable(dataSourceNode) ||
                            .isMarshallable(dataSourceNode) ||
                            .isMarshallable(dataSourceNode) ||
                            .isMarshallable(dataSourceNode) ||
                            .isMarshallable(dataSourceNode);
                }
                if (poolRequired) {
                    writer.writeStartElement(isXADataSource ? ...getLocalName() : ..
                            .getLocalName());
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    if (isXADataSource) {
                        .marshallAsElement(dataSourceNodewriter);
                        .marshallAsElement(dataSourceNodewriter);
                        .marshallAsElement(dataSourceNodewriter);
                        .marshallAsElement(dataSourceNodewriter);
                        .marshallAsElement(dataSourceNodewriter);
                    }
                    writer.writeEndElement();
                }
                boolean securityRequired = .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode);
                if (securityRequired) {
                    writer.writeStartElement(...getLocalName());
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    if (dataSourceNode.hasDefined(.getName())) {
                        writer.writeStartElement(...getLocalName());
                        writer.writeAttribute(
                                ..........getLocalName(),
                                dataSourceNode.get(.getName()).asString());
                        if (dataSourceNode.hasDefined(.getName())) {
                            for (Property connectionProperty : dataSourceNode.get(.getName()).asPropertyList()) {
                                writeProperty(writerdataSourceNodeconnectionProperty.getName(), connectionProperty
                                        .getValue().asString(),
                                        .........
                                                .getLocalName());
                            }
                        }
                        writer.writeEndElement();
                    }
                    writer.writeEndElement();
                }
                boolean recoveryRequired = .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode);
                if (recoveryRequired && isXADataSource) {
                    writer.writeStartElement(...getLocalName());
                    .marshallAsAttribute(dataSourceNodewriter);
                    if (hasAnyOf(dataSourceNode)) {
                        writer.writeStartElement(...getLocalName());
                        .marshallAsElement(dataSourceNodewriter);
                        .marshallAsElement(dataSourceNodewriter);
                        .marshallAsElement(dataSourceNodewriter);
                        writer.writeEndElement();
                    }
                    if (hasAnyOf(dataSourceNode)) {
                        writer.writeStartElement(...getLocalName());
                        writer.writeAttribute(
                                ..........getLocalName(),
                                dataSourceNode.get(.getName()).asString());
                        if (dataSourceNode.hasDefined(.getName())) {
                            for (Property connectionProperty : dataSourceNode.get(.getName()).asPropertyList()) {
                                writeProperty(writerdataSourceNodeconnectionProperty.getName(), connectionProperty
                                        .getValue().asString(),
                                        .........
                                                .getLocalName());
                            }
                        }
                        writer.writeEndElement();
                    }
                    writer.writeEndElement();
                }
                boolean validationRequired = .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode);
                if (validationRequired) {
                    writer.writeStartElement(...getLocalName());
                    if (dataSourceNode.hasDefined(.getName())) {
                        writer.writeStartElement(...getLocalName());
                        writer.writeAttribute(
                                ..........getLocalName(),
                                dataSourceNode.get(.getName()).asString());
                        if (dataSourceNode.hasDefined(.getName())) {
                            for (Property connectionProperty : dataSourceNode.get(.getName())
                                    .asPropertyList()) {
                                writeProperty(writerdataSourceNodeconnectionProperty.getName(), connectionProperty
                                        .getValue().asString(),
                                        .........
                                                .getLocalName());
                            }
                        }
                        writer.writeEndElement();
                    }
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    if (dataSourceNode.hasDefined(.getName())) {
                        writer.writeStartElement(...getLocalName());
                        writer.writeAttribute(..........getLocalName(),
                                dataSourceNode.get(.getName()).asString());
                        if (dataSourceNode.hasDefined(.getName())) {
                            for (Property connectionProperty : dataSourceNode.get(.getName())
                                    .asPropertyList()) {
                                writeProperty(writerdataSourceNodeconnectionProperty.getName(), connectionProperty
                                        .getValue().asString(),
                                        .........
                                                .getLocalName());
                            }
                        }
                        writer.writeEndElement();
                    }
                    if (dataSourceNode.hasDefined(.getName())) {
                        writer.writeStartElement(...getLocalName());
                        writer.writeAttribute(
                                ..........getLocalName(),
                                dataSourceNode.get(.getName()).asString());
                        if (dataSourceNode.hasDefined(.getName())) {
                            for (Property connectionProperty : dataSourceNode.get(.getName())
                                    .asPropertyList()) {
                                writeProperty(writerdataSourceNodeconnectionProperty.getName(), connectionProperty
                                        .getValue().asString(),
                                        .........
                                                .getLocalName());
                            }
                        }
                        writer.writeEndElement();
                    }
                    writer.writeEndElement();
                }
                boolean timeoutRequired = .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode) ||
                        .isMarshallable(dataSourceNode);
                if (timeoutRequired) {
                    writer.writeStartElement(...getLocalName());
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    writer.writeEndElement();
                }
                boolean statementRequired = hasAnyOf(dataSourceNode);
                if (statementRequired) {
                    writer.writeStartElement(...getLocalName());
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    .marshallAsElement(dataSourceNodewriter);
                    writer.writeEndElement();
                }
                writer.writeEndElement();
            }
        }
        private void writeAttributeIfHas(final XMLExtendedStreamWriter writerfinal ModelNode node,
                                         final Recovery.Attribute attrfinal String identifierthrows XMLStreamException {
            if (has(nodeidentifier)) {
                writer.writeAttribute(attr.getLocalName(), node.get(identifier).asString());
            }
        }
        private void writeAttributeIfHas(final XMLExtendedStreamWriter writerfinal ModelNode node,
                                         final Driver.Attribute attrfinal String identifierthrows XMLStreamException {
            if (has(nodeidentifier)) {
                writer.writeAttribute(attr.getLocalName(), node.get(identifier).asString());
            }
        }
        private void writeAttributeIfHas(final XMLExtendedStreamWriter writerfinal ModelNode node,
                                         final DataSource.Attribute attrfinal String identifierthrows XMLStreamException {
            if (has(nodeidentifier)) {
                writer.writeAttribute(attr.getLocalName(), node.get(identifier).asString());
            }
        }
        private void writeProperty(XMLExtendedStreamWriter writerModelNode nodeString nameString valueString localName)
                throws XMLStreamException {
            writer.writeStartElement(localName);
            writer.writeAttribute("name"name);
            writer.writeCharacters(value);
            writer.writeEndElement();
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeString localNameString identifier)
                throws XMLStreamException {
            if (has(nodeidentifier)) {
                writer.writeStartElement(localName);
                writer.writeCharacters(node.get(identifier).asString());
                writer.writeEndElement();
            }
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeXaDataSource.Tag element,
                                       String identifierthrows XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeDataSource.Tag elementString identifier)
                throws XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeDsSecurity.Tag elementString identifier)
                throws XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeCommonPool.Tag elementString identifier)
                throws XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeCommonXaPool.Tag element,
                                       String identifierthrows XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeTimeOut.Tag elementString identifier)
                throws XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeValidation.Tag elementString identifier)
                throws XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeElementIfHas(XMLExtendedStreamWriter writerModelNode nodeStatement.Tag elementString identifier)
                throws XMLStreamException {
            writeElementIfHas(writernodeelement.getLocalName(), identifier);
        }
        private void writeEmptyElementIfHasAndTrue(XMLExtendedStreamWriter writerModelNode nodeString localName,
                                                   String identifierthrows XMLStreamException {
            if (node.has(identifier) && node.get(identifier).asBoolean()) {
                writer.writeEmptyElement(localName);
            }
        }
        private void writeEmptyElementIfHasAndTrue(XMLExtendedStreamWriter writerModelNode nodeStatement.Tag element,
                                                   String identifierthrows XMLStreamException {
            writeEmptyElementIfHasAndTrue(writernodeelement.getLocalName(), identifier);
        }
        private void writeEmptyElementIfHasAndTrue(XMLExtendedStreamWriter writerModelNode nodeCommonXaPool.Tag element,
                                                   String identifierthrows XMLStreamException {
            writeEmptyElementIfHasAndTrue(writernodeelement.getLocalName(), identifier);
        }
        private void writeEmptyElementIfHasAndTrue(XMLExtendedStreamWriter writerModelNode nodeTimeOut.Tag element,
                                                   String identifierthrows XMLStreamException {
            writeEmptyElementIfHasAndTrue(writernodeelement.getLocalName(), identifier);
        }
        private boolean hasAnyOf(ModelNode nodeSimpleAttributeDefinition... names) {
            for (SimpleAttributeDefinition current : names) {
                if (has(nodecurrent.getName())) {
                    return true;
                }
            }
            return false;
        }
        private boolean has(ModelNode nodeString name) {
            return node.has(name) && node.get(name).isDefined();
        }
        @Override
        public void readElement(final XMLExtendedStreamReader readerfinal List<ModelNodelistthrows XMLStreamException {
            final ModelNode address = new ModelNode();
            address.add(.);
            address.protect();
            final ModelNode subsystem = new ModelNode();
            subsystem.get().set();
            subsystem.get().set(address);
            list.add(subsystem);
            try {
                String localName = null;
                switch (Namespace.forUri(reader.getNamespaceURI())) {
                    case : {
                        localName = reader.getLocalName();
                        Element element = Element.forName(reader.getLocalName());
                        .tracef("%s -> %s"localNameelement);
                        switch (element) {
                            case : {
                                final DsParser parser = new DsParser();
                                parser.parse(readerlistaddress);
                                requireNoContent(reader);
                                break;
                            }
                        }
                    }
                }
            } catch (Exception e) {
                throw new XMLStreamException(e);
            }
        }
    }
    private static class DataSourcesSubsystemDescribeHandler implements OperationStepHandlerDescriptionProvider {
        public void execute(OperationContext contextModelNode operationthrows OperationFailedException {
            final ModelNode result = context.getResult();
            final PathAddress rootAddress = PathAddress.pathAddress(PathAddress.pathAddress(operation.require())
                    .getLastElement());
            final ModelNode subModel = context.readModel(.);
            final ModelNode subsystemAdd = new ModelNode();
            subsystemAdd.get().set();
            subsystemAdd.get().set(rootAddress.toModelNode());
            result.add(subsystemAdd);
            if (subModel.hasDefined()) {
                for (final Property jdbcDriver : subModel.get(.).asPropertyList()) {
                    final ModelNode address = rootAddress.toModelNode();
                    address.add(.jdbcDriver.getName());
                    final ModelNode addOperation = Util.getEmptyOperation(address);
                    addOperation.get(.getName()).set(jdbcDriver.getValue().get(.getName()));
                    addOperation.get(.getName()).set(jdbcDriver.getValue().get(.getName()));
                    addOperation.get(.getName()).set(jdbcDriver.getValue().get(.getName()));
                    addOperation.get(.getName()).set(jdbcDriver.getValue().get(.getName()));
                    addOperation.get(.getName()).set(jdbcDriver.getValue().get(.getName()));
                    addOperation.get(.getName()).set(
                            jdbcDriver.getValue().get(.getName()));
                    addOperation.get(.getName()).set(
                            jdbcDriver.getValue().get(.getName()));
                    result.add(addOperation);
                }
            }