<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  ~  Licensed to the Apache Software Foundation (ASF) under one
  ~  or more contributor license agreements.  See the NOTICE file
  ~  distributed with this work for additional information
  ~  regarding copyright ownership.  The ASF licenses this file
  ~  to you under the Apache License, Version 2.0 (the
  ~  "License"); you may not use this file except in compliance
  ~  with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing,
  ~  software distributed under the License is distributed on an
  ~   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~  KIND, either express or implied.  See the License for the
  ~  specific language governing permissions and limitations
  ~  under the License.
  -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
           targetNamespace="http://ws.apache.org/ns/synapse"
           xmlns="http://ws.apache.org/ns/synapse"
           xmlns:wsdl11="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl20="http://www.w3.org/ns/wsdl">

    <xs:import namespace="http://schemas.xmlsoap.org/wsdl/" schemaLocation="wsdl11.xsd"/>
    <xs:import namespace="http://www.w3.org/ns/wsdl" schemaLocation="wsdl20.xsd"/>

    <xs:element name="resource">
        <xs:annotation>
            <xs:documentation source="description">
                Resources like XSDs to be provided to the WSDL and so forth
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="location" type="xs:anyURI" use="required"/>
            <xs:attribute name="key" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="parameter">
        <xs:annotation>
            <xs:documentation source="description">
                These are the parameters for various elements in the Synapse Configuration,
                for example, for proxy services, for registry nad so forth
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:complexContent mixed="true">
                <xs:extension base="xs:anyType">
                    <xs:attribute name="name" type="xs:string" use="required"/>
                    <xs:attribute name="key" type="xs:string" use="optional"/>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="feature">
        <xs:annotation>
            <xs:documentation source="description">
                This is a feature, with a name value pair as its configuration
                and mainly used in the validate mediator
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:boolean" use="required" default="true"/>
        </xs:complexType>
    </xs:element>

    <xs:group name="inlineWsdl">
        <xs:choice>
            <xs:element ref="wsdl11:definitions" minOccurs="0" maxOccurs="1"/>
            <xs:element ref="wsdl20:description" minOccurs="0" maxOccurs="1"/>
        </xs:choice>
    </xs:group>
    
    <xs:attributeGroup name="monitoringAspect">
        <xs:annotation>
            <xs:documentation source="description">
                This group of attributes represents the statistics and tracing of sequences,
                proxy services and endpoints
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="statistics" default="disabled" type="enableDisable" use="optional"/>
        <xs:attribute name="trace" default="disabled" type="enableDisable" use="optional"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="nameValueOrExpression">
        <xs:annotation>
            <xs:documentation>
                This group of attributes are mainly used in header and property mediators
                to provide the name value or expression pairs as its configuration
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="action" type="setRemove" use="optional"/>
        <xs:attributeGroup ref="valueOrExpression"/>
    </xs:attributeGroup>

    <xs:attributeGroup name="valueOrExpression">
        <xs:annotation>
            <xs:documentation>
                This group of attributes are mainly used in places where the value can be
                statically specified or dynamically evaluated over the given xpath
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="value" type="xs:string" use="optional"/>
        <xs:attribute name="expression" type="xs:string" use="optional"/>
    </xs:attributeGroup>

    <xs:complexType name="mediatorProperty">
        <xs:annotation>
            <xs:documentation source="description">
                These are the properties which could be name value pairs or could be
                xpath expression extracting the property value by evaluating over
                the message
            </xs:documentation>
        </xs:annotation>
        <xs:complexContent mixed="true">
            <xs:extension base="xs:anyType">
                <xs:attribute name="name" type="xs:string" use="required"/>
                <xs:attributeGroup ref="valueOrExpression"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:simpleType name="enableDisable">
        <xs:annotation>
            <xs:documentation source="description">
                This simple type represents the possible values for the statistics and tracing
                attributes
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="enable"/>
            <xs:enumeration value="disable"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="setRemove">
        <xs:annotation>
            <xs:documentation source="description">
                This simple type represents the possible values for
                the header mediator action attribute
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="set"/>
            <xs:enumeration value="remove"/>
        </xs:restriction>
    </xs:simpleType>

</xs:schema>