<?xml version="1.0" encoding="UTF-8"?><!-- $Id: CEAImplementation.xsd,v 1.4 2009/05/19 13:17:21 pah Exp $ --><!-- This schema specifies the CEC specific parts of the CEC configuration --><!-- todo - would perhaps be nice to include all of the registry information here also... --><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ceab="http://www.ivoa.net/xml/CEA/base/v1.1" xmlns:ceaimp="http://www.astrogrid.org/schema/CEAImplementation/v2.0" xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0" xmlns:cea="http://www.ivoa.net/xml/CEA/v1.0" xmlns:stc="http://www.ivoa.net/xml/STC/stc-v1.30.xsd" xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.1" targetNamespace="http://www.astrogrid.org/schema/CEAImplementation/v2.0" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="1.0rc1">
    <xs:import schemaLocation="http://software.astrogrid.org/schema/vo-resource-types/VODataService/v1.1/VODataService-v1.1-tables-proposal-2.xsd" namespace="http://www.ivoa.net/xml/VODataService/v1.1"/>
    <xs:import namespace="http://www.ivoa.net/xml/CEA/base/v1.1" schemaLocation="http://software.astrogrid.org/schema/cea/CEABase/v1.1/CEABase.xsd"/>
   <xs:import namespace="http://www.ivoa.net/xml/VOResource/v1.0" schemaLocation="http://software.astrogrid.org/schema/vo-resource-types/VOResource/v1.0/VOResource.xsd"/>
   <xs:import namespace="http://www.ivoa.net/xml/CEA/v1.0" schemaLocation="http://software.astrogrid.org/schema/vo-resource-types/VOCEA/v1.0/VOCEA.xsd"/>

   <xs:complexType name="CeaCmdLineApplicationDefinition">
      <xs:annotation>
         <xs:documentation>
            Description of a command line application
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="ceab:ApplicationBase">
            <xs:sequence>
               <xs:element name="executionPath" type="ceaimp:ExecutableDescription">
                  <xs:annotation>
                     <xs:documentation>
                        This is the file path of the executable
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>
           </xs:sequence>

            <xs:attribute name="instanceClass" type="xs:string" use="optional"/>
            <!-- really would want the instance class to be of type java-class - but the simple castor mapping does not cope -->
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

   <xs:simpleType name="SwitchTypes">
      <xs:annotation>
         <xs:documentation>
            normal is the -x value style and keyword is the x=value
            style
         </xs:documentation>
      </xs:annotation>
      <xs:restriction base="xs:string">
         <xs:enumeration value="normal"/>
         <xs:enumeration value="keyword"/>
      </xs:restriction>
   </xs:simpleType>
   <xs:simpleType name="FileRefTypes">
      <xs:annotation>
         <xs:documentation>
            is a parameter treated as a file or directory reference
         </xs:documentation>
      </xs:annotation>
      <xs:restriction base="xs:string">
         <xs:enumeration value="no"/>
         <xs:enumeration value="file"/>
         <xs:enumeration value="directory"/>
      </xs:restriction>
   </xs:simpleType>
   <xs:complexType name="CommandLineParameterDefinition">
      <xs:annotation>
         <xs:documentation>
            Defines what it is to be a command line parameter - needs
            more thought with experience
         </xs:documentation>
         <xs:documentation>
            implmentation note - it would probably be better to
            implement most of the properties that are attributes as
            elements, as there are relationships between the attributes
            that are not properly expressed in this type.
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="ceab:BaseParameterDefinition">
            <xs:attribute name="commandSwitch" type="xs:string" use="optional">
               <xs:annotation>
                  <xs:documentation>
                     The characters that make up the commandline switch
                  </xs:documentation>
               </xs:annotation>
            </xs:attribute>
            <xs:attribute name="commandPosition" type="xs:int" use="optional" default="-1">
               <xs:annotation>
                  <xs:documentation>
                     the command position for a position only parameter.
                     The default value means that the parameter is
                     position independent and is assumed to need a
                     switch. Conversely if a parameter has a position
                     value it is assumed not to need a switch
                  </xs:documentation>
               </xs:annotation>
            </xs:attribute>
            <xs:attribute name="switchType" type="ceaimp:SwitchTypes" use="optional" default="normal">
               <xs:annotation>
                  <xs:documentation>
                     specifies the style of the switch - would be better
                     to call switchStyle!
                  </xs:documentation>
               </xs:annotation>
            </xs:attribute>
            <xs:attribute name="fileRef" type="ceaimp:FileRefTypes" use="optional" default="file">
               <xs:annotation>
                  <xs:documentation>
                     does the application treat the parameter as a
                     reference to a file or a directory. If it is a
                     directory and an output parameter, then the
                     corresponding parameter should be repeatable
                  </xs:documentation>
               </xs:annotation>
            </xs:attribute>
            <xs:attribute name="localFileName" type="xs:string" use="optional">
               <xs:annotation>
                  <xs:documentation>
                     the local name of the file that this parameter
                     refers to if the application uses a fixed file name
                  </xs:documentation>
               </xs:annotation>
            </xs:attribute>
            <xs:attribute name="isStreamable" type="xs:boolean" default="false">
               <xs:annotation>
                  <xs:documentation>
                     indicates whether the underlying application is
                     capable of streaming the content pointed to by the
                     parameter - if the local file name is set to "-"
                     then stdout and stdin should be used otherwise it
                     should be assumed that the application can natively
                     stream the parameter (e.g. reading a url) so no
                     attempt should be made by the CEC to download to a
                     local file
                  </xs:documentation>
               </xs:annotation>
            </xs:attribute>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>



   <xs:complexType name="ExecutableDescription" mixed="true">
      <xs:annotation>
         <xs:documentation>
            an executable description that allows for backward
            compatibility with existing setups - the string value is the
            command line
         </xs:documentation>
      </xs:annotation>
      <xs:sequence>
         <xs:element name="commandpval" type="xs:string" maxOccurs="unbounded" minOccurs="0">
            <xs:annotation>
               <xs:documentation>
                  a possible fixed parameter to be placed on the command
                  line - these are treated as individual strings to be
                  added to the command line at this level, so for
                  example -cp /somedir/some.jar would need to be
                  represented by two commmandpval elements with each
                  string &lt;commandpval&gt;-cp&lt;/commandpval&gt;
                  &lt;commandpval&gt;/somedir/some.jar&lt;/commandpval&gt;
               </xs:documentation>
            </xs:annotation>
         </xs:element>
      </xs:sequence>
   </xs:complexType>
   <!--
      
      Stuff to do with HttpApplications
      
      most of this used to be in CEABase - however now considered an implementation dependent part of CEA
      TODO should it be in VOCEA?
      TODO the capitalization of names in the HTTP elements does not follow latest conventions.
      
   -->
  <!--The calling document describing the call to the web service-->
  <xs:complexType name="CeaHttpApplicationDefinition">
     <xs:annotation>
        <xs:documentation>
           The definition of a CEA http application
        </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
        <xs:extension base="ceab:ApplicationBase">
           <xs:sequence>
              <xs:element name="CeaHttpAdapterSetup" type="ceaimp:WebHttpApplicationSetup"/>
           </xs:sequence>
        </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ProxyApplicationSetup">
      <xs:annotation>
         <xs:documentation>
            Extra description necessary for describing the case where
            CEA acts as proxy to underlying service
         </xs:documentation>
      </xs:annotation>
      <xs:sequence>
         <xs:choice>
            <xs:element name="URL" type="ceaimp:HttpURLType">
               <xs:annotation>
                  <xs:documentation>
                     A direct reference to a url of the underlying
                     service
                  </xs:documentation>
               </xs:annotation>
            </xs:element>
            <xs:element name="ResourceReferenceQuery" type="xs:string">
               <xs:annotation>
                  <xs:documentation>
                     A query using the registry query language to
                     reference one or more registered resources that
                     provide the underlying http GET/POST service.
                  </xs:documentation>
               </xs:annotation>
            </xs:element>
         </xs:choice>
      </xs:sequence>
   </xs:complexType>
   <xs:complexType name="WebHttpApplicationSetup">
      <xs:annotation>
         <xs:documentation>
            Description of an HTTP Application
         </xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="ceaimp:ProxyApplicationSetup">
            <xs:sequence>
               <xs:element name="PreProcessScript" type="ceaimp:PreProcessScript" minOccurs="0">
                  <xs:annotation>
                     <xs:documentation>
                        This script can be used to map the input
                        parameters to the parameters of the underlying
                        service. This should not usually be necessary as
                        the application defintion will usually be a
                        one-to-one mapping.
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>
               <xs:element name="PostProcessScript" type="ceaimp:PostProcessScript" minOccurs="0">
                  <xs:annotation>
                     <xs:documentation>
                        This script can be used to post process the
                        result returned by the http application. e.g. to
                        perform a 'screen-scrape'
                     </xs:documentation>
                  </xs:annotation>
               </xs:element>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>
   
   <xs:complexType name="WebHttpCall">
   <!-- this is really an implementation class - not sure that it should be in this schema -->
      <xs:annotation>
         <xs:documentation>
            Description of an HTTP get or post service
         </xs:documentation>
      </xs:annotation>
      <xs:sequence>
         <xs:element name="URL" type="ceaimp:HttpURLType"/>
         <xs:element name="SimpleParameter" minOccurs="0" maxOccurs="unbounded">
            <xs:complexType>
           <xs:attribute name="name" type="xs:string" use="required"/>
           <xs:attribute name="value" type="xs:string" use="required"/>
           </xs:complexType>
          </xs:element>
      </xs:sequence>
   </xs:complexType>
   <xs:complexType name="HttpURLType">
      <xs:annotation>
         <xs:documentation>
            The URL for an http get or post service
         </xs:documentation>
      </xs:annotation>
      <xs:simpleContent>
         <xs:extension base="xs:string">
            <xs:attribute name="method" type="ceaimp:HttpMethodType" default="get">
               <xs:annotation>
                  <xs:documentation>
                     the http method to be used to send parameters to
                     the service.
                  </xs:documentation>
               </xs:annotation>
            </xs:attribute>
         </xs:extension>
      </xs:simpleContent>
   </xs:complexType>
   <xs:simpleType name="HttpMethodType">
      <xs:annotation>
         <xs:documentation>
            http method type: get or post
         </xs:documentation>
      </xs:annotation>
      <xs:restriction base="xs:string">
         <xs:enumeration value="get"/>
         <xs:enumeration value="post"/>
      </xs:restriction>
   </xs:simpleType>
   <xs:complexType name="script">
      <xs:annotation>
         <xs:documentation>
            a snippet of code to massage the inputs and outputs
         </xs:documentation>
      </xs:annotation>
      <xs:simpleContent>
         <xs:extension base="xs:string">
            <xs:attribute name="lang" type="ceaimp:scriptingLanguage" use="optional" default="xslt"/>
         </xs:extension>
      </xs:simpleContent>
   </xs:complexType>
   <xs:simpleType name="scriptingLanguage">
      <xs:annotation>
         <xs:documentation>Scripting language</xs:documentation>
      </xs:annotation>
      <xs:restriction base="xs:string">
         <xs:enumeration value="xslt"/>
         <xs:enumeration value="javascript"/>
         <xs:enumeration value="groovy"/>
      </xs:restriction>
   </xs:simpleType>
   <!--definitions for web service proxy - experimental-->
   <xs:complexType name="WebServiceApplicationSetup">
      <xs:annotation>
         <xs:documentation>Description of WebService</xs:documentation>
      </xs:annotation>
      <xs:complexContent>
         <xs:extension base="ceaimp:ProxyApplicationSetup">
            <xs:sequence/>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>
   <xs:complexType name="PreProcessScript">
   <!-- not sure that there is any purpose to preprocess script - just needs to be http post or get.... -->
      <xs:simpleContent>
         <xs:extension base="ceaimp:script"/>
      </xs:simpleContent>
   </xs:complexType>
   <xs:complexType name="PostProcessScript">
   
        <xs:annotation>
           <xs:documentation>this could be a script to do screen scraping for instance....</xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
         <xs:extension base="ceaimp:script"/>
      </xs:simpleContent>
   </xs:complexType>





  <xs:element name="DBDefinition">
        <xs:annotation>
           <xs:documentation>
              experimental definition of a database, and the
              relationship to parameters that it might have....
           </xs:documentation>
        </xs:annotation>
        <xs:complexType>
        <xs:sequence>
           <xs:element name="schema" type="vs:RelationalSchema"/>
        </xs:sequence>
     </xs:complexType>
  </xs:element>

  <xs:complexType name="ColumnReference">
     <xs:annotation>
        <xs:documentation>
           A reference to a column described by the general table
           metadata
        </xs:documentation>
     </xs:annotation>
     <xs:attribute name="schema" type="xs:string" use="optional"/>
     <xs:attribute name="table" type="xs:string" use="optional"/>
     <xs:attribute name="column" type="xs:string" use="required"/>
  </xs:complexType>

  <xs:complexType name="DBPParameterDefinition">
     <xs:complexContent>
        <xs:extension base="ceab:BaseParameterDefinition">
           <xs:sequence>
              <xs:element name="colRef" type="ceaimp:ColumnReference" maxOccurs="unbounded" minOccurs="0"/>
           </xs:sequence>
        </xs:extension>
     </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="CeaDBApplicationDefinition">
     <xs:annotation>
        <xs:documentation>
           A Database Application better to derive from CEAApplication?
        </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
        <xs:extension base="ceab:ApplicationBase">
           <xs:sequence>
              <xs:element name="dbref" type="xs:string"/>
              <xs:element name="parMap" type="ceaimp:DBParMap"/>
              <xs:element name="outMap" type="ceaimp:DBOutMap"/>
           </xs:sequence>
        </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DBParMap">
     <xs:sequence>
        <xs:element name="pref" type="ceaimp:DBParameterMapping" maxOccurs="unbounded" minOccurs="0"/>
     </xs:sequence>
  </xs:complexType>

  <xs:complexType name="DBParameterMapping">
     <xs:sequence>
        <xs:element name="colref" type="ceaimp:ColumnReference" maxOccurs="unbounded" minOccurs="0"/>
     </xs:sequence>
     <xs:attribute name="ref" type="xs:string"/>
  </xs:complexType>
  <xs:complexType name="DBOutMap">
     <xs:sequence>
        <xs:element name="col" type="xs:string"/>
     </xs:sequence>
     <xs:attribute name="all" type="xs:boolean" use="optional" default="false"/>
   </xs:complexType>

  <xs:complexType name="CEADALService">
     <xs:annotation>
        <xs:documentation>
           Definition of a general DAL style service served by a CEA
           server. Includes possibility of specifying
           ApplicationDefinition - parameters Coverage desired outputs
           Capabilities - but only need to put in the standardId - the
           other things will be filled in automatically
        </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
        <xs:extension base="vs:DataService">
           <xs:sequence>
              <xs:element name="applicationDefinition" type="ceab:ApplicationBase">
              </xs:element>
           </xs:sequence>
           <xs:attribute name="publishApplication" type="xs:boolean" use="optional" default="false">
              <xs:annotation>
                 <xs:documentation>
                    if true the application will be published as a
                    separate CEAApplication as well as the DAL service
                    defined here.
                 </xs:documentation>
              </xs:annotation></xs:attribute>
        </xs:extension>
     </xs:complexContent>
  </xs:complexType>
  <xs:element name="CECConfig">
     <xs:complexType>
        <xs:sequence maxOccurs="1" minOccurs="1">
           <xs:choice maxOccurs="unbounded" minOccurs="1">
              <xs:element ref="ceaimp:CeaApplication"/>
              <xs:element ref="ceaimp:CeaDALService"/>
              <xs:element ref="ceaimp:DBDefinition"/>
           </xs:choice>
        </xs:sequence>
     </xs:complexType>
  </xs:element>

  <xs:element name="CeaApplication" type="cea:CeaApplication"/>

  <xs:element name="CeaDALService" type="ceaimp:CEADALService"/>
</xs:schema>