<?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:jacorb:1.0"
           xmlns="urn:jboss:domain:jacorb:1.0"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           version="1.0">

    <!-- The jacorb subsystem root element -->
    <xs:element name="subsystem" type="jacorbSubsystemType"/>

    <xs:complexType name="jacorbSubsystemType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The jacorbSubsystemType specifies the elements that can be used to configure the various aspects of the
                jacorb subsystem.

                - orb: holds the attributes used to configure the Object Request Broken (ORB).
                - poa: holds the attributes used to configure the Portable Object Adapters (POA).
                - interop: holds the attributes that control the ORB interoperability features.
                - security: holds the attributes that control the ORB security features.
                - property: allows for the specification of generic key/value properties.
                - initializers: holds the list of ORB initializers that are to be installed.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="orb" minOccurs="0" maxOccurs="1" type="orbConfigType"/>
            <xs:element name="poa" minOccurs="0" maxOccurs="1" type="poaConfigType"/>
            <xs:element name="interop" minOccurs="0" maxOccurs="1" type="interopConfigType"/>
            <xs:element name="security" minOccurs="0" maxOccurs="1" type="securityConfigType"/>
            <xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="genericPropertyType"/>
            <xs:element name="initializers" minOccurs="0" maxOccurs="1" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="orbConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                the orbConfigType specifies the elements and attributes that can be used to configure the behavior of the
                Object Request Broker (ORB).

                - connection: this element allows for the configuration of the connection properties.
                - naming: this element allows for the configuration of the naming initial reference.

                * name: the name of the running ORB.
                * print-version: indicates whether the version number should be printed during ORB startup (on) or not (off).
                * use-imr: indicates whether the implementation repository should be used (on) or not (off).
                * use-bom: indicates whether GIOP 1.2 byte order markers should be used (on) or not (off).
                * cache-typecodes: indicates whether typecodes should be cached (on) or not (off).
                * cache-poa-names: indicates whether POA names should be cached (on) or not (off).
                * giop-minor-version: the GIOP minor version to be used.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="connection" minOccurs="0" maxOccurs="1" type="orbConnectionConfigType"/>
            <xs:element name="naming" minOccurs="0" maxOccurs="1" type="orbNamingConfigType"/>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="optional" default="JBoss"/>
        <xs:attribute name="print-version" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="use-imr" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="use-bom" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="cache-typecodes" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="cache-poa-names" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="giop-minor-version" type="xs:integer" use="optional" default="2"/>
    </xs:complexType>

    <xs:complexType name="orbConnectionConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The orbConnectionConfigType specifies the attributes used to configure the ORB connections.

                * retries: the number of retries if connections cannot be promptly established.
                * retry-interval: the interval in milliseconds between retries.
                * client-timeout: the client-side connection timeout value in milliseconds. A value of zero indicates that
                                  the connection never times out.
                * server-timeout: the server-side connection timeout value in milliseconds. A value of zero indicates that
                                  the connection never times out.
                * max-server-connections: the maximum number of connections accepted by the server.
                * max-managed-buf-size: the log2 of maximum size managed by the internal buffer manager.
                * outbuf-size: the size of the network buffers for outgoing messages.
                * outbuf-cache-timeout: the buffer cache timeout in milliseconds.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="retries" type="xs:integer" use="optional" default="5"/>
        <xs:attribute name="retry-interval" type="xs:integer" use="optional" default="500"/>
        <xs:attribute name="client-timeout" type="xs:integer" use="optional" default="0"/>
        <xs:attribute name="server-timeout" type="xs:integer" use="optional" default="0"/>
        <xs:attribute name="max-server-connections" type="xs:integer" use="optional"/>
        <xs:attribute name="max-managed-buf-size" type="xs:integer" use="optional" default="24"/>
        <xs:attribute name="outbuf-size" type="xs:integer" use="optional" default="2048"/>
        <xs:attribute name="outbuf-cache-timeout" type="xs:integer" use="optional" default="-1"/>
    </xs:complexType>

    <xs:complexType name="orbNamingConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The orbNamingConfigType specifies the attributes used to configure the naming service.

                * root-context: the naming service root context.
                * export-corbaloc: indicates whether the root context should be exported as corbaloc::address:port/NameService
                                   (on) or not (off).
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="root-context" type="xs:string" use="optional" default="JBoss/Naming/root"/>
        <xs:attribute name="export-corbaloc" type="xs:string" use="optional" default="on"/>
    </xs:complexType>

    <xs:complexType name="poaConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The poaConfigType specifies the elements and attributes used to configure the Portable Object Adapterss (POA).

                - request-processors: element that allows for the configuration of the POA request processors.

                * monitoring: indicates whether the monitoring GUI should be displayed (on) or not (off).
                * queue-wait: indicates whether requests that exceed the maximum queue size should wait (on) or not (off).
                              When disabled, a TRANSIENT exception is thrown if the queue is full.
                * queue-min: the size of the queue for notifying waiting requests. In other words, blocked requests are
                             only notified when the queue has no more than queue-min requests.
                * queue-max: the maximum number of requests that can be queued. If new requests arrive and queue-wait is
                             on, the exceeding requests will be blocked until the queue reaches its minimum value.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:all>
            <xs:element name="request-processors" minOccurs="0" maxOccurs="1" type="poaRequestProcessorsConfigType"/>
        </xs:all>
        <xs:attribute name="monitoring" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="queue-wait" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="queue-min" type="xs:integer" use="optional" default="10"/>
        <xs:attribute name="queue-max" type="xs:integer" use="optional" default="100"/>
    </xs:complexType>

    <xs:complexType name="poaRequestProcessorsConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The poaRequestProcessorsConfigType specifies the attributes used to configure the POA request processors.

                * pool-size: the size of the request processors thread-pool. Threads that finish processing a request are
                             placed back in the pool if the pool is not full and discarded otherwise.
                * max-threads: the maximum number of active request processor threads. Threads are first obtained from
                               the pool and once the pool is exhausted new threads are created until the number of threads
                               reaches this limit. New requests will wait until an active thread finishes its job.
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="pool-size" type="xs:integer" use="optional" default="5"/>
        <xs:attribute name="max-threads" type="xs:integer" use="optional" default="20"/>
    </xs:complexType>

    <xs:complexType name="interopConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The interopConfigType specifies the attributes used to configure the ORB interoperability features.

                * sun: indicates whether interoperability with Sun's ORB is enabled (on) or not (off).
                * comet: indicates whether interoperability with Comet's ORB is enabled (on) or not (off).
                * chunk-custom-rmi-valuetypes: indicates whether custom RMI valuetypes should be encoded as chunks (on)
                                               or not (off).
                * lax-boolean-encoding: indicates whether any non-zero CDR encoded boolean value should be interpreted as
                                        true (on) or not (off).
                * indirection-encoding-disabled: indicates whether indirection encoding for repeated typecodes should be
                                                 enabled (on) or not (off).
                * strict-check-on-tc-creation: indicates whether the method create_abstract_interface_tc should perform
                                               a validation check on the name parameter (on) or not (off).
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="sun" type="xs:string" use="optional" default="on"/>
        <xs:attribute name="comet" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="chunk-custom-rmi-valuetypes" type="xs:string" use="optional" default="on"/>
        <xs:attribute name="lax-boolean-encoding" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="indirection-encoding-disable" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="strict-check-on-tc-creation" type="xs:string" use="optional" default="off"/>
    </xs:complexType>

    <xs:complexType name="securityConfigType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                The securityConfigType specifies the attributes used to configure the ORB security features.

                * support-ssl: indicates whether SSL is to be supported (on) or not (off).
                * add-component-via-interceptor: indicates whether SSL components should be added by an IOR interceptor
                                                 (on) or not (off).
                * client-supports: value that indicates the client SSL supported parameters (EstablishTrustInTarget=20,
                                   EstablishTrustInClient=40, MutualAuth=60).
                * client-requires: value that indicates the client SSL required parameters (EstablishTrustInTarget=20,
                                   EstablishTrustInClient=40, MutualAuth=60).
                * server-supports: value that indicates the server SSL supported parameters (EstablishTrustInTarget=20,
                                   EstablishTrustInClient=40, MutualAuth=60).
                * server-requires: value that indicates the server SSL required parameters (EstablishTrustInTarget=20,
                                   EstablishTrustInClient=40, MutualAuth=60).
                * use-domain-socket-factory: indicates whether the JBoss domain socket factory should be used (on) or
                                             not (off).
                * use-domain-server-socket-factory: indicates whether the JBoss domain server socket factory should be
                                                    used (on) or not (off).
                        ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="support-ssl" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="add-component-via-interceptor" type="xs:string" use="optional" default="on"/>
        <xs:attribute name="client-supports" type="xs:integer" use="optional" default="60"/>
        <xs:attribute name="client-requires" type="xs:integer" use="optional" default="0"/>
        <xs:attribute name="server-supports" type="xs:integer" use="optional" default="60"/>
        <xs:attribute name="server-requires" type="xs:integer" use="optional" default="0"/>
        <xs:attribute name="use-domain-socket-factory" type="xs:string" use="optional" default="off"/>
        <xs:attribute name="use-domain-server-socket-factory" type="xs:string" use="optional" default="off"/>
    </xs:complexType>

    <xs:complexType name="genericPropertyType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
               The property element allows for the specification of generic key/value properties. It is useful to specify
               attributes that have not been covered in this schema.
             ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="key" type="xs:string" use="required"/>
        <xs:attribute name="value" type="xs:string" use="required"/>
    </xs:complexType>

</xs:schema>
