<?xml version="1.0" encoding="UTF-8"?>

<!--
~ JBoss, Home of Professional Open Source
~ Copyright 2016, Red Hat, Inc., and individual contributors as indicated
~ by the @authors tag.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="urn:jboss:domain:core-management:1.0"
           xmlns="urn:jboss:domain:core-management:1.0"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           version="1.0">

    <!-- The core-management subsystem root element -->
    <xs:element name="subsystem">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="configuration-changes" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Configuration for the history of configuration changes.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="max-history" type="xs:integer" use="optional" default="10">
                            <xs:annotation>
                                <xs:documentation>
                                    Number of configuration changes that are available in history.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="process-state-listener" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            Configuration for a process state listener.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="properties" minOccurs="0" type="properties">
                                <xs:annotation>
                                    <xs:documentation>
                                        Configuration properties for the process state listener.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="name" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    Name of the process state listener.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="class" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    ControlledProcessStateListener class implementation.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="module" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    Module where the ControlledProcessStateListener implementation class may be found.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                        <xs:attribute name="timeout" type="xs:int" use="optional" default="30">
                            <xs:annotation>
                                <xs:documentation>
                                    Timeout used in seconds, for listener operations.
                                    If an individual listener operation takes longer than this timeout it will be canceled.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="properties">
        <xs:sequence>
            <xs:element name="property" type="propertyType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="propertyType">
        <xs:attribute name="name" use="required"/>
        <xs:attribute name="value" use="optional"/>
    </xs:complexType>

</xs:schema>