<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2007-2012 EBM WebSourcing, 2012-2015 Linagora

 This program/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 (at your
 option) any later version.

 This program/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 program/library; If not, see <http://www.gnu.org/licenses/>
 for the GNU Lesser General Public License version 2.1.
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://petals.ow2.org/topology"
	xmlns:tns="http://petals.ow2.org/topology" elementFormDefault="qualified">
	<complexType name="Topology">
		<sequence>
			<element name="domain" type="tns:Domain" minOccurs="1"
				maxOccurs="1">
				<annotation>
					<documentation>
						A PEtALS domain. Each member share its data and
						communicate with other members.
					</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="Domain">
		<sequence>
			<element name="description" type="string" default="description of this domain"
				maxOccurs="1" minOccurs="0" />
			<element name="jndi" type="tns:Jndi" maxOccurs="1" minOccurs="0">
				<annotation>
					<documentation>
						The JNDI directory shared among the PEtALS
						domain. If
						not declared, the internal PEtALS
						JNDI directory is used. If you
						want to connect
						the PEtALS domain to an external JNDI directory,
						specify the the JNDI parameters. Refer to JNDI
						specifications for
						more details.
					</documentation>
				</annotation>
			</element>
            <element name="registry-implementation" type="string" minOccurs="0" maxOccurs="1">
               <annotation>
                  <documentation>
                     Define the registry implementation to use on the
                     domain. If no value is set, the registry implementation is
                     selected from the classloader. This property aims to select a registry
                     implementation when several are available on the classloader.
                  </documentation>
               </annotation>
            </element>
            <element name="container" type="tns:Container" maxOccurs="unbounded"
               minOccurs="1">
               <annotation>
                  <documentation>
                     Define a PEtALS node. It contains the definition
                     of security, management and communication
                     resources.
                  </documentation>
               </annotation>
            </element>
            <any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/>
		</sequence>
		<attribute name="name" type="string" use="required" />
        <attribute name="mode" type="tns:DomainMode" use="required" />
	</complexType>

	<complexType name="Jndi">
		<all>
			<element name="factory" type="string" maxOccurs="1"
				minOccurs="1"
				default="org.objectweb.petals.communication.jndi.connection.NamingContextFactory" />
			<element name="provider-url" type="string" maxOccurs="1"
				minOccurs="1" />
			<element name="security-principal" type="string" maxOccurs="1"
				minOccurs="0" />
			<element name="security-credentials" type="string" maxOccurs="1"
				minOccurs="0" />
			<element name="pool-size" type="int" maxOccurs="1" minOccurs="0" />
			<element name="batch-size" type="int" maxOccurs="1"
				minOccurs="0" />
		</all>
	</complexType>

	<simpleType name="DomainMode">
      <annotation>
			<documentation>
				Several domain modes are available.
				The 'static' domain accepts only the nodes defined in the domain
				part of the topology. Each node of the domain must have the same
				topology definition.
				The 'dynamic' domain is an evolution of the 'static' domain in
				which nodes can be attached or detached without requiring a restart of
				all domain nodes.
			</documentation>
      </annotation>
      <restriction base="string">
         <enumeration value="static" />
         <enumeration value="dynamic" />
      </restriction>
   </simpleType>

	<complexType name="Container">
		<all>
			<element name="description" type="string" default="description of this domain"
				maxOccurs="1" minOccurs="0" />
			<element name="host" type="string" maxOccurs="1" minOccurs="1"
				default="localhost">
				<annotation>
					<documentation>
						Define the IP address or host name of the container.
					</documentation>
				</annotation>
			</element>
			<element name="user" type="string" maxOccurs="1" minOccurs="0">
				<annotation>
					<documentation>
						Define the user to be used for JMX clients.
					</documentation>
				</annotation>
			</element>
			<element name="password" type="string" maxOccurs="1"
				minOccurs="0">
				<annotation>
					<documentation>
						Define the password to be used for JMX clients.
					</documentation>
				</annotation>
			</element>
			<element name="jmx-service" type="tns:JmxService" maxOccurs="1"
				minOccurs="1">
				<annotation>
					<documentation>
						Define the JMX required ports.
					</documentation>
				</annotation>
			</element>
			<element name="transport-service" type="tns:TransportService"
				maxOccurs="1" minOccurs="0">
			   <annotation>
					<documentation>
						Define the Transport required port. Do not declare
						this tag over a standalone topology (ie.containing only one node).
					</documentation>
				</annotation>
			</element>
		</all>
		<attribute name="name" type="string" use="required" />
	</complexType>
	<complexType name="JmxService">
		<all>
			<element name="rmi-port" type="int" maxOccurs="1" minOccurs="1" />
		</all>
	</complexType>
	<complexType name="TransportService">
		<sequence>
			<element name="tcp-port" type="int" maxOccurs="1" minOccurs="1" />
			<!--element name="ssl-port" type="int" maxOccurs="1" minOccurs="0" / -->
			<!--element name="http-port" type="int" maxOccurs="1" minOccurs="0" / -->
		</sequence>
	</complexType>

	<element name="topology" type="tns:Topology">
		<annotation>
			<documentation>
				The PEtALS topology. It contains information about the
				resources and configurations required by your PEtALS
				nodes. PEtALS
				node local setting are defined independently
				in the file
				'server.properties'
			</documentation>
		</annotation>
	</element>
</schema>