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

<xsd:schema
     targetNamespace="http://xmlns.oracle.com/weblogic/deployment-plan"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:wls="http://xmlns.oracle.com/weblogic/deployment-plan"
     xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
     elementFormDefault="qualified"
     attributeFormDefault="unqualified"
     version="1.0">
    <xsd:annotation>
      <xsd:documentation>
        Deployment plan documents  can be associated with any application that is deployed 
        to the  WebLogic Server. It incorporates  server  specific 
        deployment information as required by JSR-88 as well as the application configuration 
        attributes that need to be resolved for each WebLogic environment to which that 
        application is deployed to. Additionally, it can contain references to custom module descriptors.

      </xsd:documentation>
    </xsd:annotation>
  <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:annotation>
        <xsd:documentation>
          description: A textual description of the plan document
          application-name: A name associated with the application. This value may be used as the application''s
            deployed name if not provided through deployment options.
          version: The plan''s version. This will also be incorporated into the deployed application''s
            name.
          variable-definition: A list of variable name/value pairs used to override descriptor element values.
          module-override: Each module defined in the application may be represented with a module-override.
          config-root: Location of the external descriptors associated with the plan. The value is used
            to establish the AppDeploymentMBean.PlanDir property for deployed applications. 
          global-variables: When construction variables for the plan, the variable name may be made unique or not
            depending on the value of this attribute. If true a variable may match multiple
            properties in the application descriptors.   
        </xsd:documentation>
      </xsd:annotation>
      <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>

<xsd:complexType name="variableType">
      <xsd:annotation>
        <xsd:documentation>
          Defines a variable to be used to override descriptor properties.
          name: the variable name
          value: the variables assigned value. For array values, the individual values are 
            specified as: ""val1"",""val2""
          description: A description of the variable.
        </xsd:documentation>
      </xsd:annotation>
  <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>

<xsd:complexType name="variable-assignmentType">
      <xsd:annotation>
        <xsd:documentation>
          Defines an override of the specific property
          description: A description of the override.
          name: the variable name. This must match some variable-definition element
          xpath: An xpath expression that references the specific element in the descriptor
                 to be overridden  with the variable''s value. 
                 To override the jndi-name for a referenced ejb named myejb use,
                     weblogic-web-app/ejb-ref/[ejb-ref-name="myejb"]/jndi-name 
        origin: A marker for child beans in order to remove the bean. 
          operation: For array properties specifies whether the variable''s value should be added
                 to, removed from, or replaced by the variable''s values. The default is to replace. 

        </xsd:documentation>
      </xsd:annotation>
  <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="origin"
		  type="xsd:string"
		   default="external"
		    minOccurs="0"/>
     <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:annotation>
        <xsd:documentation>
          Describes a module and its descriptors in the application
          module-name: the module name. This must match the module name in the application''s
                root module descriptors, eg application.xml. For the root module this must match
                the application file name.
          module-type: A recognized module type. eg ear, war, ejb, rar, car, jms and jdbc
        </xsd:documentation>
      </xsd:annotation>
  <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:annotation>
        <xsd:documentation>
          Describes a module  descriptor in the application.
          root-element: The root element name of the descriptor
          uri: The path, relative to the application root of the descriptor
          variable-assignment: descriptor overrides for this descriptor
          hash-code: A value updated whenever this element is updated programmatically.
             Can be used to determine if the descriptor has beed updated since last deployed.
          external: Indicates whether the descriptor resides in the archive (external==false)
        </xsd:documentation>
      </xsd:annotation>
  <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>

