<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
  targetNamespace="http://easybeans.ow2.org/xml/ns/xmlconfig"
  xmlns="http://www.w3.org/2001/XMLSchema"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xmlconfig="http://easybeans.ow2.org/xml/ns/xmlconfig"
  elementFormDefault="qualified"
  attributeFormDefault="unqualified"
  version="1.0">
  <xsd:annotation>
    <xsd:documentation>@(#)xmlconfig-mapping_1_0.xsd 2008/02/25</xsd:documentation>
  </xsd:annotation>
  <xsd:annotation>
    <xsd:documentation>
      <![CDATA[
       EasyBeans
       Copyright (C) 2008 Bull S.A.S.
       Contact: easybeans@objectweb.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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

       $Id: pom.xml 2377 2008-02-11 10:03:52Z benoitf $

       Author: Florent Benoit
   ]]>
    </xsd:documentation>
  </xsd:annotation>

  <xsd:annotation>
    <xsd:documentation>
      <![CDATA[
      This is XML Schema for XmlConfig mapping information.
      The xml file should contains the following namespace:

      http://easybeans.ow2.org/xml/ns/xmlconfig

      and by indicating the version of the schema by
      using the version element as shown below:


      <xmlconfig-mapping xmlns="http://easybeans.ow2.org/xml/ns/xmlconfig"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="http://easybeans.ow2.org/xml/ns/xmlconfig
                                             http://easybeans.ow2.org/xml/ns/xmlconfig/xmlconfig-mapping_1_0.xsd">
      ...
      </xmlconfig-mapping>

      The instance documents may indicate the published version of
      the schema using the xsi:schemaLocation attribute for the
      XmlConfig namespace with the following location:

      http://easybeans.ow2.org/xml/ns/xmlconfig/xmlconfig-mapping_1_0.xsd
      ]]>
    </xsd:documentation>
  </xsd:annotation>

  <!-- **************************************************** -->

  <xsd:element
    name="xmlconfig-mapping"
    type="xmlconfig:xmlconfig-mappingType">
    <xsd:annotation>
      <xsd:documentation>
        This is the root element of the XmlConfig mapping xml file.
      </xsd:documentation>
    </xsd:annotation>
  </xsd:element>

  <!-- **************************************************** -->

  <xsd:complexType name="xmlconfig-mappingType">
    <xsd:annotation>
      <xsd:documentation>
        The xmlconfig-mapping element is the root element of an XmlConfig mapping descriptor.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:choice
      minOccurs="0"
      maxOccurs="unbounded">
      <xsd:element
        name="package"
        minOccurs="0"
        maxOccurs="unbounded"
        type="xmlconfig:xmlconfig-packageType" />

      <xsd:element
        name="class"
        minOccurs="0"
        maxOccurs="unbounded"
        type="xmlconfig:xmlconfig-classType" />
    </xsd:choice>
  </xsd:complexType>

  <!-- **************************************************** -->

  <xsd:complexType name="xmlconfig-packageType">
    <xsd:annotation>
      <xsd:documentation>Defines the mapping for a given package.</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element
        name="class"
        type="xmlconfig:xmlconfig-classType"
        minOccurs="0"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            Definition of a mapping for a given class that is part of the selected package.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute
      name="name"
      type="xsd:string"
      use="required">
      <xsd:annotation>
        <xsd:documentation>Defines the name of the package</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <!-- **************************************************** -->

  <xsd:complexType name="xmlconfig-classType">
    <xsd:annotation>
      <xsd:documentation>
        Defines the mapping for a given class and all its attributes.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element
        name="aliases"
        type="xmlconfig:xmlconfig-aliasesType"
        minOccurs="0"
        maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            Definition of aliases for this class.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element
        name="attribute"
        type="xmlconfig:xmlconfig-attributeType"
        minOccurs="0"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            Definition of a mapping for an attribute of the selected class.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute
      name="name"
      type="xsd:string"
      use="required">
      <xsd:annotation>
        <xsd:documentation>Defines the name of the class</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="alias"
      type="xsd:string">
      <xsd:annotation>
        <xsd:documentation>Defines the alias of the class. This alias can be used inside the xml to reference the class to instantiate. For example a class with an alias 'dummy' can be placed in the xml as this: &lt;dummy&gt; and it will create an instance of the selected class.</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="element-attribute"
      type="xsd:string">
      <xsd:annotation>
        <xsd:documentation>The text/content of an element will be set to the selected class by setting the given attribute. For example, if there is an element &lt;dummy&gt;My Dummy Sentence&lt;/dummy&gt; and that there is an element-attribute with the value 'name', there will be a call to set the name on the given class (like setName("My Dummy Sentence")).</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <!-- **************************************************** -->

  <xsd:complexType name="xmlconfig-attributeType">
    <xsd:annotation>
      <xsd:documentation>Defines the mapping for a given attribute.</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element
        name="aliases"
        type="xmlconfig:xmlconfig-aliasesType"
        minOccurs="0"
        maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            Definition of aliases for this attribute.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute
      name="name"
      type="xsd:string"
      use="required">
      <xsd:annotation>
        <xsd:documentation>Defines the name of this attribute</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="alias"
      type="xsd:string">
      <xsd:annotation>
        <xsd:documentation>Defines the alias of the attribute. This alias can be used inside the xml to reference the attribute to set. If the attribute in the class is named username, &lt;username&gt; needs to be present in the xml file. With an alias, the name to put in the xml is the name of the alias.</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="element"
      type="xsd:boolean">
      <xsd:annotation>
        <xsd:documentation>If this flag is enabled, this means that in the xml, the value of the attribute will be defined by using an XML element.</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="isList"
      type="xsd:boolean">
      <xsd:annotation>
        <xsd:documentation>If this flag is enabled, this means that the given attribute will be used as a list. There are some auto-detect algorithm but this is to enforced the rule.</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="optional"
      type="xsd:boolean">
      <xsd:annotation>
        <xsd:documentation>If this flag is enabled, this means that the given attribute will declared as optional. So if the requested value is not found, it will not be injected .</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="getter"
      type="xsd:string">
      <xsd:annotation>
        <xsd:documentation>Defines the name of the getter to get the value of the attribute on the selected class.</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute
      name="setter"
      type="xsd:string">
      <xsd:annotation>
        <xsd:documentation>Defines the name of the setter to set the value of the attribute on the selected class.</xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <!-- **************************************************** -->

  <xsd:complexType name="xmlconfig-aliasesType">
    <xsd:annotation>
      <xsd:documentation>Allows to define aliases.</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
      <xsd:element
        name="alias"
        type="xmlconfig:xmlconfig-aliasType"
        minOccurs="1"
        maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            Definition of an alias.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <!-- **************************************************** -->

  <xsd:complexType name="xmlconfig-aliasType">
    <xsd:annotation>
      <xsd:documentation>Allows to define an alias.</xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:extension base="xsd:string"/>
    </xsd:simpleContent>
  </xsd:complexType>
</xsd:schema>
