<?xml version="1.0" encoding="UTF-8"?>
<!--
// Description : generator.xsd
// Author: The SPIRIT Consortium Schema Working Group
// Version:     $Revision: 1111 $
// Date:        $Date: 2008-01-29 11:30:53 -0800 (Tue, 29 Jan 2008) $
// Tag:         $Name$
//
// Copyright (c) 2005, 2006, 2007 The SPIRIT Consortium.  All rights reserved.
// www.spiritconsortium.org
//
// THIS WORK FORMS PART OF A SPIRIT CONSORTIUM SPECIFICATION.
// USE OF THESE MATERIALS ARE GOVERNED BY
// THE LEGAL TERMS AND CONDITIONS OUTLINED IN THE SPIRIT
// SPECIFICATION DISCLAIMER AVAILABLE FROM
// www.spiritconsortium.org
//
// This source file is provided on an AS IS basis. The SPIRIT Consortium disclaims 
// ANY WARRANTY EXPRESS OR IMPLIED INCLUDING ANY WARRANTY OF
// MERCHANTABILITY AND FITNESS FOR USE FOR A PARTICULAR PURPOSE. 
// The user of the source file shall indemnify and hold The SPIRIT Consortium harmless
// from any damages or liability arising out of the use thereof or the performance or
// implementation or partial implementation of the schema.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:spirit="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.4" targetNamespace="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.4" elementFormDefault="qualified" attributeFormDefault="qualified">
    <xs:include schemaLocation="file.xsd"/>
    <xs:include schemaLocation="identifier.xsd"/>
    <xs:include schemaLocation="commonStructures.xsd"/>
    <xs:element name="generatorChain">
        <xs:complexType>
            <xs:sequence>
                <xs:group ref="spirit:versionedIdentifier"/>
                <xs:choice maxOccurs="unbounded">
                    <xs:element name="generatorChainSelector">
                        <xs:annotation>
                            <xs:documentation>Select other generator chain files for inclusion into this chain. The boolean attribute "unique" (default false) specifies that only a single generator is valid in this context. If more that one generator is selected based on the selection criteria, DE will prompt the user to resolve to a single generator.</xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                            <xs:choice>
                                <xs:element ref="spirit:groupSelector"/>
                                <xs:element name="generatorChainRef" type="spirit:libraryRefType">
                                    <xs:annotation>
                                        <xs:documentation>Select another generator chain using the unique identifier of this generator chain.</xs:documentation>
                                    </xs:annotation>
                                </xs:element>
                            </xs:choice>
                            <xs:attribute name="unique" type="xs:boolean" use="optional" default="false">
                                <xs:annotation>
                                    <xs:documentation>Specifies that only a single generator is valid in this context. If more that one generator is selcted based on the selection criteria, DE will prompt the user to resolve to a single generator.</xs:documentation>
                                </xs:annotation>
                            </xs:attribute>
                        </xs:complexType>
                    </xs:element>
                    <xs:element name="componentGeneratorSelector" type="spirit:generatorSelectorType">
                        <xs:annotation>
                            <xs:documentation>Selects generators declared in components of the current design for inclusion into this generator chain.</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element ref="spirit:generator"/>
                </xs:choice>
                <xs:element name="chainGroup" type="xs:Name" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation>Identifies this generator chain as belonging to the named group. This is used by other generator chains to select this chain for programmatic inclusion.</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="displayName" type="xs:string" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>Short description string, typically for user interface</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="description" type="xs:string" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>Full description string, typically for documentation</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element ref="spirit:choices" minOccurs="0"/>
                <xs:element ref="spirit:vendorExtensions" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="hidden" type="xs:boolean" use="optional" default="false">
                <xs:annotation>
                    <xs:documentation>If this attribute is true then the generator should not be presented to the user, it may be part of a chain and has no useful meaning when invoked standalone.</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="generator">
        <xs:annotation>
            <xs:documentation>Specifies a set of generators.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="spirit:generatorType"/>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>
    <xs:element name="componentGenerator">
        <xs:annotation>
            <xs:documentation>Specifies a set of component generators. The scope attribute applies to component generators and specifies whether the generator should be run for each instance of the entity (or module) or just once for all instances of the entity.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:complexContent>
                <xs:extension base="spirit:instanceGeneratorType"/>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>
    <xs:element name="abstractorGenerator" type="spirit:instanceGeneratorType">
        <xs:annotation>
            <xs:documentation>Specifies a set of abstractor generators. The scope attribute applies to abstractor generators and specifies whether the generator should be run for each instance of the entity (or module) or just once for all instances of the entity.</xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:element name="groupSelector">
        <xs:annotation>
            <xs:documentation>Specifies a set of group names used to select subsequent generators. The attribute "multipleGroupOperator" specifies the OR or AND selection operator if there is more than one group name (default=OR).</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="name" type="xs:Name" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation>Specifies a generator group name or a generator chain group name to be selected for inclusion in the generator chain.</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="multipleGroupSelectionOperator" use="optional" default="or">
                <xs:annotation>
                    <xs:documentation>Specifies the OR or AND selection operator if there is more than one group name.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:Name">
                        <xs:enumeration value="and"/>
                        <xs:enumeration value="or"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:simpleType name="phaseScopeType">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="global"/>
            <xs:enumeration value="local"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:element name="phase">
        <xs:annotation>
            <xs:documentation>This is an non-negative floating point number that is used to sequence when a generator is run. The generators are run in order starting with zero. There may be multiple generators with the same phase number. In this case, the order should not matter with respect to other generators at the same phase. If no phase number is given the generator will be considered in the "last" phase and these generators will be run in the order in which they are encountered while processing generator elements.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:float">
                    <xs:attribute name="scope" type="spirit:phaseScopeType" default="global"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="instanceGeneratorType">
        <xs:complexContent>
            <xs:extension base="spirit:generatorType">
                <xs:sequence>
                    <xs:element name="group" type="xs:Name" minOccurs="0" maxOccurs="unbounded">
                        <xs:annotation>
                            <xs:documentation>An identifier to specify the generator group. This is used by generator chains for selecting which generators to run.</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                </xs:sequence>
                <xs:attribute name="scope" use="optional" default="instance">
                    <xs:annotation>
                        <xs:documentation>The scope attribute applies to component generators and specifies whether the generator should be run for each instance of the entity (or module) or just once for all instances of the entity.</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:enumeration value="instance"/>
                            <xs:enumeration value="entity"/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="generatorSelectorType">
        <xs:sequence>
            <xs:element ref="spirit:groupSelector"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="componentGenerators">
        <xs:annotation>
            <xs:documentation>List of component generators.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="spirit:componentGenerator" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="abstractorGenerators">
        <xs:annotation>
            <xs:documentation>List of abstractor generators.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="spirit:abstractorGenerator" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="generatorType">
        <xs:annotation>
            <xs:documentation>Types of generators</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:group ref="spirit:nameGroup"/>
            <xs:element ref="spirit:phase" minOccurs="0"/>
            <xs:element ref="spirit:parameters" minOccurs="0"/>
            <xs:element name="apiType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>Indicates the type of API used by the generator. Valid value are TGI, and none. If this element is not present, TGI is assumed.</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:token">
                        <xs:enumeration value="TGI"/>
                        <xs:enumeration value="none"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="transportMethods" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="transportMethod">
                            <xs:annotation>
                                <xs:documentation>Defines a SOAP transport protocol other than HTTP which is supported by this generator. The only other currently supported protocol is 'file'.</xs:documentation>
                            </xs:annotation>
                            <xs:simpleType>
                                <xs:restriction base="xs:token">
                                    <xs:enumeration value="file"/>
                                </xs:restriction>
                            </xs:simpleType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="generatorExe" type="spirit:spiritURI">
                <xs:annotation>
                    <xs:documentation>The pathname to the executable file that implements the generator</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element ref="spirit:vendorExtensions" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="hidden" type="xs:boolean" use="optional" default="false">
            <xs:annotation>
                <xs:documentation>If this attribute is true then the generator should not be presented to the user, it may be part of a chain and has no useful meaning when invoked standalone.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
</xs:schema>
