<?xml version="1.0" encoding="UTF-8"?>
<!-- 
   Legal Disclaimer
	
   Copyright Notice
	
   (c)Copyright International Business Machines Corporation, Sonic Software Corporation, 
      SAP AG, Hewlett-Packard Development Company, Akamai Technologies Inc. 
      and Tibco Software Inc.  2003, 2004  All rights reserved.
      
   (c)Copyright The University of Chicago 1999, 2004. All rights reserved.
-->

<xsd:schema 
  xmlns="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
  xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" 
  xmlns:wsnt=
    "http://www.ibm.com/xmlns/stdwip/web-services/WS-Notification"
  xmlns:wsrp=
    "http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties"
  targetNamespace=
    "http://www.ibm.com/xmlns/stdwip/web-services/WS-Notification"   
  elementFormDefault="qualified"  attributeFormDefault="unqualified">

<!-- ======================== Imports  ============================ -->
  
  <xsd:import namespace=
    "http://schemas.xmlsoap.org/ws/2003/03/addressing"
              schemaLocation=
    "http://schemas.xmlsoap.org/ws/2003/03/addressing" 
  />
  <xsd:import namespace=
    "http://schemas.xmlsoap.org/ws/2002/12/policy"
              schemaLocation=
    "http://schemas.xmlsoap.org/ws/2002/12/policy" 
  />
  <xsd:import namespace=
    "http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties" 
              schemaLocation= 
  "http://www-106.ibm.com/developerworks/webservices/library/ws-resource/WS-ResourceProperties.xsd" 
  /> 
  
  <xsd:import namespace=
  "http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceLifetime"
              schemaLocation= 
  "http://www-106.ibm.com/developerworks/webservices/library/ws-resource/WS-ResourceLifetime.xsd" 
  />

<!-- =============== utility type definitions  ==================== -->
  <xsd:complexType name="Documentation" mixed="true">
    <xsd:sequence>
      <xsd:any processContents="lax" minOccurs="0" 
               maxOccurs="unbounded" namespace="##any"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ExtensibleDocumented" abstract="true" 
                   mixed="false">
    <xsd:sequence>
      <xsd:element name="documentation" type="wsnt:Documentation" 
                   minOccurs="0" />
    </xsd:sequence>
    <xsd:anyAttribute namespace="##other" processContents="lax" />
  </xsd:complexType>

<!-- ============= Topic and Topic-Space Related  ================= -->   
  <xsd:complexType name="TopicSpaceType">
    <xsd:complexContent>
       <xsd:extension base="wsnt:ExtensibleDocumented">
         <xsd:sequence>
           <xsd:element name="Topic" type="wsnt:TopicType" 
                        minOccurs="0" maxOccurs="unbounded"/>
           <xsd:any namespace="##other" 
                    minOccurs="0" maxOccurs="unbounded" 
                    processContents="lax"/>
         </xsd:sequence>
         <xsd:attribute name="name" type="xsd:NCName"/>
         <xsd:attribute name="targetNamespace" type="xsd:anyURI" 
                        use="required"/>
       </xsd:extension>
     </xsd:complexContent> 
   </xsd:complexType>

  <xsd:element name="TopicSpace" type="wsnt:TopicSpaceType">
    <xsd:unique name="rootTopicUniqueness">
      <xsd:selector xpath="wsnt:Topic"/>
        <xsd:field xpath="@name"/>
    </xsd:unique>
  </xsd:element>
  
  <xsd:complexType name="TopicType">
    <xsd:complexContent>
      <xsd:extension base="wsnt:ExtensibleDocumented">
        <xsd:sequence>
           <xsd:element ref="wsrp:QueryExpression" 
                        minOccurs="0" maxOccurs="1" />
           <xsd:element name="Topic" type="wsnt:TopicType" 
                        minOccurs="0" maxOccurs="unbounded">
              <xsd:unique name="childTopicUniqueness">
                 <xsd:selector xpath="wsnt:topic"/>
                 <xsd:field xpath="@name"/>
              </xsd:unique>
           </xsd:element>   
           <xsd:any namespace="##other" minOccurs="0" 
                                        maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" use="required" type="xsd:NCName"/>
        <xsd:attribute name="aliasRef"
                       type="wsnt:TopicPathExpression"/>
        <xsd:attribute name="messageTypes" default="xsd:any">
          <xsd:simpleType>
            <xsd:list itemType="xsd:QName"/>
          </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="final" type="xsd:boolean" 
                                     default="false"/>
      </xsd:extension>
    </xsd:complexContent>  
  </xsd:complexType>
  
  <xsd:simpleType name="TopicPathExpression">
    <xsd:restriction base="xsd:token">
      <xsd:annotation>
        <xsd:documentation>
  The pattern allows strings matching the following EBNF:
    TopicPathExpression  ::=   TopicPath ( '|' TopicPath )*  
    TopicPath            ::=   RootTopic ChildTopicExpression* 
    RootTopic            ::=   (QName | '*')  
    ChildTopicExpression ::=   '/' (NCName | '*' | ‘/*’) 
                        
        </xsd:documentation>
      </xsd:annotation>
      <xsd:pattern value=
 "(((\w+:)?(\w+))|\*)(/(\w+|\*|/\*))*(\|(((\w+:)?(\w+))|\*)(/(\w+|\*|/\*))*)*">
      </xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="ConcreteTopicPathExpression">
    <xsd:restriction base="xsd:token">
      <xsd:annotation>
        <xsd:documentation>
  The pattern allows strings matching the following EBNF:
    ConcreteTopicPath    ::=   RootTopic ChildTopic*    
    RootTopic            ::=   QName  
    ChildTopic           ::=   '/' NCName 
                        
        </xsd:documentation>
      </xsd:annotation>
      <xsd:pattern value="((\w+:)?(\w+))(/(\w+))*" >
      </xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

<!-- =============== Resource Property Related  =================== -->
<!-- ======== Resource Properties for NotificationProducer ======== -->
         <xsd:element name="Topics">
            <xsd:complexType> 
               <xsd:sequence>
                  <xsd:element name="Topic" 
                               type="wsnt:TopicPathExpression"
                               minOccurs="0" maxOccurs="unbounded" />
                  </xsd:sequence>
            </xsd:complexType>
         </xsd:element>

         <xsd:element name="FixedTopicSet" type="xsd:boolean"/>

<!-- ======== Resource Properties for SubscriptionManager ========= --> 
  <xsd:element name="ConsumerReference" 
               type="wsa:EndpointReferenceType" />
  <xsd:element name="TopicPathExpression" 
               type="wsnt:TopicPathExpression" />
  <xsd:element name="UseNotify" 
               type="xsd:boolean" />
  <xsd:element name="Precondition" 
               type="wsrp:QueryExpressionType" />
  <xsd:element name="Selector" 
               type="wsrp:QueryExpressionType" />
  <xsd:element name="SubscriptionPolicy" 
               type="wsp:PolicyExpression" />
  <xsd:element name="CreationTime" 
               type="xsd:dateTime" />

<!-- ======== Resource Properties for NotificationBroker ========== -->
         <xsd:element name="RequiresRegistration" type="xsd:boolean"/>         

<!-- ====== Resource Properties for PublisherRegistration ========= -->
         <xsd:element name="PublisherReference" 
                      type="wsa:EndpointReferenceType" />
         
         <xsd:element name="Demand" 
                      type="xsd:boolean" />
                            
         <xsd:element name="PublisherRegistrationResourceProperties">
            <xsd:complexType>
               <xsd:sequence>
                  <xsd:element ref="wsnt:PublisherReference"
                               minOccurs="1" maxOccurs="1" />
                  <xsd:element ref="wsnt:TopicPathExpression" 
                              minOccurs="1" maxOccurs="unbounded" />
                  <xsd:element ref="wsnt:Demand" 
                               minOccurs="1" maxOccurs="1" />
                  <xsd:element ref="wsnt:CreationTime" 
                               minOccurs="1" maxOccurs="1" />
        </xsd:sequence>
     </xsd:complexType>
  </xsd:element>

</xsd:schema>
