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

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


    <xs:include schemaLocation="definitions/rti_dds_qos_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 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 environment variables.
                            ]]>
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element ref="persistence_service"/>
                <xs:element name="qos_library" type="qosLibrary"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>

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

    <xs:element name="persistence_service">
        <xs:annotation>
            <xs:documentation>
                Configuration of an execution of RTI Persistence Service
            </xs:documentation>
        </xs:annotation>
        <xs:complexType >

            <xs:sequence>
                <xs:element name="annotation" type="annotationType" minOccurs="0" maxOccurs="1" />
                <xs:element ref="administration" minOccurs="0" maxOccurs="1" />
                <xs:element ref="persistent_storage" minOccurs="0" maxOccurs="1" />
                <xs:element ref="synchronization" minOccurs="0" maxOccurs="1" />
                <xs:element ref="purge_samples_after_acknowledgment" minOccurs="0" maxOccurs="1" />
                <xs:element ref="participant" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>

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

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

    <xs:element name="administration">
        <xs:annotation>
            <xs:documentation>
                Remote administration 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 name="participant_qos"
                    type="domainParticipantQosProfileChild"
                    minOccurs="0" maxOccurs="1"/>
            <xs:element name="publisher_qos"
                    type="publisherQosProfileChild"
                    minOccurs="0" maxOccurs="1"/>
            <xs:element name="subscriber_qos"
                    type="subscriberQosProfileChild"
                    minOccurs="0" maxOccurs="1"/>
            <xs:element name="datareader_qos"
                    type="dataReaderQosProfileChild"
                    minOccurs="0" maxOccurs="1"/>
            <xs:element name="datawriter_qos"
                    type="dataWriterQosProfileChild"
                    minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

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

    <xs:element name="persistent_storage">
        <xs:annotation>
            <xs:documentation>
                Configuration of the persistent storage to store the topic data
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
            <xs:choice minOccurs="1" maxOccurs="1">
                <xs:element ref="external_database" />
                <xs:element ref="filesystem" />
            </xs:choice>
            <xs:element ref="restore" minOccurs="0" maxOccurs="1"/>
            <xs:element name="type_object_max_serialized_length" type="xs:positiveInteger" minOccurs="0" maxOccurs="1" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="external_database">
        <xs:annotation>
            <xs:documentation>
                Database connection used to persist the topic data
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element ref="dsn" minOccurs="1" maxOccurs="1"/>
                <xs:element ref="username" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="password" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="odbc_library" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="filesystem">
        <xs:annotation>
            <xs:documentation>
                Persist data in the filesystem
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element name="directory" type="xs:string" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            The directory where the files to persist the data will be placed.
			    Default: current working directory
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="file_prefix" type="xs:string" minOccurs="0" maxOccurs="1" default="PS">
                    <xs:annotation>
                        <xs:documentation>
                            A prefix for all the files created by RTI Persistence Service.
			    Default: PS
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="synchronization" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Determines the level of synchronization of the
                            data to store with the physical disk.
                            Default: OFF.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:enumeration value="FULL">
                                <xs:annotation>
                                    <xs:documentation>
                                        Every sample is written into physical disk as
                                        RTI Persistence Service receives it
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="NORMAL">
                                <xs:annotation>
                                    <xs:documentation>
                                        Samples are written into physical disk at
                                        critical moments
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="OFF">
                                <xs:annotation>
                                    <xs:documentation>
                                        No synchronization is enforced. Data will
                                        be written to phyisical disk at the OS's
                                        discretion
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:element>
                <xs:element name="journal_mode" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Sets the journal mode.
                            Default: DELETE.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:enumeration value="DELETE">
                                <xs:annotation>
                                    <xs:documentation>
                                        The rollback journal is deleted at the conclusion
                                        of each transaction.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="TRUNCATE">
                                <xs:annotation>
                                    <xs:documentation>
                                        This mode commits transactions by truncating the
                                        rollback journal to zero-length instead of deleting it.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="PERSIST">
                                <xs:annotation>
                                    <xs:documentation>
                                        This mode prevents the rollback journal from being
                                        deleted at the end of each transaction. Instead,
                                        the header of the journal is overwritten with zeros.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="MEMORY">
                                <xs:annotation>
                                    <xs:documentation>
                                        This mode stores the rollback journal in volatile RAM.
                                        This saves disk I/O but at the expense of database
                                        safety and integrity.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="WAL">
                                <xs:annotation>
                                    <xs:documentation>
                                        The WAL journaling mode uses a write-ahead log instead
                                        of a rollback journal to implement transactions.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="OFF">
                                <xs:annotation>
                                    <xs:documentation>
                                        The OFF journaling mode disables the rollback journal
                                        completely.
                                        If the application crashes in the middle of a transaction
                                        when the OFF journaling mode is set, then the files containing
                                        the samples will very likely go corrupt.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:element>
                <xs:element name="vacuum" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Sets the auto-vacuum status of the storage.
                            Default: FULL.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:enumeration value="NONE">
                                <xs:annotation>
                                    <xs:documentation>
                                        When auto-vacuum is disabled and data is deleted from the storage files,
                                        the files remain the same size.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="FULL">
                                <xs:annotation>
                                    <xs:documentation>
                                        The storage files are compacted after every transaction.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="INCREMENTAL">
                                <xs:annotation>
                                    <xs:documentation>
                                        &lt;NOT SUPPORTED&gt;
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:element>
                <xs:element name="trace_file" type="xs:string" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Trace file for debug information.
                            Default: None
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>


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

    <xs:element name="participant">
        <xs:annotation>
            <xs:documentation>
                For each participant
                tag, RTI Persistence Service creates two
                DDS DomainParticipants on the same domain ID:
                one to subscribe to changes and one to publish changes.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="domain_id" minOccurs="0" maxOccurs="1"/>
                <xs:element name="participant_qos" type="domainParticipantQos" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>QoS for the domain participants. Default: DDS defaults.</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element ref="durable_subscriptions" minOccurs="0" maxOccurs="1"/>
                <xs:element ref="persistence_group" minOccurs="1" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="name" use="optional" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>

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

    <xs:element name="memory_management">
        <xs:annotation>
            <xs:documentation>
                Configures different aspects of the internal memory management for
                the data persisted within this persistence group
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element name="pool_sample_buffer_max_size"
                            type="nonNegativeIntegerUnlimited"
                            minOccurs="0" maxOccurs="1"/>
                <xs:element name="persistent_sample_buffer_max_size"
                            type="nonNegativeIntegerUnlimited"
                            minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>


    <!-- =================================================================== -->
    <xs:element name="durable_subscriptions">
        <xs:annotation>
            <xs:documentation>
			Durable subscriptions for a given topic.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="element" type="durableSubscription" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

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

    <xs:element name="persistence_group">
        <xs:annotation>
            <xs:documentation>
                A persistence group describes a set of topics whose data that
                must be persisted by the persistence service.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element name="filter" type="xs:string" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            A list of POSIX expressions separated by commas that describe
                            the set of topics associated with the persistence group.
                            The filter can be specified as an attribute of persistence_group
                            as well. Default: *
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="deny_filter" type="xs:string" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            A list of POSIX expressions separated by commas that describe
                            the set of topics denied in the persistence group.
                            This "black" list is applied after 'filter'.
                            Default: empty
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="content_filter"  type="xs:string" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Content filter topic expression. A persistence group can subscribe
                            to a specific set of data based on the value of this expression.
			                Default: no expression.
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="propagate_dispose" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Controls whether or not the
                            persistence service propagates dispose messages from DataWriters
                            to DataReaders. Default: true
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="propagate_unregister" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Controls whether or not the
                            persistence service propagates unregister messages from
                            DataWriters to DataReaders. Default: false
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="propagate_source_timestamp" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Controls whether or not the
                            persistence service propagates the source timestamp
                            of the received samples. Default: false
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="single_publisher" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Indicates if the persistence
                            service should create one Publisher per persistence group or one
                            Publisher per PRSTDataWriter inside the persistence group.
			    Default: true
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="single_subscriber" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Indicates if the persistence
                            service should create one Subscriber per persistence group or
                            one Subscriber per PRSTDataReader in the persistence group.
                            Default: true
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="use_durability_service" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Indicates if the HISTORY
                            and RESOURCE_LIMITS QoS policy of the PRSTDataWriters
                            and PRSTDataReaders should be configured based on the
                            DURABILITY SERVICE value of the discovered DataWriters.
                            Default: false
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="share_database_connection" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Indicates if the persistence
                            group must use a separate ODBC database connection to store
                            the topic data received by each PRSTDataReader.
                            Default: true
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="reader_checkpoint_frequency" type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
			    This property controls how often (expressed as a number of
			    samples) the PRSTDataReader state is stored in the database.
			    The PRSTDataReaders are the DDS DataReaders created by the
			    persistence service.
			    This property is only applicable when the persistence service
			    operates in persistent mode (the database_connection tag is present)
			    Default: 1
			</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="writer_in_memory_state" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
			    Determines how much state
			    will be kept in memory by the PRSTDataWriters in order to
			    avoid accessing the database.
			    The property is only applicable when the persistence service
			    operates in persistent mode (the database_connection tag is present).
			    Default: For KEEP_LAST or ResourceLimitsQosPolicy.
			    max_samples != DDS_UNLIMITED_LENGTH, the default is true.
			    Otherwise, the default is false
			</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="writer_checkpoint_period" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        This property controls how often (expressed as a number of
                        milliseconds) transactions are comitted for a PRSTDataWriter.
                        Default: 0
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="writer_checkpoint_volume" type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        This property controls how often (expressed as a number of
                        samples) transactions are comitted for a PRSTDataWriter.
                        Default: 1
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="writer_ack_period" type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        This property controls how often (expressed as a number of
                        milliseconds) samples are marked as acked in the database by
                        the PRSTDataWriter.
                        Default: 0
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="late_joiner_read_batch" type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        Defines how many samples will be pre-fetched by a PRSTDataWriter to satisfy late joiner requests.
                        Default: 20000
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="allow_durable_subscriptions" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        This property is used to enable support for durable subscriptions in the PRSTDataWriters.
                        When durable subscriptions are not required setting this property to false will
                        increase performance.

                        Default: true
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="use_wait_set" type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        Indicates if the persistence service will use waitsets or listeners
                        to read data from the PRSTDataReaders.

                        Default: false
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element ref="memory_management" minOccurs="0" maxOccurs="1" />
                <xs:element ref="sample_logging" minOccurs="0" maxOccurs="1"/>
                <xs:element name="topic_qos" type="topicQos" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation></xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="publisher_qos" type="publisherQos" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>QoS for the Publishers</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="subscriber_qos" type="subscriberQos" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>QoS for the Subscribers</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="datawriter_qos" type="dataWriterQos" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>QoS for the DataWriters</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="datareader_qos" type="dataReaderQos" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>QoS for the DataReaders</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:all>
            <xs:attribute name="name" use="optional" type="xs:NCName"/>
        </xs:complexType>
    </xs:element>


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


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

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

    <xs:element name="dsn" type="xs:string">
        <xs:annotation>
            <xs:documentation>
                DSN used to connect to the database using ODBC. You should
                create this DSN through the ODBC settings on Windows systems,
                or in your .odbc.ini file on UNIX/Linux systems.
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="username" type="xs:string">
        <xs:annotation>
            <xs:documentation>
                Username for the data base connection.
		Default: no user name
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="password" type="xs:string">
        <xs:annotation>
            <xs:documentation>
                Password for the data base connection.
		Default: no password
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="restore" type="xs:boolean">
        <xs:annotation>
            <xs:documentation>
                indicates if the topic data
                associated with a previous execution of the persistence service
                must be restored or not. If the topic data is not restored, it will be
                deleted from the database. Default: true
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="odbc_library" type="xs:string">
        <xs:annotation>
            <xs:documentation>
                Specifies the ODBC driver to load. By default, RTI Connext
                will try to use the standard ODBC driver manager
                library (UnixOdbc on UNIX/Linux systems, the Windows
                ODBC driver manager on Windows systems).
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="domain_id">
        <xs:annotation>
            <xs:documentation>
                Domain ID associated with the Participant. Default: 0
            </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="profile_name">
        <xs:annotation>
            <xs:documentation>
                This column specifies the name of the QoS Profile that RTI Real-Time Connect 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="synchronization">
        <xs:annotation>
            <xs:documentation>
                Indicates if redundant persistence
                service instances should synchronize their states with
                one another.
                Default: NO synchronization
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="synchronize_data"  type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            When set to true, data messages lost on the way to one service
                            instance can be repaired by another without impacting the original
                            publisher of that message.

                            Default: false
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="synchronize_durable_subscription"  type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            When set to true, durable subscriptions and their state will be
                            synchronized across the different instances of persistence service.

                            Default: false
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="durable_subscription_synchronization_period" type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        This property controls how often (expressed as a number of
                        milliseconds) the state of a durable subscription is synchronized
                        with other persistence services.

                        Default: 5000
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="purge_samples_after_acknowledgment" type="xs:boolean">
        <xs:annotation>
            <xs:documentation>
            Indicates if persistence service must purge samples after they
            are acknowledged.

            When persistence service runs with this flag set to true, samples
            are removed from the PRSTDataWriters' queues as soon as they are
            acknowledged by all of the live DataReaders and all of the durable
            subscriptions.

            When persistence service runs with this flag set to false, the
            local durability of the PRSTDataWriters is configured to be
            TRANSIENT_LOCAL. Acknowledged samples are kept in the
            PRSTDataWriters' queues until new resources are needed.

            Default: false
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:element name="sample_logging">
        <xs:annotation>
            <xs:documentation>
                This tag can be used to enable and configure a sample log for
                the PRSTDataWriters in a persistence group.
                A sample log is a buffer of samples on disk that,
                when used in combination with delegated reliability,
                allows decoupling the original DataWriters from slow DataReaders.

                Default: NO sample logging
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element name="enable"  type="xs:boolean" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        Indicates whether or not sample logging is enabled.

                        Default: 0
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="log_read_batch"  type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        Determines how many samples should be read and processed at once by the sample
                        log write thread.

                        Default: 100
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="log_file_size"  type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the maximum size of a sample log file in Mbytes. When a log file becomes full,
                        persistence service creates a new log file.

                        Default: 60 MB
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="log_flush_period"  type="xs:positiveInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                          The period (in milliseconds) at which persistence service removes sample
                          log files whose full content have been written into the
                          PRSTDataWriter by the sample log write thread.

                          Default: 10000 millisec
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="log_bookmark_period" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                        This tag indicates how often (in milliseconds) the read bookmark is persisted into disk.

                        Default: 1000 millisec
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="durableSubscription">
        <xs:annotation>
            <xs:documentation>
                Describes a durable subscription.
            </xs:documentation>
        </xs:annotation>
        <xs:all>
            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
            <xs:element name="quorum_count" type="xs:positiveInteger" minOccurs="0" maxOccurs="1"/>
            <xs:element name="topic_name" type="xs:string" minOccurs="1" maxOccurs="1"/>
        </xs:all>
    </xs:complexType>

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

    <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:schema>
