<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2017, 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.
  -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="urn:jboss:domain:datasources:5.0" xmlns="urn:jboss:domain:datasources:5.0"
           xmlns:credential-reference="urn:wildfly:credential-reference:1.0"
           elementFormDefault="qualified" attributeFormDefault="unqualified">

  <xs:import namespace="urn:wildfly:credential-reference:1.0" schemaLocation="wildfly-credential-reference_1_0.xsd"/>

  <xs:element name="subsystem" type="subsystemType"/>

  <xs:complexType name="subsystemType">
    <xs:all>
      <xs:element name="datasources" type="datasourcesType" minOccurs="1" maxOccurs="1"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="datasourcesType">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="datasource" type="datasourceType">
          <xs:annotation>
            <xs:documentation>
              <![CDATA[[
                Specifies a non-XA datasource, using local transactions
               ]]>
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element name="xa-datasource" type="xa-datasourceType">
          <xs:annotation>
            <xs:documentation>
              <![CDATA[[
                Specifies a XA datasource
                ]]>
            </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:choice>
      <xs:element name="drivers" type="driversType" maxOccurs="1" minOccurs="0"></xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="datasourceType" mixed="false">
    <xs:sequence>
      <xs:element name="connection-url" type="xs:token">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The JDBC driver connection URL Ex: <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="driver-class" type="xs:token" maxOccurs="1" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The fully qualifed name of the JDBC driver class Ex: <driver-class>org.hsqldb.jdbcDriver</driver-class>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="datasource-class" type="xs:token" maxOccurs="1" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The fully qualifed name of the JDBC datasource class Ex: <datasource-class>org.h2.jdbcx.JdbcDataSource</datasource-class>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="driver" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              An unique reference to the classloader module which contains the JDBC driver
              The accepted format is driverName#majorVersion.minorVersion
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="connection-property" type="connection-propertyType" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The connection-property element allows you to pass in arbitrary connection
              properties to the Driver.connect(url, props) method. Each connection-property
              specifies a string name/value pair with the property name coming from the
              name attribute and the value coming from the element content. Ex:
              <connection-property name="char.encoding">UTF-8</connection-property>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="new-connection-sql" type="xs:string" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specify an SQL statement to execute whenever a connection is added
              to the connection pool.
              ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="transaction-isolation" type="transaction-isolationType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Set java.sql.Connection transaction isolation level to use. The constants
              defined by transaction-isolation-values are the possible transaction isolation
              levels and include: TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED
              TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE TRANSACTION_NONE
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="url-delimiter" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the delimeter for URLs in connection-url for HA datasources
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="url-property" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
                     Specifies the property for the URL property in the xa-datasource-property values
                    ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="url-selector-strategy-class-name" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              A class that implements org.jboss.jca.adapters.jdbc.URLSelectorStrategy
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="pool" type="poolType" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the pooling settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="security" type="dsSecurityType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the security settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="validation" type="validationType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the validation settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="timeout" type="timeoutType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the time out settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="statement" type="statementType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the statement settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="jta" type="xs:boolean" default="true" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Enable JTA integration
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attributeGroup ref="common-datasourceAttributes" />
  </xs:complexType>
  <xs:complexType name="xa-datasourceType">
    <xs:sequence>
      <xs:element name="xa-datasource-property" type="xa-datasource-propertyType" minOccurs="1" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies a property to assign to the XADataSource implementation class.
              Each property is identified by the name attribute and the property value
              is given by the xa-datasource-property element content. The property is mapped
              onto the XADataSource implementation by looking for a JavaBeans style getter
              method for the property name. If found, the value of the property is set
              using the JavaBeans setter with the element text translated to the true property
              type using the java.beans.PropertyEditor for the type. Ex:
              <xa-datasource-property name="IfxWAITTIME">10</xa-datasource-property>
              <xa-datasource-property name="IfxIFXHOST">myhost.mydomain.com</xa-datasource-property>
              <xa-datasource-property name="PortNumber">1557</xa-datasource-property>
              <xa-datasource-property name="DatabaseName">mydb</xa-datasource-property>
              <xa-datasource-property name="ServerName">myserver</xa-datasource-property>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="xa-datasource-class" type="xs:token" maxOccurs="1" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The fully qualifed name of the javax.sql.XADataSource implementation
              class. Ex: <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="driver" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              An unique reference to the classloader module which contains the JDBC driver
              The accepted format is driverName#majorVersion.minorVersion
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="url-delimiter" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
               Specifies the delimeter for URLs in the connection url for HA datasources
              ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="url-selector-strategy-class-name" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
               A class that implements org.jboss.jca.adapters.jdbc.URLSelectorStrategy
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="new-connection-sql" type="xs:string" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
               Specifies an SQL statement to execute whenever a connection is added
               to the connection pool.
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="transaction-isolation" type="transaction-isolationType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Set java.sql.Connection transaction isolation level to use. The constants
              defined by transaction-isolation-values are the possible transaction isolation
              levels and include: TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED
              TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE TRANSACTION_NONE
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="xa-pool" type="xa-poolType" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the pooling settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="security" type="dsSecurityType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the security settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="validation" type="validationType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the validation settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="timeout" type="timeoutType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the time out settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="statement" type="statementType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the statement settings
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="recovery" type="recoverType" minOccurs="0" maxOccurs="1"></xs:element>
    </xs:sequence>
    <xs:attributeGroup ref="common-datasourceAttributes" />
  </xs:complexType>
  <xs:complexType name="boolean-presenceType" />
  <xs:attributeGroup name="common-datasourceAttributes">
    <xs:attribute name="jndi-name" type="xs:token" use="required">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specifies the JNDI name for the datasource
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="pool-name" type="xs:token" use="required">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specifies the pool name for the datasource used for management
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="enabled" type="xs:boolean" default="true" form="unqualified" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specifies if the datasource should be enabled
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="true" name="use-java-context" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Setting this to false will bind the DataSource into global JNDI
            Ex: use-java-context="true"
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="false" name="spy" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Enable spy functionality on the JDBC layer - e.g. log all JDBC traffic to the datasource.
            Remember to enable the logging category (org.jboss.jdbc) too.
            Ex: spy="true"
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="true" name="use-ccm" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Enable the use of a cached connection manager
            Ex: use-ccm="true"
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="false" name="connectable" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
            <![CDATA[[
                  Enable cmr functionality on this datsource's connections
                 ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="tracking" type="xs:boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Defines if IronJacamar should track connection handles across transaction boundaries
          ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute default="false" name="statistics-enabled" type="xs:boolean">
      <xs:annotation>
        <xs:documentation>
            <![CDATA[[
                  Enable statistics for this datasource
                 ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="mcp" type="xs:token" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Defines the ManagedConnectionPool implementation, f.ex. org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="enlistment-trace" type="xs:boolean" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Defines if WildFly/IronJacamar should record enlistment traces
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:simpleType name="transaction-isolationType">
    <xs:annotation>
      <xs:documentation>
        <![CDATA[[
          Define constants used as the possible transaction isolation levels in transaction-isolation
          type. Include: TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ,
          TRANSACTION_SERIALIZABLE, TRANSACTION_NONE
         ]]>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="TRANSACTION_READ_UNCOMMITTED" />
      <xs:enumeration value="TRANSACTION_READ_COMMITTED" />
      <xs:enumeration value="TRANSACTION_REPEATABLE_READ" />
      <xs:enumeration value="TRANSACTION_SERIALIZABLE" />
      <xs:enumeration value="TRANSACTION_NONE" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="xa-datasource-propertyType" mixed="true">
    <xs:attribute name="name" use="required" type="xs:token" />
  </xs:complexType>
  <xs:complexType name="connection-propertyType" mixed="true">
    <xs:attribute name="name" use="required" type="xs:token" />
  </xs:complexType>
  <xs:complexType name="validationType">
    <xs:sequence>
      <xs:element name="valid-connection-checker" type="extensionType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              An org.jboss.jca.adapters.jdbc.ValidConnectionChecker that provides
              a SQLException isValidConnection(Connection e) method to validate is a connection
              is valid. An exception means the connection is destroyed. This overrides
              the check-valid-connection-sql when present. Ex:
              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.vendor.OracleValidConnectionChecker"/>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>

      <xs:element name="check-valid-connection-sql" type="xs:string" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specify an SQL statement to check validity of a pool connection. This
              may be called when managed connection is taken from pool for use.
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="validate-on-match" type="xs:boolean" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The validate-on-match element indicates whether or not connection
              level validation should be done when a connection factory attempts to match
              a managed connection for a given set. This is typically exclusive to the
              use of background validation
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="background-validation" type="xs:boolean" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              An element to specify that connections should be validated on a background
              thread versus being validated prior to use
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="background-validation-millis" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The background-validation-millis element specifies the amount of
              time, in millis, that background validation will run.
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="use-fast-fail" type="xs:boolean" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Whether fail a connection allocation on the first connection if it
              is invalid (true) or keep trying until the pool is exhausted of all potential
              connections (false) default false. e.g. <use-fast-fail>true</use-fast-fail>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="stale-connection-checker" type="extensionType">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              An org.jboss.jca.adapters.jdbc.StaleConnectionChecker that provides
              a boolean isStaleConnection(SQLException e) method which if it it returns
              true will wrap the exception in an org.jboss.jca.adapters.jdbc.StaleConnectionException
              which is a subclass of SQLException. Ex:
              <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.vendor.OracleStaleConnectionChecker"/>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="exception-sorter" type="extensionType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              An org.jboss.jca.adapters.jdbc.ExceptionSorter that provides a
              boolean isExceptionFatal(SQLException e) method to validate is an exception
              should be broadcast to all javax.resource.spi.ConnectionEventListener as
              a connectionErrorOccurred message. Ex:
              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.vendor.OracleExceptionSorter"/>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="timeoutType">
    <xs:sequence>
      <xs:element name="blocking-timeout-millis" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The blocking-timeout-millis element indicates the maximum time in
              milliseconds to block while waiting for a connection before throwing an exception.
              Note that this blocks only while waiting for a permit for a connection, and
              will never throw an exception if creating a new connection takes an inordinately
              long time. The default is 30000 (30 seconds).
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="idle-timeout-minutes" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The idle-timeout-minutes elements indicates the maximum time in minutes
              a connection may be idle before being closed. The actual maximum time depends
              also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes
              of any pool.
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="set-tx-query-timeout" type="boolean-presenceType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Whether to set the query timeout based on the time remaining until
              transaction timeout, any configured query timeout will be used if there is
              no transaction. The default is false. e.g. <set-tx-query-timeout/>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="query-timeout" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Any configured query timeout in seconds The default is no timeout
              e.g. 5 minutes <query-timeout>300</query-timeout>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="use-try-lock" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Any configured timeout for internal locks on the resource adapter
              objects in seconds The default is a 60 second timeout e.g. 5 minutes <use-try-lock>300</use-try-lock>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="allocation-retry" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The allocation retry element indicates the number of times that allocating
              a connection should be tried before throwing an exception. The default is 0.
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="allocation-retry-wait-millis" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The allocation retry wait millis element indicates the time in milliseconds
              to wait between retrying to allocate a connection. The default is 5000 (5 seconds).
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="xa-resource-timeout" type="xs:token" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Passed to XAResource.setTransactionTimeout() Default is zero which
              does not invoke the setter. In seconds e.g. 5 minutes <xa-resource-timeout>300</xa-resource-timeout>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="track-statementsType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="true" />
      <xs:enumeration value="false" />
      <xs:enumeration value="nowarn" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="statementType">
    <xs:sequence>
      <xs:element name="track-statements" type="track-statementsType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Whether to check for unclosed statements when a connection is returned
              to the pool and result sets are closed when a statement is closed/return
              to the prepared statement cache. valid values are: false - do not track statements
              and results true - track statements and result sets and warn when they are
              not closed nowarn - track statements but do no warn about them being unclosed
              (the default) e.g. <track-statements>nowarn</track-statements>
            ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="prepared-statement-cache-size" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The number of prepared statements per connection in an LRU cache
            ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="share-prepared-statements" type="boolean-presenceType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Whether to share prepare statements, i.e. whether asking for same
              statement twice without closing uses the same underlying prepared statement.
              The default is false. e.g. <share-prepared-statements/>
            ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="poolType">
    <xs:sequence>
      <xs:element name="min-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The min-pool-size element indicates the minimum number of connections
              a pool should hold. These are not created until a Subject is known from a
              request for a connection. This default to 0. Ex: <min-pool-size>1</min-pool-size>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="initial-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
                    The initial-pool-size element indicates the initial number of connections
                    a pool should hold. This default to 0. Ex: <initial-pool-size>1</initial-pool-size>
                   ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="max-pool-size" type="xs:nonNegativeInteger" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The max-pool-size element indicates the maximum number of connections
              for a pool. No more connections will be created in each sub-pool.
              This defaults to 20.
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="prefill" type="xs:boolean" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Whether to attempt to prefill the connection pool. Empty element denotes
              a true value. e.g. <prefill>true</prefill>.
              Default is false
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="fair" type="xs:boolean" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Defines if pool use should be fair
              Default true
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="use-strict-min" type="xs:boolean" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Define if the min-pool-size should be considered a strictly.
              Default false
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="flush-strategy" type="xs:token" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies how the pool should be flush in case of an error.
              Valid values are: FailingConnectionOnly (default), InvalidIdleConnections, IdleConnections, Gracefully, EntirePool,
              AllInvalidIdleConnections, AllIdleConnections, AllGracefully, AllConnections
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="allow-multiple-users" type="boolean-presenceType" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies if multiple users will access the datasource through the getConnection(user, password)
              method and hence if the internal pool type should account for that
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="capacity" type="capacityType" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
                    Specifies the capacity policies for the pool
                   ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="connection-listener" type="extensionType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
                    An org.jboss.jca.adapters.jdbc.spi.listener.ConnectionListener that provides
                    a possible to listen for connection activation and passivation in order to
                    perform actions before the connection is returned to the application or returned
                    to the pool. Ex:
                    <connection-listener class-name="com.acme.jdbc.OracleConnectionListener"/>
                   ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="xa-poolType">
    <xs:complexContent>
      <xs:extension base="poolType">
        <xs:sequence>
          <xs:element name="is-same-rm-override" type="xs:boolean" minOccurs="0">
            <xs:annotation>
              <xs:documentation>
                <![CDATA[[
                  The is-same-rm-override element allows one to unconditionally
                  set whether the javax.transaction.xa.XAResource.isSameRM(XAResource) returns
                  true or false. Ex: <is-same-rm-override>true</is-same-rm-override>
                 ]]>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="interleaving" type="boolean-presenceType" minOccurs="0">
            <xs:annotation>
              <xs:documentation>
                <![CDATA[[
                  An element to enable interleaving for XA connection factories
                  Ex: <interleaving/>
                 ]]>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="no-tx-separate-pools" type="boolean-presenceType" minOccurs="0">
            <xs:annotation>
              <xs:documentation>
                <![CDATA[[
                  Oracle does not like XA connections getting used both inside and outside a JTA transaction.
                  To workaround the problem you can create separate sub-pools for the different contexts
                  using <no-tx-separate-pools/>
                  Ex: <no-tx-separate-pools/>
                 ]]>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="pad-xid" type="xs:boolean" default="false" minOccurs="0">
            <xs:annotation>
              <xs:documentation>
                <![CDATA[[
                   Should the Xid be padded
                   Ex: <pad-xid>true</pad-xid>
                 ]]>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="wrap-xa-resource" type="xs:boolean" default="true" minOccurs="0">
            <xs:annotation>
              <xs:documentation>
                <![CDATA[[
                   Should the XAResource instances be wrapped in an org.jboss.tm.XAResourceWrapper
                   instance
                   Ex: <wrap-xa-resource>true</wrap-xa-resource>
                 ]]>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="dsSecurityType">
      <xs:sequence>
        <xs:choice>
          <xs:sequence>
            <xs:element name="user-name" type="xs:token" minOccurs="0">
              <xs:annotation>
                <xs:documentation>
                  <![CDATA[[
                    Specify the username used when creating a new connection.
                            Ex: <user-name>sa</user-name>
                  ]]>
                </xs:documentation>
              </xs:annotation>
            </xs:element>
            <xs:element name="password" type="xs:token" minOccurs="0">
              <xs:annotation>
                <xs:documentation>
                  <![CDATA[[
                    Specify the password used when creating a new connection.
                    Ex: <password>sa-pass</password>
                  ]]>
                </xs:documentation>
              </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:element name="credential-reference" type="credential-reference:credentialReferenceType" minOccurs="0">
            <xs:annotation>
              <xs:documentation>
                Credential to be used by the configuration.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
        <xs:element name="security-domain" type="xs:token" minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>
              <![CDATA[[
                Indicates Subject (from security domain) are used to distinguish connections in the pool.
                The content of the security-domain is the name of the JAAS security manager that will handle
                authentication. This name correlates to the JAAS login-config.xml descriptor
                application-policy/name attribute.
                Ex:
                <security-domain>HsqlDbRealm</security-domain>
              ]]>
            </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:sequence minOccurs="0">
          <xs:element name="elytron-enabled" type="boolean-presenceType">
            <xs:annotation>
              <xs:documentation>
                <![CDATA[[
                Indicates that Elytron is responsible for authenticating connections. If authentication-context
                is configured (via authentication-context), Elytron will use the specified context
                for authenticating. Else, Elytron will use the current authentication context of the caller that
                is retrieving the connection.
                Ex:
                  <elytron-enabled/>
                ]]>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="authentication-context" type="xs:token" minOccurs="0">
            <xs:annotation>
              <xs:documentation>
                <![CDATA[[
                Indicates the Elytron context that will be used for authenticating connections during
                container-managed sign-on.
                The resulting Subject will be used to distinguish connections in the pool.
                The authentication-context name correlates to the authentication context defined in
                the Elytron subsystem.
                Ex:
                  <elytron-enabled/>
                  <authentication-context>HsqlDbContext</authentication-context>
                ]]>
              </xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:choice>
      <xs:element name="reauth-plugin" type="extensionType" minOccurs="0" maxOccurs="1"></xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="extensionType">
    <xs:sequence>
      <xs:element name="config-property" type="config-propertyType" minOccurs="0" maxOccurs="unbounded"></xs:element>
    </xs:sequence>
    <xs:attribute name="class-name" type="xs:token" use="required"></xs:attribute>
  </xs:complexType>

  <xs:complexType name="config-propertyType" mixed="true">
    <xs:annotation>
      <xs:documentation>
        <![CDATA[[
          Specifies a Java bean property value
         ]]>
      </xs:documentation>
    </xs:annotation>
    <xs:simpleContent>
      <xs:extension base="xs:token">
        <xs:attribute use="required" name="name" type="xs:token">
          <xs:annotation>
            <xs:documentation>
              <![CDATA[[
                Specifies the name of the config-property
               ]]>
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="recoverType">
    <xs:sequence>
      <xs:element name="recover-credential" type="dsSecurityType" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the security options used when creating a connection during recovery.
              Note: if this credential are not specified the security credential are used for recover too
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="recover-plugin" type="extensionType" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              Specifies the extension plugin used in spi (core.spi.xa)
              which can be implemented by various plugins to provide better feedback to the XA recovery system.
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="no-recovery" type="xs:boolean" default="false" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specify if the xa-datasource should be excluded from recovery.
            Default false.
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="driverType">
    <xs:sequence>
      <xs:element name="driver-class" type="xs:token" maxOccurs="1" minOccurs="0">
      <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The fully qualifed name of the JDBC driver class Ex: <driver-class>org.hsqldb.jdbcDriver</driver-class>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="xa-datasource-class" type="xs:token" maxOccurs="1" minOccurs="0">
      <xs:annotation>
          <xs:documentation>
           <![CDATA[[
              The fully qualifed name of the javax.sql.XADataSource implementation
              class. Ex: <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
             ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="datasource-class" type="xs:token" maxOccurs="1" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
              The fully qualifed name of the javax.sql.DataSource implementation
              class.
             ]]>
          </xs:documentation>
        </xs:annotation></xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:token" use="required">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specifies the symbolic name of this driver used to reference this driver
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="module" type="xs:token" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specifies the name of AS7 module providing this driver.
            This tag is not used in IronJacamar standalone container.
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="major-version" type="xs:int" use="optional">
      <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specifies the major version of this driver. If the major and minor versions are omitted the first available
            Driver in module will be used.
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
    <xs:attribute name="minor-version" type="xs:int" use="optional">
    <xs:annotation>
        <xs:documentation>
          <![CDATA[[
            Specifies the minor version of this driver. If the major and minor versions are omitted the first available
            Driver in module will be used.
           ]]>
        </xs:documentation>
      </xs:annotation>
    </xs:attribute>
  </xs:complexType>

  <xs:complexType name="driversType">
    <xs:sequence>
      <xs:element name="driver" type="driverType" maxOccurs="unbounded" minOccurs="1"></xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="capacityType">
    <xs:sequence>
      <xs:element name="incrementer" type="extensionType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
                Defines the policy for incrementing connections in the pool
               ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="decrementer" type="extensionType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>
            <![CDATA[[
                Defines the policy for decrementing connections in the pool
               ]]>
          </xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

</xs:schema>
