<?xml version="1.0" encoding="UTF-8"?>
<!--
// File name   :
// Description : schema definition for domain management
//
// Author :
// Version:
// Date:
//
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.objectweb.org/jonas/ns"
           xmlns="http://www.w3.org/2001/XMLSchema"
           xmlns:jonas="http://www.objectweb.org/jonas/ns"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           version="5.1">


     <xsd:annotation>
    <xsd:documentation>
      @(#)jonas-domain_5_1.xsd  26/08/09
    </xsd:documentation>
  </xsd:annotation>
  <xsd:annotation>
    <xsd:documentation>
      <![CDATA[
      JOnAS: Java(TM) Open Application Server
      Copyright (C) 2009 Bull S.A.S
      Contact: jonas-team@ow2.org

      This library is free software; you can redistribute it and/or
      modify it under the terms of the GNU Lesser General Public
      License as published by the Free Software Foundation; either
      version 2.1 of the License, or any later version.

      This library is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Lesser General Public License for more details.

      You should have received a copy of the GNU Lesser General Public
      License along with this library; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
      USA

      Initial Author : Stephane Zeng Eyindanga
      ]]>
   </xsd:documentation>
  </xsd:annotation>
<!-- ======================================================================= -->
<!--                        Server description                               -->
<!-- ======================================================================= -->


  <xsd:simpleType name ="ServerStateType">
    <xsd:annotation>
      <xsd:documentation>The state of a server.</xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="up"/>
      <xsd:enumeration value="down"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="LocationType">
    <xsd:annotation>
      <xsd:documentation>URL addresses of JMX RI server connectors</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="url" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ServerType">
    <xsd:annotation>
      <xsd:documentation></xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <!-- Description [optional] -->
      <xsd:element name="description" type="xsd:string" minOccurs="0"/>
      <xsd:element name="location" type="jonas:LocationType" minOccurs="0"/>
      <!-- User name and password to use when connecting [optional] -->
      <xsd:element name="username" type="xsd:string" minOccurs="0"/>
      <xsd:element name="password" type="xsd:string" minOccurs="0"/>
      <xsd:element name="state" type="jonas:ServerStateType" minOccurs="0"/>
      <xsd:element name="cluster-daemon" type="xsd:string" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>

    <xsd:complexType name="ClusterDaemonType">
    <xsd:annotation>
      <xsd:documentation></xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <!-- Description [optional] -->
      <xsd:element name="description" type="xsd:string" minOccurs="0"/>
      <xsd:element name="location" type="jonas:LocationType" minOccurs="0"/>
      <!-- User name and password to use when connecting [optional] -->
      <xsd:element name="username" type="xsd:string" minOccurs="0"/>
      <xsd:element name="password" type="xsd:string" minOccurs="0"/>
      <xsd:element name="state" type="jonas:ServerStateType" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>

<!-- ======================================================================= -->
<!--                        Cluster description                               -->
<!-- ======================================================================= -->
  <xsd:complexType name="ClusterType">
    <xsd:annotation>
      <xsd:documentation>
         A cluster is  named list of servers. The list is ordered and may be empty.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <!-- Name -->
      <xsd:element name="name" type="xsd:string"/>
      <!-- Description [optional] -->
      <xsd:element name="description" type="xsd:string" minOccurs="0"/>
      <!-- A cluster is an ordered list of servers. The list may be empty. -->
      <xsd:element name="server" type="jonas:ServerType" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="cluster" type ="jonas:ClusterType" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

<!-- ======================================================================= -->
<!--                        Domain description                           -->
<!-- ======================================================================= -->
  <xsd:complexType name="DomainType">
    <xsd:annotation>
      <xsd:documentation>
        A domain is characterized by a name and an optional description.
        Each domain contains an ordered list of clusters and servers.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <!-- Description [optional] -->
      <xsd:element name="description" type="xsd:string" minOccurs="0"/>
      <!-- Default user name and password to use when connecting [optional] -->
      <xsd:element name="username" type="xsd:string" minOccurs="0"/>
      <xsd:element name="password" type="xsd:string" minOccurs="0"/>
      <!-- A domain is an ordered list of items. The domain list may be empty. -->
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <!-- Each domain item can be either a cluster... -->
  <xsd:element name="cluster" type="jonas:ClusterType">
    <xsd:annotation>
      <xsd:documentation>If element is present then item is a cluster</xsd:documentation>
    </xsd:annotation>
        </xsd:element>
        <!-- ...or a server -->
  <xsd:element name="server" type="jonas:ServerType">
    <xsd:annotation>
      <xsd:documentation>If element is present then item is a server</xsd:documentation>
    </xsd:annotation>
    </xsd:element>
        <!-- ...or a cluster-daemon -->
  <xsd:element name="cluster-daemon" type="jonas:ClusterDaemonType">
    <xsd:annotation>
      <xsd:documentation>If element is present then item is a cluster daemon</xsd:documentation>
    </xsd:annotation>
    </xsd:element>

      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>

<!-- ======================================================================= -->
<!--                        Root node 'domain'                            -->
<!-- ======================================================================= -->

  <xsd:element name="domain" type="jonas:DomainType"/>

</xsd:schema>
