<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
		targetNamespace="http://www.openejb.org/openejb-jar/1.1">
	
    <!--===========================================================
    This is the XML Schema for the OpenEJB 1.1 deployment descriptor.
    ============================================================-->
    
    <!--
    Represents the OpenEJB specific deployment information for each
    bean in an ejb-jar.  
    
    ejb-name:       The name of the ejb as it is in the ejb-name element in the
                    bean's ejb-jar.xml.  This name will be used to locate the ejb
                    declaration in the ejb-jar.xml.  The deployment information 
                    decalred here will be applied to this ejb.
    
    deployment-id:  A name for the ejb that is unique not only in this jar, but 
                    in all the jars in the container system.  This name will allow
                    OpenEJB to place the bean in a global index and reference the
                    bean quickly.  OpenEJB will also use this name as the global JNDI 
                    name for application clients in the same VM.  The integrating 
                    server may also use this name to as part of a global JNDI namespace
                    available to remote application clients.
    
    container-id:   The id of the container in which this ejb will run.  The container
                    must be declared in the OpenEJB configuration file.                                    
    -->
    <xsd:element name="ejb-deployment">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="resource-link" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="query" minOccurs="0" maxOccurs="unbounded"/> 
            </xsd:sequence>
			<xsd:attribute name="ejb-name" type="xsd:string"/>
			<xsd:attribute name="deployment-id" type="xsd:ID"/>
			<xsd:attribute name="container-id" type="xsd:string"/>
		</xsd:complexType>
	</xsd:element>

    
    <!--
    The openejb-jar.xml is placed in the bean's jar to link the bean
    into the container system.  The bean must be given a unique id
    and it's resource references must be resolved and linked to actual
    resources in the container sytem.
    -->
    <xsd:element name="openejb-jar">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="ejb-deployment" minOccurs="1" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
    </xsd:element>
    
    
    <!--
    Links an ejb's resource references to actual resources available in OpenEJB.
    
    res-ref-name:   The name used in the res-ref-name of the ejb's ejb-jar.xml.  
                    OpenEJB uses that name to find the reference in the ejb-jar.xml
                    and link the reference to an actual resource in the container system.
    res-id:         The id of the actual resource in OpenEJB that will be used when the
                    bean references the res-ref-name at runtime.  The resource must be 
                    declared in the OpenEJB configuration file.
    -->
    <xsd:element name="resource-link">
		<xsd:complexType>
			<xsd:attribute name="res-ref-name" type="xsd:string"/>
			<xsd:attribute name="res-id" type="xsd:string"/>
		</xsd:complexType>
    </xsd:element>

    <!--
    The query element is used to specify a CMP Entiry finder query. It 
    contains an optional description of the query; the specification of 
    the finder method it is used by; and the Object QL query string that
    defines the query.
    
    Used in: ejb-deployment
    -->
    <xsd:element name="query">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="description" minOccurs="0" maxOccurs="1"/>
				<xsd:element ref="query-method"/>
				<xsd:element ref="object-ql"/>
			</xsd:sequence>
		</xsd:complexType>
    </xsd:element>
    
    <!--
    The query-method element is used to specify the method for a finder or
    select query.
    
    The method-name element specifies the name of a finder method in the 
    entity bean’s implementation class.
    Each method-param must be defined for a query-method using the
    method-params element.
    Used in: query
    Example:
    <query>
        <description>Method finds large orders</description>
        <query-method>
            <method-name>findLargeOrders</method-name>
            <method-params></method-params>
        </query-method>
        <object-ql>
            SELECT o FROM com.acme.OrderBean o WHERE o.amount > 1000
        </object-ql> 
    </query> 
    -->
    <xsd:element name="query-method">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="method-name"/>
				<xsd:element ref="method-params"/>
			</xsd:sequence>
		</xsd:complexType>
    </xsd:element>

    <!--
    The method-name element contains a name of an enterprise bean method
    Used in: query-method
    -->
	<xsd:element name="method-name" type="xsd:string" />
    
    <!--
    The method-param element contains the fully-qualified Java type name
    of a method parameter.
    Used in: method-params
    -->
	<xsd:element name="method-param" type="xsd:string" />
    
    <!--
    The method-params element contains a list of the fully-qualified Java
    type names of the method parameters.
    Used in: query-method
    -->
	<xsd:element name="method-params">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="method-param" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
			<xsd:attribute name="id" type="xsd:ID" minOccurs="0" maxOccurs="1"/>
		</xsd:complexType>
	</xsd:element>
    
    <xsd:element name="description" type="xsd:string" />
    
    <!--
    An OQL query string. The OQL syntax is a subset of the syntax 
    described in the ODMG 3.0 specification section 4.12, with some 
    additional constructs. 
    
    Full details of the OQL Syntax at: 
    http://www.castor.org/oql.html
    
    Used in: query
    -->
    <xsd:element name="object-ql" type="xsd:string"/>
    
</xsd:schema>
