<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: AGApplicationBase.xsd,v 1.12.50.6 2005/05/12 12:41:51 pah Exp $ -->
<!-- This is refactored from the AGParameterDefinition.xsd -->
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Paul Harrison (Jodrell Bank Observatory) -->
<xs:schema targetNamespace="http://www.ivoa.net/xml/CEA/base/v0.2" xmlns:ceapd="http://www.ivoa.net/xml/CEA/parameters/v0.2" xmlns:ceab="http://www.ivoa.net/xml/CEA/base/v0.2" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="http://www.ivoa.net/xml/CEA/parameters/v0.2" schemaLocation="AGParameterDefinition.xsd"/>
	<xs:annotation>
		<xs:documentation>this file captures some of the ideas used in the WSDL-like parameter definition files, but as yet is not used for validation</xs:documentation>
	</xs:annotation>
	<xs:annotation>
		<xs:documentation>the baseparameter definition is mimiced by the contents of a part element in the wsdl</xs:documentation>
	</xs:annotation>
	<xs:annotation>
		<xs:documentation>important types are defined here that would have special significance....</xs:documentation>
	</xs:annotation>
	<xs:complexType name="ApplicationBase" abstract="false">
		<xs:annotation>
			<xs:documentation>Base Application Description</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="ApplicationType" type="ceab:ApplicationKindType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The CEA type of the application - this allows the system to determine which CEC it should be talking to.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Parameters">
				<xs:annotation>
					<xs:documentation>The complete list of parameters that might occur in any of the apllication interfaces</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element ref="ceab:Parameter" minOccurs="0" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="Interfaces" type="ceab:InterfacesType">
				<xs:annotation>
					<xs:documentation>The list of interfaces that an application might have</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="name" type="xs:ID" use="required">
			<xs:annotation>
				<xs:documentation>This has a type of ID because it is useful to  be able to put some identity constraints on the parameter refs so that some schema checking can validate the configuration file. This is not compatible any more with the standard form of name reference ivo://authority/name - it might be that the best thing to do in future is to put the authorityid in a separate attribute</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<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:complexType>
	<xs:complexType name="InterfaceDescription">
		<xs:annotation>
			<xs:documentation>description of an interface</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="input">
				<xs:annotation>
					<xs:documentation>The list of input paramters for an interface</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="pref" type="ceab:parameterRef" minOccurs="0" maxOccurs="unbounded">
							<xs:annotation>
								<xs:documentation>a reference to a parameter</xs:documentation>
							</xs:annotation>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="output">
				<xs:annotation>
					<xs:documentation>The list of output parameters for an interface</xs:documentation>
				</xs:annotation>
				<xs:complexType>
					<xs:sequence>
						<xs:element name="pref" type="ceab:parameterRef" minOccurs="0" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="description" type="xs:string">
				<xs:annotation>
					<xs:documentation>A desciption of the interface suitable for presentation in a UI</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string" use="required"/>
	</xs:complexType>
	<xs:complexType name="InterfacesType">
		<xs:sequence>
			<xs:element name="Interface" type="ceab:InterfaceDescription" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>A particular application interface</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="parameterRef" mixed="false">
		<xs:annotation>
			<xs:documentation>reference to an application parameter. Used in the interface definitions.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="ref" type="xs:string"/>
		<xs:attribute name="minoccurs" type="xs:int" use="optional" default="1"/>
		<xs:attribute name="maxoccurs" type="xs:int" use="optional" default="1">
			<xs:annotation>
				<xs:documentation>a value of 0 implies unbounded</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:element name="Parameter" type="ceapd:BaseParameterDefinition" abstract="true">
		<xs:annotation>
			<xs:documentation>A generalised parameter - this is a substitution point</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:simpleType name="ApplicationKindType">
		<xs:annotation>
			<xs:documentation>The type of the underlying application - commandline, http-get etc</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value="cmdline">
				<xs:annotation>
					<xs:documentation>application is commandline, wrapped by a CEC</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="http">
				<xs:annotation>
					<xs:documentation>application is a http POST/GET</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="javaclass">
				<xs:annotation>
					<xs:documentation>application is implemented "internally" in the CEA</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
			<xs:enumeration value="webservice">
				<xs:annotation>
					<xs:documentation>application is an external web service - will be dealt with by a proxy.</xs:documentation>
				</xs:annotation>
			</xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
	<xs:element name="ApplicationList">
		<xs:annotation>
			<xs:documentation>A list of applications</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:annotation>
				<xs:documentation>list of applications</xs:documentation>
			</xs:annotation>
			<xs:sequence>
				<xs:element name="ApplicationDefn" type="ceab:ApplicationBase" maxOccurs="unbounded">
					<xs:annotation>
						<xs:documentation>This is a generic application definition that does not take in all of the specializations for web/commandline etc</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<!--
		
		Stuff to do with HttpApplications
		
		-->
	<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="ceab:HttpURLType">
					<xs:annotation>
						<xs:documentation>A direct referrence 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="ceab:ProxyApplicationSetup">
				<xs:sequence>
					<xs:element name="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:complexType>
							<xs:simpleContent>
								<xs:extension base="ceab:script"/>
							</xs:simpleContent>
						</xs:complexType>
					</xs:element>
					<xs:element name="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:complexType>
							<xs:simpleContent>
								<xs:extension base="ceab:script"/>
							</xs:simpleContent>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<!--The calling document describing the call to the web service-->
	<xs:complexType name="WebHttpCall">
		<xs:annotation>
			<xs:documentation>Description of an HTTP get or post service</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="URL" type="ceab: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="ceab: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="ceab: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="ceab:ProxyApplicationSetup">
				<xs:sequence/>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
</xs:schema>

