<?xml version="1.0" encoding="UTF-8"?>
<!--
  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" 
  xmlns:jms="http://cxf.apache.org/transports/jms" 
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
  targetNamespace="http://cxf.apache.org/transports/jms" 
  elementFormDefault="qualified" jaxb:version="2.0">
  
    <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
        schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd"/>
    
    <!-- Valid wsdl elements -->
    <xs:element name="client" type="jms:ClientBehaviorPolicyType"/>
    <xs:element name="server" type="jms:ServerBehaviorPolicyType"/>
    <xs:element name="clientConfig" type="jms:ClientConfig"/>
    <xs:element name="serverConfig" type="jms:ServerConfig"/>
    <xs:element name="address" type="jms:AddressType"/>
    <xs:element name="sessionPool" type="jms:SessionPoolType"/>

    <xs:complexType name="SessionPoolType">
        <xs:annotation>
            <xs:documentation>JMS Session pool configuration policy</xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="wsdl:tExtensibilityElement">
        		<xs:attribute name="lowWaterMark" type="xs:int" default="20"/>
        		<xs:attribute name="highWaterMark" type="xs:int" default="500" />
        	</xs:extension>
		</xs:complexContent>
    </xs:complexType>
    
    <xs:complexType name="ClientConfig">
        <xs:complexContent>
            <xs:extension base="wsdl:tExtensibilityElement">  
				<xs:attribute name="clientReceiveTimeout" type="xs:long" default="2000"/>
        		<xs:attribute name="messageTimeToLive" type="xs:long" default="0" />
        	</xs:extension>
		</xs:complexContent>        	
    </xs:complexType>
    
    <xs:complexType name="ServerConfig">
		<xs:complexContent>
            <xs:extension base="wsdl:tExtensibilityElement">
        		<xs:attribute name="messageTimeToLive" type="xs:long" default="0" />
        		<xs:attribute name="durableSubscriptionClientId" type="xs:string" />
			</xs:extension>
		</xs:complexContent>        	
    </xs:complexType>

    <xs:complexType name="JMSPropertyType">
        <xs:sequence>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="value" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    
    <xs:complexType name="JMSMessageHeadersType">
        <xs:annotation>
            <xs:documentation>JMS header properties.</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="property" type="jms:JMSPropertyType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="JMSCorrelationID" type="xs:string"/>
        <xs:attribute name="JMSDeliveryMode" type="xs:int"/>
        <xs:attribute name="JMSExpiration" type="xs:long"/>
        <xs:attribute name="JMSMessageID" type="xs:string"/>
        <xs:attribute name="JMSPriority" type="xs:int"/>
        <xs:attribute name="JMSRedelivered" type="xs:boolean"/>
        <xs:attribute name="JMSTimeStamp" type="xs:long"/>
        <xs:attribute name="JMSType" type="xs:string"/>
        <xs:attribute name="TimeToLive" type="xs:long"/>
    </xs:complexType>
    
    <xs:simpleType name="JMSClientReceiveTimeOut">
        <xs:restriction base="xs:long"/>
    </xs:simpleType>
    
    <xs:simpleType name="DestinationStyleType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="queue"/>
            <xs:enumeration value="topic"/>
        </xs:restriction>
    </xs:simpleType>
   
   <xs:complexType name="JMSNamingPropertyType">
        <xs:annotation>
            <xs:documentation>
                javaNaming properties name/value pair.
            </xs:documentation>
        </xs:annotation>
        
        <xs:attribute name="name" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>
                    Name of Java Naming Property
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="value" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>
                    Value of Java Naming Property
                </xs:documentation>
            </xs:annotation>
        </xs:attribute> 
    </xs:complexType>
    
    <xs:simpleType name="MessageFormatType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="text"/>
            <xs:enumeration value="binary"/>
            <xs:enumeration value="byte"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:complexType name="AddressType">
    	<xs:complexContent>
    		<xs:extension base="wsdl:tExtensibilityElement">
    			<xs:sequence>
    				<xs:element name="JMSNamingProperty"
    					type="jms:JMSNamingPropertyType" minOccurs="0"
    					maxOccurs="unbounded" />
    			</xs:sequence>
    			<xs:attribute name="destinationStyle"
    				type="jms:DestinationStyleType" default="queue">
    				<xs:annotation>
    					<xs:documentation>
    						JMS Destination style queue or topic.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>

    			<xs:attribute name="jndiConnectionFactoryName"
    				type="xs:string" use="required">
    				<xs:annotation>
    					<xs:documentation>
    						Type of the JNDI Connection factory
    						queueConnectionFactory or
    						topicConnectionFactory.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>
    			<xs:attribute name="jndiDestinationName"
    				type="xs:string">
    				<xs:annotation>
    					<xs:documentation>
    						Name of the JNDI Destination queue or topic.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>

    			<xs:attribute name="jmsDestinationName"
    				type="xs:string">
    				<xs:annotation>
    					<xs:documentation>
    						JMS destination queue name or topic name.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>

    			<xs:attribute name="jndiReplyDestinationName"
    				type="xs:string">
    				<xs:annotation>
    					<xs:documentation>
    						JMS Message Replyto destination when static
    						queues are used for reply.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>

    			<xs:attribute name="jmsReplyDestinationName"
    				type="xs:string">
    				<xs:annotation>
    					<xs:documentation>
    						JMS Replyto destination queue name when
    						using static queues for reply.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>

    			<xs:attribute name="connectionUserName"
    				type="xs:string">
    				<xs:annotation>
    					<xs:documentation>
    						UserName to use while creating JMS
    						queue/topic connection.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>
    			<xs:attribute name="connectionPassword"
    				type="xs:string">
    				<xs:annotation>
    					<xs:documentation>
    						Password to use while creating JMS
    						queue/topic connection.
    					</xs:documentation>
    				</xs:annotation>
    			</xs:attribute>
    			<xs:attribute name="useJms11" type="xs:boolean" use="optional"></xs:attribute>
    		</xs:extension>
    	</xs:complexContent>
    </xs:complexType>

    <xs:complexType name="ClientBehaviorPolicyType">
        <xs:complexContent>
            <xs:extension base="wsdl:tExtensibilityElement">
                <xs:attribute name="messageType" type="jms:MessageFormatType" default="text">
                    <xs:annotation>
                        <xs:documentation>Type of the JMS Message payload, currently supported text and binary.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    
    <xs:complexType name="ServerBehaviorPolicyType">
        <xs:annotation>
            <xs:documentation>JMS configuration policy for CXF Server.
            These are used for configuring JMS port on CXF server side.
            </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="wsdl:tExtensibilityElement">
                <xs:annotation>
                    <xs:documentation>Sets selection criteria for messages received by server</xs:documentation>
                </xs:annotation>
                <xs:attribute name="messageSelector" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>
                          JMS Message Selector attribute to filter messages from the queue.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="useMessageIDAsCorrelationID" type="xs:boolean" default="false">
                    <xs:annotation>
                        <xs:documentation>
                          Flag to indicate whether to use JMS Message Id as correlation ID. It is serverside only so should go in ServerPolicy
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="transactional" type="xs:boolean" default="false">
                    <xs:annotation>
                        <xs:documentation>
                          Flag to specify whether to use JMS transaction support on server side.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="durableSubscriberName" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>
                           Specifies the name of the Durable Subscription
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    
</xs:schema>
