<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema
     targetNamespace="http://www.bea.com/ns/weblogic/90"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:wls="http://www.bea.com/ns/weblogic/90"
     xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
     elementFormDefault="qualified"
     attributeFormDefault="unqualified"
     version="1.0">
  <xsd:import namespace="http://java.sun.com/xml/ns/j2ee"
             schemaLocation="http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd" />

  
<xsd:element name="deployment-plan" type="wls:deployment-planType"/>

<xsd:complexType name="deployment-planType">
    <xsd:sequence>
      <xsd:element name="description"
                   type="xsd:string"
                   minOccurs="0"
                   nillable="true"/>
      <xsd:element name="application-name"
                   type="xsd:string"/>
      <xsd:element name="version"
                   type="xsd:string"
                   minOccurs="0"/>
      <xsd:element name="variable-definition"
                   type="wls:variable-definitionType"
                   minOccurs="0" />
      <xsd:element name="module-override"
                   type="wls:module-overrideType"
                   minOccurs="0"
                   maxOccurs="unbounded"/>
      <xsd:element name="config-root"
                   type="xsd:string"
                   nillable="true"
                   minOccurs="0"/>

    </xsd:sequence>
    <xsd:attribute name="global-variables"
                   type="xsd:boolean"
                   use="optional"
                   default="false"/>
</xsd:complexType>


<xsd:complexType name="variable-definitionType">
  <xsd:sequence>
     <xsd:element name="variable"
                  type="wls:variableType"
                  minOccurs="0" 
                  maxOccurs="unbounded"/>
  </xsd:sequence>
</xsd:complexType>

<!--
A single variable definition
-->
<xsd:complexType name="variableType">
  <xsd:sequence>
    <xsd:element name="name"
                 type="xsd:string"/>
    <xsd:element name="value"
                 type="xsd:string"
                 minOccurs="0"
		 nillable="true"/>
    <xsd:element name="description"
                 type="xsd:string"
                 minOccurs="0"/>
  </xsd:sequence>
</xsd:complexType>

<!--
Each variable assignment has the following elements:

name: identifies the variable.
xpath: valid xpaths into the descriptor identified by the uri. The xpaths may resolve to multiple elements.
description: an optional description.
-->
<xsd:complexType name="variable-assignmentType">
  <xsd:sequence>
     <xsd:element name="description"
                  type="xsd:string"
                  minOccurs="0"/>
     <xsd:element name="name"
                  type="xsd:string"/>
     <xsd:element name="xpath"
                  type="j2ee:pathType"/>
     <xsd:element name="operation" default="add" minOccurs="0">
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">
            <xsd:enumeration value="add"/>
            <xsd:enumeration value="remove"/>
            <xsd:enumeration value="replace"/>
          </xsd:restriction>
        </xsd:simpleType>
     </xsd:element>
  </xsd:sequence>
</xsd:complexType>


<xsd:complexType name="module-overrideType">
  <xsd:sequence>
    <xsd:element name="module-name"
                 type="xsd:string"/> 
    <xsd:element name="module-type"
                 type="xsd:string"/> 
    <xsd:element name="module-descriptor"
                 type="wls:module-descriptorType"
                 minOccurs="0"
                 maxOccurs="unbounded"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="module-descriptorType">
  <xsd:sequence>
    <xsd:element name="root-element"
                 type="xsd:string"/> 
    <xsd:element name="uri"
                 type="j2ee:pathType"/> 
    <xsd:element name="variable-assignment"
                 type="wls:variable-assignmentType"
                 minOccurs="0"
                 maxOccurs="unbounded"/>
    <xsd:element name="hash-code"
                 type="xsd:string"
                 minOccurs="0"/> 
  </xsd:sequence>
  <xsd:attribute name="external"
                 type="xsd:boolean"
                 use="optional"
                 default="false"/>
</xsd:complexType>

</xsd:schema>

