<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="OdxJDBCIR" targetNamespace="OdxJDBCIR"
           elementFormDefault="qualified" version="10000">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Omnidex JDBC Intelligent Router Configuration schema definition
      Copyright 2007 Dynamic Information Systems Corporation.  All rights reserved.
    </xs:documentation>
  </xs:annotation>
  <!--

Omnidex JDBC Intelligent Router Configuration
=============================================

  config

    global
      connectionPooling of connectionPoolingType

    servers
      server
        name
        description
        jdbcDriver
        connectionString
        connectionPooling of connectionPoolingType

    rules
      rule
        name
        description
        type <REGEXP | JAVA | DEFAULTSERVER>
        defaultServer
        conditions
          condition
            regexp
            java
        className
        server
        ontimeoutRule
        onerrorRule
      initialRule


connectionPoolingType
  maxActive
  whenExhaustedAction <BLOCK | FAIL | GROW>
  maxWait
  maxIdle



-->
  <xs:element name="config" type="configType" />

  <!-- ************** -->
  <!-- *** config *** -->
  <!-- ************** -->
  <xs:complexType name="configType">
    <xs:all>
      <xs:element name="global" type="globalType" minOccurs="0" maxOccurs="1" />
      <xs:element name="servers" type="serversType" minOccurs="1" maxOccurs="1" />
      <xs:element name="rules" type="rulesType" minOccurs="1" maxOccurs="1" />
    </xs:all>
  </xs:complexType>

  <!-- ************** -->
  <!-- *** global *** -->
  <!-- ************** -->
  <xs:complexType name="globalType">
    <xs:all>
      <xs:element name="connectionPooling" type="connectionPoolingType" minOccurs="0" maxOccurs="1" />
    </xs:all>
  </xs:complexType>

  <!-- *************** -->
  <!-- *** servers *** -->
  <!-- *************** -->
  <xs:complexType name="serversType">
    <xs:sequence>
      <xs:element name="server" minOccurs="1" maxOccurs="unbounded" >
        <xs:complexType>
          <xs:all>
            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="jdbcDriver" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="connectionString" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="connectionPooling" type="connectionPoolingType" minOccurs="0" maxOccurs="1" />
          </xs:all>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <!-- ************* -->
  <!-- *** rules *** -->
  <!-- ************* -->
  <xs:complexType name="rulesType">
    <xs:sequence>
      <xs:element name="rule" minOccurs="1" maxOccurs="unbounded" >
        <xs:complexType>
          <xs:all>
            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="type" type="ruleTypeType" minOccurs="1" maxOccurs="1" />
            <xs:element name="defaultServer" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="className" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="conditions" type="conditionsType" minOccurs="0" maxOccurs="1" />
            <xs:element name="onErrorRule" type="xs:token" minOccurs="0" maxOccurs="1" />
            <xs:element name="onTimeoutRule" type="xs:token" minOccurs="0" maxOccurs="1" />
          </xs:all>
        </xs:complexType>
      </xs:element>
      <xs:element name="defaultRule" type="xs:string" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>

  <!-- ****************** -->
  <!-- *** conditions *** -->
  <!-- ****************** -->
  <xs:complexType name="conditionsType">
    <xs:sequence>
      <xs:element name="condition" minOccurs="1" maxOccurs="unbounded" >
        <xs:complexType>
          <xs:all>
            <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="regexp" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="server" type="xs:string" minOccurs="1" maxOccurs="1" />
          </xs:all>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <!-- ************************* -->
  <!-- *** connectionPooling *** -->
  <!-- ************************* -->
  <xs:complexType name="connectionPoolingType">
    <xs:all>
      <xs:element name="maxActive" type="xs:int" minOccurs="0" maxOccurs="1" />
      <xs:element name="whenExhaustedAction" type="whenExhaustedActionType" minOccurs="0" maxOccurs="1" />
      <xs:element name="maxWait" type="xs:long" minOccurs="0" maxOccurs="1" />
      <xs:element name="maxIdle" type="xs:int" minOccurs="0" maxOccurs="1" />
    </xs:all>
  </xs:complexType>

  <!-- ******************** -->
  <!-- *** SIMPLE TYPES *** -->
  <!-- ******************** -->
  <!-- *** whenExhaustedActionType *** -->
  <xs:simpleType name="whenExhaustedActionType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="BLOCK" />
      <xs:enumeration value="FAIL" />
      <xs:enumeration value="GROW" />
    </xs:restriction>
  </xs:simpleType>
  <!-- *** ruleTypeType *** -->
  <xs:simpleType name="ruleTypeType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="REGEXP" />
      <xs:enumeration value="JAVA" />
      <xs:enumeration value="DEFAULTSERVER" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
