<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2011, 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:jca:1.0"
           xmlns="urn:jboss:domain:jca:1.0"
           xmlns:threads="urn:jboss:domain:threads:1.0"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           version="1.0" xmlns:pref="urn:jboss:domain:threads:1.0">

    <xs:import namespace="urn:jboss:domain:threads:1.0" schemaLocation="jboss-as-threads_1_0.xsd"/>

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

    <xs:complexType name="subsystemType">
        <xs:all>
            <xs:element name="archive-validation"
                type="archive-validationType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Toggle archive validation for the deployment
                        units. If it's not present it's considered true
                        with default attributes.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>

            <xs:element name="bean-validation"
                type="bean-validationType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Toggle bean validation (JSR-303) for the
                        deployment units. If it's not present it's
                        considered true
                    </xs:documentation>
                </xs:annotation>
            </xs:element>

            <xs:element name="default-workmanager"
                type="default-workmanagerType" minOccurs="1">
                <xs:annotation>
                    <xs:documentation>
                        Configurations for thread pools used by default
                        workmanager
                    </xs:documentation>
                </xs:annotation>
            </xs:element>

            <xs:element name="cached-connection-manager" type="cached-connection-managerType" minOccurs="0" maxOccurs="1"></xs:element>
        </xs:all>
    </xs:complexType>

    <xs:complexType name="archive-validationType">
        <xs:attribute name="enabled" type="xs:boolean" default="true" use="optional">
            <xs:annotation>
                <xs:documentation>
                    Specify whether archive validation is enabled.  Default: true
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="fail-on-error" type="xs:boolean" default="true" use="optional">
            <xs:annotation>
                <xs:documentation>
                    Should an archive validation error report fail the deployment. Default: true
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="fail-on-warn" type="xs:boolean" default="false" use="optional">
            <xs:annotation>
                <xs:documentation>
                    Should an archive validation warning report fail the deployment. Default: false
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="bean-validationType">
        <xs:attribute name="enabled" type="xs:boolean" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specify whether bean validation is enabled.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="default-workmanagerType">
        <xs:all>
            <xs:element name="short-running-threads" type="thread-pool" maxOccurs="1" minOccurs="1"></xs:element>
            <xs:element name="long-running-threads" type="thread-pool" maxOccurs="1" minOccurs="0"></xs:element>
        </xs:all>
    </xs:complexType>

    <xs:complexType name="cached-connection-managerType">
        <xs:attribute name="debug" type="xs:boolean" use="optional"></xs:attribute>
        <xs:attribute name="error" type="xs:boolean" use="optional"></xs:attribute>
    </xs:complexType>

     <xs:complexType name="thread-pool">
        <xs:annotation>
            <xs:documentation>
            <![CDATA[
                See threads:bounded-queue-thread-pool.
            ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:all>
            <xs:element name="core-threads" type="threads:scaled-count" minOccurs="0"/>
            <xs:element name="queue-length" type="threads:scaled-count"/>
            <xs:element name="max-threads" type="threads:scaled-count"/>
            <xs:element name="keepalive-time" type="threads:time" minOccurs="0"/>
            <xs:element name="thread-factory" type="threads:ref" minOccurs="0"/>
            <xs:element name="handoff-executor" type="threads:ref" minOccurs="0"/>
            <xs:element name="properties" type="threads:properties" minOccurs="0"/>
        </xs:all>
        <xs:attribute name="allow-core-timeout" use="optional" type="xs:boolean"/>
        <xs:attribute name="blocking" use="optional" type="xs:boolean"/>
    </xs:complexType>
</xs:schema>