<?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 RTC XML Schema File                                             -->
<!-- =================================================================== -->

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

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

    <!-- =================================================================== -->
    <!-- Main Elements                                                       -->
    <!-- =================================================================== -->

    <xs:element name="dds">
        <xs:annotation>
            <xs:documentation>
                Configuration of RTI DDS and RTI DDS Services.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="real_time_connect"/>
                <xs:element name="qos_library" type="qosLibrary"/>
                <xs:element name="types">
                    <xs:complexType>
                        <xs:group ref="moduleElements"/>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
            <xs:attribute name="version" type="xs:string" use="optional"/>
        </xs:complexType>
    </xs:element>

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

    <xs:element name="real_time_connect">
        <xs:annotation>
            <xs:documentation>
                Configuration of an execution of RTI Database Integration Service
            </xs:documentation>
        </xs:annotation>
        <xs:complexType >

            <xs:sequence>
                <xs:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="1" />
                <xs:element ref="general_options" minOccurs="0" maxOccurs="1" />
                <xs:element ref="database_mapping_options" minOccurs="0" maxOccurs="1" />
                <xs:choice minOccurs="1" maxOccurs="unbounded">
                    <xs:element ref="mysql_connection"/>
                    <xs:element ref="oracle_connection"/>
                    <xs:element ref="timesten_connection"/>
                    <xs:element ref="sqlserver_connection"/>
                    <xs:element ref="postgresql_connection"/>
                </xs:choice>
            </xs:sequence>

            <xs:attribute name="name" use="required"  type="xs:NCName"/>
        </xs:complexType>
    </xs:element>

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

    <xs:complexType name="annotationType">
        <xs:all>
            <xs:element name="documentation" type="xs:string" minOccurs="0" maxOccurs="1"/>
        </xs:all>
    </xs:complexType>

    <xs:element name="general_options">

        <xs:annotation>
            <xs:documentation>
                General options, common to all data bases
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
            <xs:element ref="administration"
			    minOccurs="0" maxOccurs="1" />
		        <xs:element name="enable_table_replication" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Set it to true to enable real-time lazy database replication.
                            Setting this attribute to true will automatically configure the QoS values of publications
                            and subscriptions to provide conflict resolution and table initialization. The
                            attribute will also enable propagation of NULL values.

                            Default: false
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="typecode_from_table_schema" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Set it to true to enable typecode generation from table schemas.

                            When RTI Database Integration Service is used for table replication, setting this tag to true
                            (default) allows automatic table creation in the replicas.

                            Default: false if enable_table_replication is false. Otherwise, true
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="max_objects_per_thread" type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Use this attribute to increase the maximum number of objects per thread of
                            RTI Data Distribution Service.

                            Default: DDS default (2048)
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element ref="wait_set" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="wait_set">
        <xs:annotation>
            <xs:documentation>
                Use this tag to configure Database Integration Service to use
                waitsets to read samples from the subscriptions DataReaders.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element name="enabled" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
                <xs:element name="max_event_count" minOccurs="0" maxOccurs="1" type="xs:positiveInteger"/>
                <xs:element name="max_event_delay" minOccurs="0" maxOccurs="1" type="duration"/>
                <xs:element name="wait_timeout" minOccurs="0" maxOccurs="1" type="duration"/>
                <xs:element name="thread_pool_size" minOccurs="0" maxOccurs="1" type="xs:positiveInteger"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <!-- ================================================================== -->
    <!-- Administration                                   -->
    <!-- ================================================================== -->

    <xs:element name="administration">
	<xs:annotation>
	    <xs:documentation>
		Remote access configuration.
	    </xs:documentation>
	</xs:annotation>
	<xs:complexType>
	    <xs:sequence>
		<xs:element name="domain_id"
			    type="positiveInteger_DOMAIN_ID"
			    minOccurs="1" maxOccurs="1"/>
                <xs:element name="distributed_logger" type="distributedLogger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Configuration settings for Distributed Logger.
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                 <xs:element ref="profile_name" minOccurs="0" maxOccurs="1"/>
	    </xs:sequence>
	</xs:complexType>
    </xs:element>

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

    <xs:element name="database_mapping_options">
        <xs:annotation>
            <xs:documentation>
                Options on how DDS types are mapped to data base tables,
                common to all databases
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="idl_member_prefix_max_length" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="idl_member_suffix_max_length" minOccurs="0" maxOccurs="1"/>
                <xs:element name="identifier_separator_char" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            This attribute sets the character that is used as a separator in the hierarchical
                            names generated when mapping IDL fields into SQL table columns. The attribute
                            is also used to configure the separator character for the columns in the meta
                            tables.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:length value="1" />
                        </xs:restriction>
                    </xs:simpleType>
                </xs:element>
                <xs:element name="open_bracket_char" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            This attribute sets the open bracket character that is used in the index component
                            of the arrays and sequences members names.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:length value="1" />
                        </xs:restriction>
                    </xs:simpleType>
                </xs:element>
                <xs:element name="close_bracket_char" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            This attribute sets the close bracket character that is used in the index component
                            of the arrays and sequences members names.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:length value="1" />
                        </xs:restriction>
                    </xs:simpleType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>

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

    <xs:element name="mysql_connection">
        <xs:annotation>
            <xs:documentation>
                Configuration of a connection to a MySQL data base
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="dsn" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="user_name" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="password" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="send_period" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="database_logging" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="json_default_size" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="transaction_max_duration" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscription_default_settings" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscriptions" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="publications" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="oracle_connection">
        <xs:annotation>
            <xs:documentation>
                Configuration of a connection to an Oracle data base. (Deprecated).
                Kept for backward compatibility.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="dsn" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="user_name" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="password" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="send_period" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="database_logging" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="clob_default_size" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="blob_default_size" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscription_default_settings" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscriptions" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="publications" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="timesten_connection">
        <xs:annotation>
            <xs:documentation>
                Configuration of a connection to a Timesten data base. (Deprecated).
                Kept for backward compatibility.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="dsn" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="user_name" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="password" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="send_period" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="database_logging" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="xla_buffer_size" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscription_default_settings" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscriptions" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="publications" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="log_acknowledgement_period" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="sqlserver_connection">
        <xs:annotation>
            <xs:documentation>
                Configuration of a connection to a SQL Server data base
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="dsn" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="user_name" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="password" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="send_period" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="database_logging" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscription_default_settings" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscriptions" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="publications" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="postgresql_connection">
        <xs:annotation>
            <xs:documentation>
                Configuration of a connection to a PostgreSQL data base
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="dsn" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="user_name" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="password" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="database_logging" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="json_default_size" minOccurs="0" maxOccurs="1"/>
                <xs:element name="force_autocommit" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscription_default_settings" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="subscriptions" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

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

    <xs:element name="subscriptions">
        <xs:annotation>
            <xs:documentation>
                Set of pre-defined entries to the table RTIDDS_SUBSCRIPTIONS
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="subscription" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="delete" use="optional"  type="deleteRows" default="false"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="subscription_default_settings">
        <xs:annotation>
            <xs:documentation>
                Default settings for an RTIDDS_SUBSCRIPTIONS
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="table_owner"
                        minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="domain_id"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="table_history_depth"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="process_batch" minOccurs="0"
                        maxOccurs="1" />
                    <xs:element ref="process_period" minOccurs="0"
                        maxOccurs="1" />
                    <xs:element ref="commit_type" minOccurs="0"
                        maxOccurs="1" />
                    <xs:element ref="cache_maximum_size"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="cache_initial_size"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="delete_on_dispose"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="profile_name" minOccurs="0"
                        maxOccurs="1" />
                    <xs:element ref="filter_duplicates"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="ordered_store" minOccurs="0"
                        maxOccurs="1" />
                    <xs:element ref="persist_state" minOccurs="0"
                        maxOccurs="1" />
                    <xs:element ref="idl_member_prefix_max_length"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="idl_member_suffix_max_length"
                        minOccurs="0" maxOccurs="1" />
                    <xs:element ref="metadata_fields" minOccurs="0"
                        maxOccurs="1" />
                    <xs:element ref="table_schema" minOccurs="0"
                        maxOccurs="1" />
                </xs:choice>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="subscription">
        <xs:annotation>
            <xs:documentation>
                Pre-defined entry to the table RTIDDS_SUBSCRIPTIONS
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="table_owner" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="table_name" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="domain_id" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="topic_name" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="type_name" minOccurs="0" maxOccurs="1"/>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="table_history_depth" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="process_batch" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="process_period" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="commit_type" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="cache_maximum_size" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="cache_initial_size" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="delete_on_dispose" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="profile_name" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="filter_duplicates" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="ordered_store" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="persist_state" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="idl_member_prefix_max_length" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="idl_member_suffix_max_length" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="metadata_fields" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="table_schema" minOccurs="0" maxOccurs="1"/>
                </xs:choice>
            </xs:sequence>
            <xs:attribute name="overwrite" use="optional"  type="overwriteRow" default="false"/>
        </xs:complexType>

    </xs:element>

    <xs:element name="publications">
        <xs:annotation>
            <xs:documentation>
                Set of pre-defined entries to the table RTIDDS_PUBLICATIONS
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="publication" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="delete" use="optional"  type="deleteRows" default="false"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="publication">
        <xs:annotation>
            <xs:documentation>
                Pre-defined entry to the table RTIDDS_PUBLICATIONS
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="table_owner" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="table_name" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="domain_id" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="topic_name" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="type_name" minOccurs="0" maxOccurs="1"/>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="table_history_depth" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="resolution_column" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="idl_member_prefix_max_length" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="idl_member_suffix_max_length" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="profile_name" minOccurs="0" maxOccurs="1"/>
                    <xs:element ref="metadata_fields" minOccurs="0" maxOccurs="1"/>
                </xs:choice>
            </xs:sequence>
            <xs:attribute name="overwrite" use="optional"  type="overwriteRow" default="false"/>
        </xs:complexType>
    </xs:element>


    <xs:element name="metadata_fields">
        <xs:annotation>
            <xs:documentation>
              Metadata fields associated with user data samples
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="timestamp_type" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="included" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="excluded" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="timestamp_type">
        <xs:annotation>
            <xs:documentation>
              Format of stored timestamps
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="BIGINT">
                    <xs:annotation>
                        <xs:documentation>
                          SQL BIGINT
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="TIMESTAMP">
                    <xs:annotation>
                        <xs:documentation>
                          SQL TIMESTAMP
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="included">
        <xs:annotation>
            <xs:documentation>
              Metadata fields associated with user data samples
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="field" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="excluded">
        <xs:annotation>
            <xs:documentation>
              Metadata fields associated with user data samples
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="field" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="field">
        <xs:annotation>
            <xs:documentation>
              Metadata field to include or exclude
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="ALL">
                    <xs:annotation>
                        <xs:documentation>
                          ALL
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="SOURCE_TIMESTAMP">
                    <xs:annotation>
                        <xs:documentation>
                          SOURCE_TIMESTAMMP
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="RECEPTION_TIMESTAMP">
                    <xs:annotation>
                        <xs:documentation>
                          RECEPTION_TIMESTAMP
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="table_schema">
        <xs:annotation>
            <xs:documentation>
              Data serialization schema
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="FLATTEN">
                    <xs:annotation>
                        <xs:documentation>
                          Legacy flat serialization
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="JSON">
                    <xs:annotation>
                        <xs:documentation>
                          JSON serialization
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="JSONB">
                    <xs:annotation>
                        <xs:documentation>
                          JSONB serialization
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <!-- =================================================================== -->
    <!-- Basic types                                                         -->
    <!-- =================================================================== -->

    <xs:simpleType name="positiveInteger_DOMAIN_ID">
        <xs:annotation>
            <xs:documentation>
                Sets the domain ID associated with the participant.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:nonNegativeInteger"/>
    </xs:simpleType>



    <xs:element name="idl_member_prefix_max_length" type="xs:integer">
        <xs:annotation>
            <xs:documentation>
                This attribute controls the prefix length of the IDL member identifiers that will
                be used to truncate column names when a table is automatically created.
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="idl_member_suffix_max_length" type="xs:integer">
        <xs:annotation>
            <xs:documentation>
                This attribute controls the suffix length of the IDL member identifiers that will be
                used to truncate column names when a table is automatically created.
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="dsn">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    This attribute is mandatory and there is no default value.
                    You must specify a valid DSN that is found
                    in a ODBCINI file or the Windows registry.
                    The RTI Database Integration Service Daemon will make a connection to this DSN.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="user_name">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    User name for the data base connection
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="password">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    Password for the data base connection
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="send_period">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    Specifies the milliseconds interval
                    at which the RTI Database Integration Service Daemon publishes database changes. The
                    value must be greater than or equal to 0. With a value of 0 the daemon publishes
                    database changes as soon as they are available. A shorter time interval reduces
                    latency.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:nonNegativeInteger" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="database_logging">
        <xs:complexType>
            <xs:annotation>
                <xs:documentation>
                    If enabled the RTI Database Integration Service Daemon’s log
                    messages will be stored in a table named RTIRTC_LOG in the database specified
                    by the DSN.
                </xs:documentation>
            </xs:annotation>
            <xs:sequence>
                <xs:element name="enabled" type="xs:boolean" minOccurs="1" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>Enable storing log messages in the database</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="history_depth" type="xs:integer" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            The value limits the size of the table, RTIRTC_LOG, in
                            the database that the daemon uses for logging messages. The default is 1000
                            rows, and a value of -1 implies no limit. When the table is filled, new log messages
                            will replace the oldest messages, effectively using the table as a circular
                            buffer.
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="transaction_max_duration">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    This attribute is optional and it provides an estimation of the maximum duration of a
                    database transaction. If a table change is not committed in the interval specified by this
                    attribute, it will not be published to DDS.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:integer" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="clob_default_size">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    The value limits the size of CLOB and NCLOB columns
                    for tables that do not have an associated TypeCode in
                    the RTIRTC_TBL_INFO meta table.
                    If a user table has an associated TypeCode, the maximum size of the CLOB and
                    NCLOB columns is determined on a per-column basis using the TypeCode information.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:nonNegativeInteger" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="blob_default_size">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    The value limits the size of BLOB columns for tables
                    that do not have an associated TypeCode in the
                    RTIRTC_TBL_INFO meta table.
                    If a user table has an associated TypeCode, the maximum size of the BLOB columns
                    is determined on a per-column basis using the TypeCode information.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:nonNegativeInteger" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="json_default_size">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    The value is the default size used to store JSON samples in
                    a database. JSON strings longer than this value will be
                    allocated dynamically.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:nonNegativeInteger" />
        </xs:simpleType>
    </xs:element>


    <xs:element name="xla_buffer_size">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    This attribute is optional and is only used if the Oracle TimesTen DSN specifies a diskless
                    connection. For diskless connections, the minimum size of the Oracle TimesTen XLA
                    staging buffer must be at least as big as the largest single SQL transaction executed
                    through the database connection. The size of a transaction is related to the aggregated
                    size of data values that have changed as a result of the transaction.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:nonNegativeInteger" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="table_owner">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    This column along with table_name specify the user table
                    into which data received by a DDSDataReader will be stored.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="table_name">
        <xs:annotation>
            <xs:documentation>
                This column along with table_owner specify the user table
                into which data received by a DDSDataReader will be stored.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="domain_id">
        <xs:annotation>
            <xs:documentation>
                The DDS domain ID that will be used to subscribe to DDS topics
                whose values will be stored in the table
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:nonNegativeInteger"/>
        </xs:simpleType>
    </xs:element>

    <xs:element name="topic_name">
        <xs:annotation>
            <xs:documentation>
                The topic name that will be subscribed to and whose
                received values will be stored in the associated table
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="type_name">
        <xs:annotation>
            <xs:documentation>
                The type name of the topic that will be subscribed to
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="resolution_column">
        <xs:annotation>
            <xs:documentation>
                This column is used to designate one of the columns of the user table for use as the timestamp
                when data changes are published with the DDSDataWriter
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="table_history_depth">
        <xs:annotation>
            <xs:documentation>
                Determines the number of values of each instance received by
                the DDS DataReader that can be stored in the table
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:integer"/>
        </xs:simpleType>
    </xs:element>

    <xs:element name="process_batch">
        <xs:annotation>
            <xs:documentation>
                Controls how many data samples are processed at a time.
                Instead of executing SQL UPDATE or INSERT every time data is received,
                the daemon only stores the data after it receives a certain
                number of samples
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:positiveInteger"/>
        </xs:simpleType>
    </xs:element>

    <xs:element name="process_period" type="duration">
        <xs:annotation>
            <xs:documentation>
                is an upper limit on the amount of delay that will be
                incurred before received data is stored in the database. The period can be set to 0 only if
                process_batch is set to 1. This means that the daemon will store each data sample as it
                is received so there is no need for periodic processing of the received samples
            </xs:documentation>
        </xs:annotation>
    </xs:element>


    <xs:element name="commit_type">
        <xs:annotation>
            <xs:documentation>
                the user can chose whether or not the SQL
                UPDATE/INSERT statements are committed when each data sample is stored or after
                all of the data being processed have been stored
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="COMMIT_ON_PROCESS">
                    <xs:annotation>
                        <xs:documentation>
                            Commit the storage of a batch of data as a single transaction.
                            This will result in higher performance at
                            the risk of losing more data than necessary when the transaction is rolled-back
                            because an error with the database
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
                <xs:enumeration value="COMMIT_ON_SAMPLE">
                    <xs:annotation>
                        <xs:documentation>
                            This value will direct the daemon to commit the storage of each data sample as a
                            separate transaction.
                            Although the daemon will use more resources, if an error
                            occurs when a transaction is committed, only that data sample is lost.
                        </xs:documentation>
                    </xs:annotation>
                </xs:enumeration>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="cache_maximum_size">
        <xs:annotation>
            <xs:documentation>
                Control the size of a cache, used to store keys that exist in the table, that
                the daemon maintains for each DDS DataReader
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:integer"/>
        </xs:simpleType>
    </xs:element>


    <xs:element name="cache_initial_size">
        <xs:annotation>
            <xs:documentation>
                Control the size of a cache, used to store keys that exist in the table, that
                the daemon maintains for each DDS DataReader
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:integer"/>
        </xs:simpleType>
    </xs:element>

    <xs:element name="delete_on_dispose" type="xs:boolean">
        <xs:annotation>
            <xs:documentation>
                If true, when a DDS DataWriter disposes an instance stored into
                the database, the corresponding rows are deleted.
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="profile_name">
        <xs:annotation>
            <xs:documentation>
                This column specifies the name of the QoS Profile that RTI Database Integration Service will use to
                create the subscription. Syntax: QosLibraryName::QosProfileName
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>

    <xs:element name="filter_duplicates" type="xs:boolean">
        <xs:annotation>
            <xs:documentation>
                Whether or not duplicates should be filtered by
                the daemon. If duplicates are not filtered, the subscription data
                table may end up containing duplicates rows
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="ordered_store" type="xs:boolean">
        <xs:annotation>
            <xs:documentation>
                Whether or not the samples associated with a DataWriter identified
                by a virtual GUID must be stored in the database in order.
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="persist_state" type="xs:boolean">
        <xs:annotation>
            <xs:documentation>
                Whether or not the state of a RTI Database Integration Service subscription
                must be persisted into the database.
                The field only applies when filter_duplicates is set to true
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:simpleType name="overwriteRow">
        <xs:annotation>
            <xs:documentation>
                Whether or not the daemon should overwrite the row corresponding to this
                subscription/publication if it already exists in the database
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:boolean"/>
    </xs:simpleType>

    <xs:simpleType name="deleteRows">
        <xs:annotation>
            <xs:documentation>
                Whether or not the daemon should delete the
                previously existing rows in the subscription/publication table
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:boolean"/>
    </xs:simpleType>

    <xs:element name="log_acknowledgement_period">
        <xs:simpleType>
            <xs:annotation>
                <xs:documentation>
                    This attribute is optional and sets the time between transaction
                    log acknowledgements in seconds. Greater values of this
                    setting reduce the frequency of transaction log file purging. Default
                    value is 30 seconds.
                </xs:documentation>
            </xs:annotation>
            <xs:restriction base="xs:nonNegativeInteger" />
        </xs:simpleType>
    </xs:element>

</xs:schema>
