<?xml version="1.0" encoding="UTF-8"?>

<!-- spring-wlevs.xsd -->

<xsd:schema xmlns="http://www.bea.com/ns/wlevs/spring"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:beans="http://www.springframework.org/schema/beans"
    targetNamespace="http://www.bea.com/ns/wlevs/spring"
    elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xsd:annotation>
        <xsd:documentation><![CDATA[
    Custom tags for wiring WLEvS applications together. Special attention must be paid to the imports
    required by the application bundle.
    ]]></xsd:documentation>
    </xsd:annotation>

    <xsd:import namespace="http://www.springframework.org/schema/beans" />

    <xsd:attributeGroup name="ServiceAttributes">
        <xsd:attribute name="advertise" type="xsd:boolean" default="false">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Advertises this component as a service in the OSGi registry. Used for monitoring purposes.
    Valid values are true and false. Default value is false.
                    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="provider" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Specifies the service provider.  In the case of an adapter, if you are using the WebLogic Event 
    Server load generator to simulate a data feed, use the hard-coded loadgen value such as provider="loadgen"
                    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="SpringBeanAttributes">
        <xsd:attribute name="lazy-init" type="beans:defaultable-boolean"
            default="default">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Specifies lazy-init to the underlying Spring bean.
                    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="depends-on" type="xsd:string" use="optional">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Specifies depends-on to the underlying Spring bean. Use this to enforce correct
    initialization order of instances.
                    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="ClassAttribute">
        <xsd:attribute name="class" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Specifies the class name for this bean.
                    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:group name="PropertyElements">
        <xsd:sequence>
            <xsd:element name="property" type="beans:propertyType"
                minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[
    Specifies properties that are to be applied to the stage factory.
                 ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="instance-property" type="beans:propertyType"
                minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[
    Specifies properties that are to be applied to the create stage instance. This allows
    declarative configuration of user-defined stage properties.
                    ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:group>

    <xsd:complexType name="Tlistener">
        <!-- nested bean declaration -->
        <xsd:sequence minOccurs="0" maxOccurs="1">
            <xsd:any namespace="##any" minOccurs="1" maxOccurs="1"
                processContents="skip" />
        </xsd:sequence>
        <!-- shortcut for bean references -->
        <xsd:attribute name="ref" type="xsd:string" use="optional" />
    </xsd:complexType>

    <xsd:complexType name="Tsource">
        <!-- nested bean declaration -->
        <xsd:sequence minOccurs="0" maxOccurs="1">
            <xsd:any namespace="##any" minOccurs="1" maxOccurs="1"
                processContents="skip" />
        </xsd:sequence>
        <!-- shortcut for bean references -->
        <xsd:attribute name="ref" type="xsd:string" use="optional" />
    </xsd:complexType>

    <xsd:complexType name="Tfunction">
        <!-- nested bean declaration -->
        <xsd:sequence minOccurs="0" maxOccurs="1">
            <xsd:any namespace="##any" minOccurs="1" maxOccurs="1"
                processContents="skip" />
        </xsd:sequence>
        <xsd:attribute name="epl-name" type="xsd:string" use="optional">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    An alternate name to use when referencing this function bean in an EPL query.  By 
    default, the Spring bean name is used.
                    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <!-- shortcut for bean references -->
        <xsd:attribute name="ref" type="xsd:string" use="optional" />
    </xsd:complexType>

    <xsd:complexType name="TStageType">
        <xsd:complexContent>
            <xsd:extension base="beans:identifiedType">
                <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                    <xsd:element name="listener" type="Tlistener"
                        minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies a sink for this stage's events. A listener can be an instance of any other
    stage type, including nested definitions. However, nested definitions are not eligible
    for dynamic configuration or monitoring.
                 ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:group ref="PropertyElements" />
                </xsd:sequence>
                <xsd:attributeGroup ref="SpringBeanAttributes" />
                <xsd:attributeGroup ref="ServiceAttributes" />
                <xsd:attribute name="listeners" type="xsd:string"
                    use="optional">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies the listening components.
    Set this attribute to the value of the id attribute of the element that declared the component.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="manageable" type="xsd:boolean"
                    default="false">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Makes this stage element available for monitoring and configuration.
    Valid values are true and false. Default value is false.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TEventBeanType">
        <xsd:complexContent>
            <xsd:extension base="TStageType">
                <xsd:attributeGroup ref="ClassAttribute" />
                <xsd:attribute name="onevent-method" type="xsd:string"
                    use="optional" />                
                <xsd:attribute name="init-method" type="xsd:string"
                    use="optional" />
                <xsd:attribute name="activate-method" type="xsd:string"
                    use="optional" />
                <xsd:attribute name="suspend-method" type="xsd:string"
                    use="optional" />
                <xsd:attribute name="destroy-method" type="xsd:string"
                    use="optional" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TAdapterType">
        <xsd:complexContent>
            <xsd:extension base="TEventBeanType"></xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TProcessorType">
        <xsd:complexContent>
            <xsd:extension base="TStageType">
                <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                    <xsd:element name="cache-source" type="Tsource" minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies a cache that supplies data for this processor.
                    ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="function" type="Tfunction"
                        minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies a bean containing user-defined functions for this processor.
                    ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="queryURL" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies a URL to obtain a rules definition file for this processor.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TStreamType">
        <xsd:complexContent>
            <xsd:extension base="TStageType">
                <xsd:sequence minOccurs="0" maxOccurs="1">
                    <xsd:element name="source" type="Tsource" minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies an event source for this stream. Specifying an event source is equivalent to
    specifying this stream as an event sink, or listener, for another stage.
    			    ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="max-size" type="xsd:int" default="1024">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies the maximum size of this stream. Zero-size streams synchronously pass-through events.
    Streams with non-zero size process events asynchronously, buffering events by the requested
    size.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="max-threads" type="xsd:int" default="1">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies the maximum number of  threads that will be used to process events for this stream.  Setting this value
    has no effect when max-size is 0.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="source" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies the component from which the stream sources events.
    Set this attribute to the value of the id attribute of the element that declared the component.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TCachingSystemType">
        <xsd:complexContent>
            <xsd:extension base="beans:identifiedType">
                <xsd:sequence>
                    <xsd:group ref="PropertyElements" />
                </xsd:sequence>
                <xsd:attributeGroup ref="SpringBeanAttributes" />
                <xsd:attributeGroup ref="ServiceAttributes" />
                <xsd:attributeGroup ref="ClassAttribute" />
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TReferenceType">
        <!-- nested bean declaration -->
        <xsd:sequence minOccurs="0" maxOccurs="1">
            <xsd:any namespace="##any" minOccurs="1" maxOccurs="1"
                processContents="skip" />
        </xsd:sequence>
        <!-- shortcut for bean references -->
        <xsd:attribute name="ref" type="xsd:string" use="optional" />
    </xsd:complexType>

    <xsd:complexType name="TCacheType">
        <xsd:complexContent>
            <xsd:extension base="beans:identifiedType">
                <xsd:sequence minOccurs="0" maxOccurs="1">
                    <xsd:element name="caching-system" type="TReferenceType"
                        minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies a caching system for this cache. 
                    ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="cache-loader" type="TReferenceType"
                        minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies a cache loader for this cache.
                    ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="cache-store" type="TReferenceType"
                        minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies a cache store for this cache.
                    ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="cache-listener" type="TReferenceType"
                        minOccurs="0" maxOccurs="unbounded">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[
    Specifies cache listeners for this cache. 
                    ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="name" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    An alternate name to use for this cache (instead of the value of the id attribute).  Useful for nested beans.
                    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="key-properties" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    The names of the properties (comma separated) that together form the unique key value for objects in the cache.  A cache key may
    be composed of a single property or multiple properties.  When a cache is configured as a listener in an event 
    processing network, events that reach the cache are inserted using the unique key value as a key.  This attribute
    is optional when a key-class is specified.  If neither key-properties or key-class are specified, then the event object is used 
    as both the key and value when it is inserted into the cache.
                    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="key-class" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies the name of the Java class used for the cache key when the key is a composite key. If key-properties is not specified,
    then all properties on the key-class are assumed to be key properties.
                    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="value-type" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
     Specifies the type for values contained in the cache.  Must be a valid type name in the event type repository. 
                    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="caching-system" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies a caching system for this cache.
                    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                       <xsd:attribute name="advertise" type="xsd:boolean" default="false">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Advertises this component as a service in the OSGi registry.
    Valid values are true and false. Default value is false.
                    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TEnvType">
        <xsd:attribute name="id" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Unique identifier of the existing WebLogic Event Server service.
    For this release, there is only one service, the event type repository,
    and its unique identifier is wlrt:epltyperep.
    			    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="name" type="xsd:string" />
        <xsd:attribute name="interface" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    The Java inteface that implements the service.
    For this release, there is only one service, the event type repository,
    and its interface is com.bea.wlevs.ede.EventTypeRepository.
    			    ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:complexType name="TFactoryType">
        <xsd:attribute name="class" type="xsd:string" use="required" />
        <xsd:attribute name="provider-name" type="xsd:string" use="required" />
    </xsd:complexType>

    <xsd:complexType name="TLinkType">
        <xsd:complexContent>
            <xsd:extension base="beans:identifiedType">
                <xsd:attribute name="source" type="xsd:string" use="required">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Deprecated. Do not use.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="listeners" type="xsd:string"
                    use="required">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Deprecated. Do not use.
    			    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TEventRepType">

        <xsd:complexContent>
            <xsd:extension base="beans:identifiedType">
                <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies a sequence of event-types to regsister with the event-type-repository.
        ]]></xsd:documentation>
                    </xsd:annotation>
                    <xsd:element name="event-type" type="TEventType"
                        minOccurs="0" />
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="TEventType">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:choice minOccurs="0" maxOccurs="1">
                <xsd:element name="metadata" type="beans:mapType"
                    minOccurs="0">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies a meta-data definition for this event type. Meta-data is specified as
    a map of type names to types. Types should be specified as java class names.
                    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
                <xsd:element name="class" type="xsd:string">
                    <xsd:annotation>
                        <xsd:documentation><![CDATA[
    Specifies the class to use for defining this event type.
                    ]]></xsd:documentation>
                    </xsd:annotation>
                </xsd:element>
            </xsd:choice>
            <xsd:element name="property" type="beans:propertyType"
                minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[
    Specifies a custom property to apply to the defined event type.
                    ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:ID" use="optional">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Specifies the identifier for this event type. By default identifiers are auto-generated.
        ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="type-name" type="xsd:string" use="required">
            <xsd:annotation>
                <xsd:documentation><![CDATA[
    Specifies the name of this event type.
        ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:element name="event-bean" type="TEventBeanType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Use this tag to declare an event-bean to the Spring application context.
    You use this tag in the Spring configuration file of your application;
    this file declares the components in your application that make up the event processing network.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="adapter" type="TAdapterType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Use this tag to declare an adapter service to the Spring application context.
    You use this tag in the Spring configuration file of your application;
    this file declares the components in your application that make up the event processing network.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="stream" type="TStreamType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Use this tag to declare a data stream to the Spring application context.
    You use this tag in the Spring configuration file of your application;
    this file declares the components in your application that make up the event processing network.    
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="processor" type="TProcessorType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Use this tag to declare a processor to the Spring application context.
    You use this tag in the Spring configuration file of your application;
    this file declares the components in your application that make up the event processing network.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="caching-system" type="TCachingSystemType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
            ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="cache" type="TCacheType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
            ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="link" type="TLinkType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Deprecated. Do not use.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="factory" type="TFactoryType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Use this tag to register a factory class as a service.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="env" type="TEnvType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Use this tag to reference existing services, provided by WebLogic Event Server,
    in your application environment.
    For this release, the only existing service you can reference is the event type repository.
    This service registers new event types referenced by EPL queries.
    You then reference this service as a property when you declare the Java bean that implements
    one of your components and that also defines the event type.
    You use this tag in the Spring configuration file of your application;
    this file declares the components in your application that make up the event processing network.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="event-type-repository" type="TEventRepType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Specifies an event-type-repository to register events with for event processing.
    Custom event types need to be registered with the respository in order to be useable in
    event processing queries.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:element name="event-type" type="TEventType">
        <xsd:annotation>
            <xsd:documentation><![CDATA[
    Specifies an event type defintion. Event types can either be specified using meta-data or by
    using a java class as a template. In the simple case just register a custom event type using
    its class name.
       	    ]]></xsd:documentation>
        </xsd:annotation>
    </xsd:element>

</xsd:schema>


