<?xml version="1.0" encoding="UTF-8"?>
<!--
   (c) Copyright, Real-Time Innovations, Inc. 2001.  All rights reserved.
   No duplications, whole or partial, manual or electronic, may be made
   without prior written permission.  Any such copies, or
   revisions thereof, must display this notice unaltered.
   This code contains trade secrets of Real-Time Innovations, Inc.
-->

<!-- ================================================================== -->
<!-- RTI Routing Service configuration XML Schema                       -->
<!-- ================================================================== -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified">

    <xs:include schemaLocation="definitions/rti_service_common_definitions.xsd"/>

    <!-- ================================================================== -->
    <!-- Routes'common                                                      -->
    <!-- ================================================================== -->

    <xs:simpleType name="topicQueryProxyMode">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Indicates how the TopicRoute handles the TopicQueries received
                from the user DataReaders on the subscription side.
                Default: PROPAGATION.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="DISPATCH">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        The TopicRoute's DataWriter is automatically configured
                        with TRANSIENT_LOCAL durability and accepts matching
                        TopicQueries and dispatches them from its own sample
                        cache.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="PROPAGATION">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        The TopicQueries are propagated from the user DataReaders
                        to the user DataWriters, which will be the final
                        endpoints dispatching the propagated TopicQueries.
                        When topic query propagation is enabled, this is the
                        default behavior.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="topicQueryProxy">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Specify the settings for the stream query proxy mode.
                When enabled, supported routes will forward stream queries
                from the user output stream readers to the user input stream
                writers.

                The samples produced as result of the propagated stream queries
                will be forwarded back to the original user output stream
                readers that issued the stream queries.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:all>
            <xs:element name="enabled" type="xs:boolean" minOccurs="0"/>
            <xs:element name="mode" type="topicQueryProxyMode" minOccurs="0"/>
        </xs:all>
    </xs:complexType>


    <xs:simpleType name="creationMode">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Controls when the route input (StreamReader) or output
                (StreamWriter) is created ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="IMMEDIATE">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        The route StreamReader/StreamWriter is created as
                        soon as possible; that is, as soon as the types are
                        available.

                        Note that if the type is defined in the configuration
                        file, the creation will occur when the routing service
                        starts.

                        If the type is not defined in the configuration file,
                        it has to be discovered
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ON_DOMAIN_MATCH">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[The route StreamReader is not created until
                        the associated connection discovers a data Producer on
                        the same stream.

                        For example, for a DDS domain, RTI Routing Service will
                        not create the route DataReader until a DataWriter for
                        the same topic is discovered on the same domain.

                        The routing service StreamWriter is not created until the
                        associated connection discovers a data Consumer on the
                        same stream.

                        For example, for a DDS domain, RTI Routing Service will
                        not create the route DataWriter until a DataReader for
                        the same topic is discover on the same domain.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ON_ROUTE_MATCH">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        The routing service StreamReader/StreamWriter is not
                        created until its counterpart in the route is created.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ON_DOMAIN_OR_ROUTE_MATCH">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        At least one of the conditions must be true.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ON_DOMAIN_AND_ROUTE_MATCH">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Both of the conditions must be true.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="filterPropagation">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Enables the propagation of filter information that is an aggregation
                of the user DataReaders' filters.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:all>
            <xs:element name="enabled"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="max_event_count"
                        type="positiveIntegerUnlimited"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Maximum number of events that must occur to propagate
                        the filter information. All the events are handled at once.
                        Range: [1, DDS_LENGTH_UNLIMITED]
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="max_event_delay"
                        type="duration"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Maximum amount of time the propagation of the filter information
                        is delayed since the first occurrence of an event.
                        All the indication events that occur within this interval
                        will be handle at once.
                        Default: infinite
                        Range: [1ns, DDS_DURATION_INFINITE]
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:all>
    </xs:complexType>


    <xs:complexType name="inputContentFilter">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines a SQL content filter topic for the DDS Data Rader,
                making possible to subscribe only to a subset of the
                data.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="expression"
                        type="xs:string"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation xml:lang="en-US">
                        <![CDATA[
                        A logical expression on the contents of the Topic. If the
                        expression evaluates to TRUE, a sample is received;
                        otherwise it is discarded. The possible values of this
                        element depends on the filter plugin implementation.
                        For example, for the builtin SQL filter: x &gt; 100
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:choice>
                <xs:element name="parameter"
                            type="xs:string"
                            minOccurs="0"
                            maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation>
                        <![CDATA[
                        This is a deprecated element and will be removed in
                        future versions. Use <parameter_list> instead.
                        ]]>
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="expression_parameters"
                            type="parameterList"
                            minOccurs="0">
                    <xs:annotation>
                        <xs:documentation xml:lang="en-US">
                        <![CDATA[
                        A string sequence of filter expression parameters. Each
                        parameter corresponds to a positional argument in the filter
                        expression: element 0 corresponds to positional argument 0,
                        element 1 to positional argument 1, and so forth
                        ]]>
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:choice>

        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="periodicAction">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Specifies a period at which the installed Processor will receive
                notifications of the periodic event.
                The Session will wake up and notify the installed Processor every
                specified period.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="duration"/>
        </xs:complexContent>
    </xs:complexType>


    <!-- ================================================================== -->
    <!-- AutoTopicRoute and AutoRoute                                       -->
    <!-- ================================================================== -->

    <xs:complexType name="routeProcessor">
        <xs:all>
            <xs:element name ="property" type="property" minOccurs="0"/>
        </xs:all>

        <xs:attribute name="plugin_name"
                      type="xs:string">
            <xs:annotation>
                <xs:documentation>
                    <![CDATA[
                    Reference to the Processor plugin in the form
                    LibraryName::PluginName
                    ]]>
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:group name="autoRoutePortGroup">
        <xs:all>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="allow_stream_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="allow_registered_type_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="deny_stream_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="deny_registered_type_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="creation_mode"
                        type="creationMode"
                        minOccurs="0"/>
            <xs:element name="property"
                        type="property"
                        minOccurs="0"/>
        </xs:all>
    </xs:group>

    <xs:complexType name="autoRouteStreamPort">
        <xs:group ref="autoRoutePortGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="connection" type="xs:string"/>
    </xs:complexType>

    <xs:group name="autoTopicRouteInputGroup">
        <xs:all>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="allow_topic_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="allow_registered_type_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="deny_topic_name_filter"
                        type="nameFilterList"
                        minOccurs="0" />
            <xs:element name="deny_registered_type_name_filter"
                        type="nameFilterList"
                        minOccurs="0" />
            <xs:element name="creation_mode"
                        type="creationMode"
                        minOccurs="0" />
            <xs:element name="datareader_qos"
                        type="dataReaderQos"
                        minOccurs="0" />
            <xs:element name="content_filter"
                        type="inputContentFilter"
                        minOccurs="0" />
            <xs:element name="auto_configure_qos"
                        type="xs:boolean"
                        minOccurs="0" />
        </xs:all>
    </xs:group>

    <xs:complexType name="autoTopicRouteInput">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                This element is used to configure which data types and topics
                are discovered in the output
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:group ref="autoTopicRouteInputGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="participant" type="elementReference"/>
    </xs:complexType>


    <xs:group name="autoTopicRouteOutputGroup">
        <xs:all>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="allow_topic_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="allow_registered_type_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="deny_topic_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="deny_registered_type_name_filter"
                        type="nameFilterList"
                        minOccurs="0"/>
            <xs:element name="creation_mode"
                        type="creationMode"
                        minOccurs="0"/>
            <xs:element name="on_delete_wait_for_ack_timeout"
                        type="duration"
                        minOccurs="0"/>
            <xs:element name="datawriter_qos"
                        type="dataWriterQos"
                        minOccurs="0"/>
            <xs:element name="auto_configure_qos"
                        type="xs:boolean"
                        minOccurs="0"/>
        </xs:all>
    </xs:group>

    <xs:complexType name="autoTopicRouteOutput">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                This element is used to configure which data types and topics
                are discovered in the output
                ]]>
            </xs:documentation>
        </xs:annotation>
       <xs:group ref="autoTopicRouteOutputGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="participant" type="xs:string"/>
    </xs:complexType>

    <xs:group name="autoRouteGroup">
        <xs:sequence>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="publish_with_original_timestamp"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="periodic_action"
                        type="duration"
                        minOccurs="0"/>
            <xs:element name="enable_data_on_inputs"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Controls whether this route enables the dispatch of
                        DATA_ON_INPUTS event.
                        Default: True
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="processor"
                        type="routeProcessor"
                        minOccurs="0"/>
            <xs:choice minOccurs="0">
                <xs:element name="dds_input"
                            type="autoTopicRouteInput"/>
                <xs:element name="input"
                            type="autoRouteStreamPort"/>
            </xs:choice>
            <xs:choice minOccurs="0">
                <xs:element name="dds_output"
                            type="autoTopicRouteOutput"/>
                <xs:element name="output"
                            type="autoRouteStreamPort"/>
            </xs:choice>
        </xs:sequence>
    </xs:group>

    <xs:complexType name="autoRoute">
        <xs:annotation>
            <xs:documentation>
                 <![CDATA[
                Defines a set of potential routes, with the same input and output
                type, and the same input and output stream name. A route can
                eventually be instantiated when a new stream is discovered
                with a type name and a stream name that match the filters in
                the auto route. When this happens, a route is created (but not
                necessarily
                started) with the configuration defined in the auto route tag.
                ]]>
            </xs:documentation>
        </xs:annotation>

        <xs:group ref="autoRouteGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="enabled" default="true" type="xs:boolean"/>
    </xs:complexType>

    <xs:group name="autoTopicRouteGroup">
        <xs:sequence>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="publish_with_original_info"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="publish_with_original_timestamp"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="propagate_dispose"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="propagate_unregister"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="topic_query_proxy"
                        minOccurs="0"
                        type="topicQueryProxy"/>
            <xs:element name="filter_propagation"
                        type="filterPropagation"
                        minOccurs="0"/>
            <xs:element name="periodic_action"
                        type="duration"
                        minOccurs="0"/>
            <xs:element name="enable_data_on_inputs"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Controls whether this route enables the dispatch of
                        DATA_ON_INPUTS event.
                        Default: True
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="processor"
                        type="routeProcessor"
                        minOccurs="0"/>
            <xs:element name="input"
                        type="autoTopicRouteInput"
                        minOccurs="0"/>
            <xs:element name="output"
                        type="autoTopicRouteOutput"
                        minOccurs="0"/>
        </xs:sequence>
    </xs:group>

     <xs:complexType name="autoTopicRoute">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines a set of potential routes, with the same input and output
                type, and the same input and output stream name. A route can
                eventually be instantiated when a new stream is discovered with
                a type name and a stream name that match the filters in the
                auto route. When this happens, a route is created (but not
                necessarily started) with the configuration defined in the auto
                route tag.
                ]]>
            </xs:documentation>
        </xs:annotation>

        <xs:group ref="autoTopicRouteGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="enabled" default="true" type="xs:boolean"/>
     </xs:complexType>

    <!-- ================================================================== -->
    <!-- TopicRoute and Route                                               -->
    <!-- ================================================================== -->

     <xs:complexType name="outputTransformation">
         <xs:all>
             <xs:element name="input_type_name"
                         type="xs:string"
                         minOccurs="0"/>
             <xs:element name="input_connection_name"
                         type="xs:string"
                         minOccurs="0"/>
             <xs:element name="property"
                         type="property"
                         minOccurs="0"/>
         </xs:all>

         <xs:attribute name="plugin_name"
                       type="elementReference">
             <xs:annotation>
                 <xs:documentation>
                    <![CDATA[
                    Reference to the an transformation plugin in the form
                    LibraryName::PluginName
                    ]]>
                 </xs:documentation>
             </xs:annotation>
         </xs:attribute>
     </xs:complexType>

     <xs:complexType name="inputTransformation">
         <xs:all>
             <xs:element name="output_type_name"
                         type="xs:string"
                         minOccurs="0"/>
             <xs:element name="output_connection_name"
                         type="xs:string"
                         minOccurs="0"/>
             <xs:element name="property"
                         type="property"
                         minOccurs="0"/>
         </xs:all>

         <xs:attribute name="plugin_name"
                       type="elementReference">
             <xs:annotation>
                 <xs:documentation>
                    <![CDATA[
                    Reference to the an transformation plugin in the form
                    LibraryName::PluginName
                    ]]>
                 </xs:documentation>
             </xs:annotation>
         </xs:attribute>
     </xs:complexType>

     <xs:group name="routeOutputGroup">
         <xs:all>
             <xs:element name="entity_monitoring"
                         type="entityMonitoring"
                         minOccurs="0"/>
             <xs:element name="stream_name"
                         type="xs:string"
                         minOccurs="0">
                 <xs:annotation>
                     <xs:documentation>
                        <![CDATA[
                        The name used to identify the input/output data stream
                        in this route.
                        ]]>
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
             <xs:element name="registered_type_name"
                         type="xs:string"
                         minOccurs="0">
                 <xs:annotation>
                     <xs:documentation>
                        <![CDATA[
                        The type of the samples in this input/output stream
                        This type can be discovered or registered in the
                        connection.
                        ]]>
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
             <xs:element name="creation_mode"
                         type="creationMode"
                         minOccurs="0"/>
             <xs:element name="property"
                         type="property"
                         minOccurs="0"/>
             <xs:element name="transformation"
                         type="outputTransformation"
                         minOccurs="0"/>
         </xs:all>
     </xs:group>


     <xs:group name="routeInputGroup">
         <xs:all>
             <xs:element name="entity_monitoring"
                         type="entityMonitoring"
                         minOccurs="0"/>
             <xs:element name="stream_name"
                         type="xs:string"
                         minOccurs="0">
                 <xs:annotation>
                     <xs:documentation>
                        <![CDATA[
                        The name used to identify the input/output data stream
                        in this route.
                        ]]>
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
             <xs:element name="registered_type_name"
                         type="xs:string"
                         minOccurs="0">
                 <xs:annotation>
                     <xs:documentation>
                        <![CDATA[
                        The type of the samples in this input/output stream
                        This type can be discovered or registered in the
                        connection.
                        ]]>
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
             <xs:element name="creation_mode"
                         type="creationMode"
                         minOccurs="0"/>
             <xs:element name="property"
                         type="property"
                         minOccurs="0"/>
             <xs:element name="transformation"
                         type="inputTransformation"
                         minOccurs="0"/>
         </xs:all>
     </xs:group>

    <xs:complexType name="routeInput">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Applicable to non-DDS inputs/outputs.
                Defines the route’s input/output stream.
                ]]>
            </xs:documentation>
        </xs:annotation>

        <xs:group ref="routeInputGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="connection" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="routeOutput">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Applicable to non-DDS inputs/outputs.
                Defines the route’s input/output stream.
                ]]>
            </xs:documentation>
        </xs:annotation>

        <xs:group ref="routeOutputGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="connection" type="xs:string"/>
    </xs:complexType>

    <xs:group name="topicRouteOutputGroup">
        <xs:all>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="topic_name"
                        type="xs:string"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        The topic name used by this route's DataWriter
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="registered_type_name"
                        type="xs:string"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        The type of the samples in this input/output stream
                        This type can be discovered or registered in the
                        connection.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="creation_mode"
                        type="creationMode"
                        minOccurs="0"/>
            <xs:element name="on_delete_wait_for_ack_timeout"
                        type="duration"
                        minOccurs="0"/>
            <xs:element name="datawriter_qos"
                        type="dataWriterQos"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Sets the DDS Data Writer QoS.
                        Default: DDS defaults
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="auto_configure_qos"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="transformation"
                        type="outputTransformation"
                        minOccurs="0"/>
        </xs:all>
    </xs:group>


    <xs:complexType name="topicRouteOutput">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines the route's output topic.
                Only applicable to DDS inputs.
                ]]>
            </xs:documentation>
        </xs:annotation>
         <xs:group ref="topicRouteOutputGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="participant" type="xs:string"/>
    </xs:complexType>

    <xs:group name="topicRouteInputGroup">
        <xs:all>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="topic_name"
                        type="xs:string"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        The topic name used by this route's DataReader
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="registered_type_name"
                        type="xs:string"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        The type of the samples in this input/output stream
                        This type can be discovered or registered in the
                        connection.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="creation_mode"
                        type="creationMode"
                        minOccurs="0"/>
            <xs:element name="propagate_dispose"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="propagate_unregister"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="datareader_qos"
                        type="dataReaderQos"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Sets the DDS Data Reader QoS.
                        Default: DDS defaults
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="auto_configure_qos"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="content_filter"
                        type="inputContentFilter"
                        minOccurs="0"/>
             <xs:element name="transformation"
                         type="inputTransformation"
                         minOccurs="0"/>
        </xs:all>
    </xs:group>

    <xs:complexType name="topicRouteInput">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines the route's input topic.
                Only applicable to DDS inputs.
                ]]>
            </xs:documentation>
        </xs:annotation>

        <xs:group ref="topicRouteInputGroup"/>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="participant"
                      use="required"
                      type="xs:string"/>
    </xs:complexType>

    <xs:group name="routeGroup">
        <xs:sequence>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="route_types"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Defines if the input connection will use types discovered
                        in the output connection and vice versa for the
                        creation of StreamWriters and StreamReaders in the
                        route.
                        Default: true.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="publish_with_original_timestamp"
                        type="xs:boolean"
                        minOccurs="0"/>
            <xs:element name="periodic_action"
                        type="duration"
                        minOccurs="0"/>
            <xs:element name="enable_data_on_inputs"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Controls whether this route enables the dispatch of
                        DATA_ON_INPUTS event.
                        Default: True
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="processor"
                        type="routeProcessor"
                        minOccurs="0"/>
        </xs:sequence>
    </xs:group>

    <xs:complexType name="route">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines a explicit mapping between an input data stream
                on one connection and an output data stream on the other
                connection
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:group ref="routeGroup"/>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="dds_input"
                            type="topicRouteInput"/>
                <xs:element name="input"
                            type="routeInput"/>
                <xs:element name="dds_output"
                            type="topicRouteOutput"/>
                <xs:element name="output"
                            type="routeOutput"/>
            </xs:choice>
        </xs:sequence>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="enabled" default="true" type="xs:boolean"/>

    </xs:complexType>

    <xs:group name="topicRouteGroup">
        <xs:sequence>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="route_types"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Defines if the input connection will use types discovered
                        in the output connection and vice versa for the
                        creation of StreamWriters and StreamReaders in the
                        route.
                        Default: true.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="publish_with_original_info"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Writes the data sample as if they came from its original
                        writer. Setting this option to true allows having
                        redundant routing services and prevents the applications
                        from receiving duplicate samples.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="publish_with_original_timestamp"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        When this tag is true, the data samples read from the
                        input stream are written into the output stream with
                        the same timestamp that was associated with them when
                        they were made available in the input domain.

                        This option may not be applicable in some adapter
                        implementations in which the concept of timestamp
                        is unsupported.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="propagate_dispose"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Indicates whether or not disposed samples
                        (NOT_ALIVE_DISPOSE) must be propagated by the
                        topic route.

                        This action maybe be overwritten by the execution
                        of a transformation.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="propagate_unregister"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Indicates whether or not
                        NOT_ALIVE_NO_WRITERS samples must be propagated
                        by the topic route by using the
                        unregister_instance() operation
                        This action maybe be overwritten by the execution
                        of a transformation.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="topic_query_proxy"
                        minOccurs="0"
                        type="topicQueryProxy"/>
            <xs:element name="filter_propagation"
                        type="filterPropagation"
                        minOccurs="0"/>
            <xs:element name="periodic_action"
                        type="duration"
                        minOccurs="0"/>
            <xs:element name="enable_data_on_inputs"
                        type="xs:boolean"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                         <![CDATA[
                        Controls whether this route enables the dispatch of
                        DATA_ON_INPUTS event.
                        Default: True
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="processor"
                        type="routeProcessor"
                        minOccurs="0"/>
        </xs:sequence>
    </xs:group>

    <xs:complexType name="topicRoute">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines a explicit mapping between an input topic
                on one domain and an output topic on the other domain.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:group ref="topicRouteGroup"/>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="input"
                            type="topicRouteInput"/>
                <xs:element name="output"
                            type="topicRouteOutput"/>
            </xs:choice>
        </xs:sequence>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="enabled" default="true" type="xs:boolean"/>
    </xs:complexType>

    <!-- ================================================================== -->
    <!-- Session                                                            -->
    <!-- ================================================================== -->

    <xs:group name="routerSessionGroup">
        <xs:sequence>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:element name="thread_pool"
                        type="threadPoolSettings"
                        minOccurs="0"/>
            <xs:element name="auto_configure_publisher_qos"
                        type="xs:boolean"
                        minOccurs="0" 
                        default="false"/>
            <xs:element name="auto_configure_subscriber_qos"
                        type="xs:boolean"
                        minOccurs="0" 
                        default="false"/>
            <xs:element name="periodic_action"
                        type="duration"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Specifies a period at which Processors will receive
                        notifications of the periodic event. This setting represents
                        a default value for all the routes in this Session.
                        This valuecan be overridden invidually by each route.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="property"
                        type="property"
                        minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Configures the properties to be provided on the creation
                        of a Session adapter.
                        ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:choice minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        <![CDATA[
                        Sets the DDS publisher/subscriber QoS. Only applicable
                        to DDS domains. Default: DDS defaults
                        ]]>
                    </xs:documentation>
                </xs:annotation>
                <xs:sequence>
                    <xs:element name="publisher_qos"
                                type="publisherQos"/>
                    <xs:element name="subscriber_qos"
                                type="subscriberQos"
                                minOccurs="0"/>
                </xs:sequence>
                <xs:sequence>
                    <xs:element name="subscriber_qos"
                                type="subscriberQos"/>
                    <xs:element name="publisher_qos"
                                type="publisherQos"
                                minOccurs="0"/>
                </xs:sequence>
            </xs:choice>
        </xs:sequence>
    </xs:group>

    <xs:complexType name="routerSession">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines an N-thread context for route processing.
                A route can be processed by one thread at a time.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:group ref="routerSessionGroup"/>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="auto_topic_route"
                            type="autoTopicRoute"/>
                <xs:element name="topic_route"
                            type="topicRoute"/>
                <xs:element name="route"
                            type="route"/>
                <xs:element name="auto_route"
                            type="autoRoute"/>
            </xs:choice>
        </xs:sequence>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="enabled" default="true" type="xs:boolean"/>
    </xs:complexType>


    <!-- ================================================================== -->
    <!-- DomainRoute                                                        -->
    <!-- ================================================================== -->

    <xs:complexType name="connectionRegisteredType">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Makes a type defined in the file available to this connection
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="name" use="required" type="xs:string">
            <xs:annotation>
                <xs:documentation>
                     <![CDATA[
                    The name routes will use to refer to this type
                    ]]>
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="type_name" use="required" type="xs:string">
            <xs:annotation>
                <xs:documentation>
                    <![CDATA[
                    The full name (e.g. module1::module2::type) of
                    the type defined in the file
                    ]]>
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="domainRouteParticipant">
        <xs:complexContent>
            <xs:extension base="userParticipant">
                <xs:sequence>
                    <xs:element name="registered_type"
                                type="connectionRegisteredType"
                                minOccurs="0"
                                maxOccurs="unbounded">
                        <xs:annotation>
                            <xs:documentation>
                         <![CDATA[
                        This is a deprecated element and will be removed in
                        future versions. Use <register_type> instead.
                        ]]>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="domainRouteConnection">
        <xs:complexContent>
            <xs:extension base="userConnection">
                <xs:sequence>
                    <xs:element name="registered_type"
                                type="connectionRegisteredType"
                                minOccurs="0"
                                maxOccurs="unbounded">
                        <xs:annotation>
                            <xs:documentation>
                         <![CDATA[
                        This is a deprecated element and will be removed in
                        future versions. Use <register_type> instead.
                        ]]>
                            </xs:documentation>
                        </xs:annotation>
                    </xs:element>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="domainRoute">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Defines a mapping between two data domains.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="participant"
                            type="domainRouteParticipant"/>
                <xs:element name="connection"
                            type="domainRouteConnection"/>
                <xs:element name="session"
                            type="routerSession"/>
            </xs:choice>
        </xs:sequence>

        <xs:attribute name="name" type="resourceName"/>
        <xs:attribute name="enabled"  default="true" type="xs:boolean"/>
    </xs:complexType>

    <xs:complexType name="routingService">
        <xs:annotation>
            <xs:documentation>
                 <![CDATA[
                This element allows configuring the DDS Router Service
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="abstractService">
                <xs:sequence>
                    <xs:element name="entity_monitoring"
                                type="entityMonitoring"
                                minOccurs="0"/>
                    <xs:element name="jvm"
                                type="jvm"
                                minOccurs="0"/>
                    <xs:element name="domain_route"
                                type="domainRoute"
                                minOccurs="0"
                                maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="group_name"
                              use="optional"
                              type="xs:NCName">
                    <xs:annotation>
                        <xs:documentation>
                         <![CDATA[
                        A routing service may belong to a  group of several
                        routing services identified by a common group_name.
                        This common name can be used to implement a specific
                        policy when the communication happens between routing
                        services of the same group. For example, in the built-in
                        DDS adapter, a participant  will ignore other
                        participants in the same group, as a way to avoid
                        circular communication.
                        ]]>
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="routerPluginLibrary">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Library of Routing Service plug-ins.
                ]]>
            </xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="adapter_plugin"
                        type="nativePlugin">
                <xs:annotation>
                    <xs:documentation>
                            <![CDATA[
                            Declares a native adapter plug-in.
                            ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="java_adapter_plugin"
                        type="javaPlugin">
                <xs:annotation>
                    <xs:documentation>
                                <![CDATA[
                                Declares a java adapter plug-in.
                                ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="transformation_plugin"
                        type="nativePlugin"
                        minOccurs="0"
                        maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                            <![CDATA[
                            Entry point to load a pluggable transformation.
                            ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="processor_plugin"
                        type="nativePlugin"
                        minOccurs="0"
                        maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                            <![CDATA[
                            Entry point to load a pluggable processor
                            ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute name="name"
                      use="required"
                      type="xs:NCName"/>
    </xs:complexType>

    <xs:complexType name="routerTypes">
        <xs:group ref="moduleElements"/>
    </xs:complexType>

    <!-- ================================================================== -->
    <!-- Root                                                               -->
    <!-- ================================================================== -->

    <xs:complexType name="ddsRouter">
        <!-- Definitions used by Routing Service -->
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <!-- User Env -->
            <xs:element name="configuration_variables" type="KeyValuePairSeq">
                <xs:annotation>
                    <xs:documentation>
                            <![CDATA[
                            Defines a set of default values for user variables.
                            The values specified in this section can be overridden
                            by command-line arguments, Library API, or
                            environment variables.
                            ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <!-- Type definitions -->
            <xs:element name="types" type="routerTypes">
                <xs:annotation>
                    <xs:documentation>
                                <![CDATA[
                                Defines types that can be used by
                                RTI Routing Service
                                ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <!-- QoS definitions -->
            <xs:element name="qos_library" type="qosLibrary">
                <xs:annotation>
                    <xs:documentation>
                                <![CDATA[
                                Specifies a QoS library and profiles. The
                                contents of this tag are specified in the same
                                manner as for an RTI Connext
                                QoS profile file
                                ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <!-- Transformation plugins -->
            <xs:element name="transformation_library"
                            type="routerPluginLibrary">
                <xs:annotation>
                    <xs:documentation>
                                <![CDATA[
                                Entry point to load apluggable transformation
                                ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <!-- Adapter plugins -->
            <xs:element name="adapter_library"
                            type="routerPluginLibrary"/>
            <!-- All plugins -->
            <xs:element name="plugin_library"
                            type="routerPluginLibrary"/>
            <!-- Routing service configuration(s) -->
            <xs:element name="routing_service"
                            type="routingService"
                            maxOccurs="unbounded"/>
            <!-- ignored elements -->
            <xs:element name="domain_library" type="domainLibrary">
                <xs:annotation>
                    <xs:documentation>
                                <![CDATA[
                                Ignored. For validation purposes only
                                ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="domain_participant_library" type="participantLibrary">
                <xs:annotation>
                    <xs:documentation>
                                <![CDATA[
                                Ignored. For validation purposes only
                                ]]>
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>

        <xs:attribute name="version" type="versionString" use="optional"/>
    </xs:complexType>

    <xs:element name="dds" type="ddsRouter">
        <xs:annotation>
            <xs:documentation>
                <![CDATA[
                Configuration of RTI Connext and RTI Routing Service
                ]]>
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <!-- ================================================================== -->
    <!-- Update types                                                       -->
    <!-- ================================================================== -->

    <!-- Service -->

    <xs:complexType name="monitoringUpdate">
        <xs:group ref="monitoringGroup"/>
    </xs:complexType>

      <xs:complexType name="administrationUpdate">
        <xs:all>
            <xs:element name="save_path"
                         type="xs:string"
                         minOccurs="0"/>
            <xs:element name="save_on_update"
                        type="xs:boolean"
                        minOccurs="0"/>
        </xs:all>
     </xs:complexType>

       <xs:complexType name="routingServiceUpdate">
        <xs:all>
            <xs:element name="administration"
                        type="administrationUpdate"
                        minOccurs="0"/>
            <xs:element name="monitoring"
                        type="monitoringUpdate"
                        minOccurs="0"/>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
        </xs:all>
    </xs:complexType>


    <!-- DomainRoute/Participant/Connection -->
    <xs:complexType name="domainRouteParticipantUpdate">
        <xs:sequence>
            <xs:group ref="userParticipantGroup"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="domainRouteConnectionUpdate">
        <xs:sequence>
            <xs:group ref="userConnectionGroup"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="domainRouteUpdate">
        <xs:sequence>
            <xs:element name="entity_monitoring"
                        type="entityMonitoring"
                        minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>

    <!-- Session -->
    <xs:complexType name="routerSessionUpdate">
        <xs:group ref="routerSessionGroup"/>
    </xs:complexType>

    <!-- AutoRoute/Route/Input/Output/Transformation -->
    <xs:complexType name="outputTransformationUpdate">
        <xs:complexContent>
            <xs:extension base="outputTransformation"/>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="inputTransformationUpdate">
        <xs:complexContent>
            <xs:extension base="inputTransformation"/>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="routeInputUpdate">
        <xs:group ref="routeInputGroup"/>
    </xs:complexType>

    <xs:complexType name="routeOutputUpdate">
        <xs:group ref="routeOutputGroup"/>
    </xs:complexType>

    <xs:complexType name="autoRouteStreamPortUpdate">
        <xs:group ref="autoRoutePortGroup"/>
    </xs:complexType>

    <xs:complexType name="topicRouteInputUpdate">
        <xs:group ref="topicRouteInputGroup"/>
    </xs:complexType>

    <xs:complexType name="topicRouteOutputUpdate">
        <xs:group ref="topicRouteOutputGroup"/>
    </xs:complexType>

    <xs:complexType name="autoTopicRouteInputUpdate">
        <xs:group ref="autoTopicRouteInputGroup"/>
    </xs:complexType>

    <xs:complexType name="autoTopicRouteOutputUpdate">
        <xs:group ref="autoTopicRouteOutputGroup"/>
    </xs:complexType>

    <xs:complexType name="routeUpdate">
        <xs:group ref="routeGroup"/>
    </xs:complexType>

    <xs:complexType name="autoRouteUpdate">
        <xs:group ref="autoRouteGroup"/>
    </xs:complexType>

    <xs:complexType name="topicRouteUpdate">
        <xs:group ref="topicRouteGroup"/>
    </xs:complexType>

    <xs:complexType name="autoTopicRouteUpdate">
        <xs:group ref="autoTopicRouteGroup"/>
    </xs:complexType>

</xs:schema>
