Unicorn Contract Specification
Presentation
The contract between the framework and one observer is composed of two files located on observer side :
WADL
Information about WADL can be found here. This file describes the communication protocol between an observer and the framework who wants to use it. It defines all communication methods with their parameters and values allowed. An example WADL file for the css observer can be found here.
Application
The application element is the root of the WADL file and contains the following elements :
-
An optional
grammarselement acts as a container for definitions of any XML structures exchanged during the execution of the protocol described by the WADL document. Such definitions may be included inline or by reference. -
An optional
resourceselement acts as a container for the resources. Childresourceelement describes a single resource provided by the application. In our situation there are only oneresource: the observer.
Resource
The resource element describes a single resource provided by the observer.
It contains method element to describe the input to the observer.
Method
A method element describes the input of a HTTP protocol method that may be applied to a resource.
A method element has the following combinations of attributes :
nameSpecifies the HTTP method used. There must be only oneGETmethod and onePOSTmethod.idSpecifies the identifier of the method.
A method element has one child element :
requestSpecifies the input to the method as a collection of variables and an optional resource representation.
Request
A request element describes the input that may be included when applying a HTTP method to a resource.
A request element has no attributes and may contains zero or more query_variable elements.
Query variable
A query_variable element represents a URI query parameter as described in
section 17.13 of
HTML 4.01.
The runtime values of query variables are sent as URI query parameters when the HTTP method is invoked.
A query_variable element has no defined child elements and has the following attributes :
nameSpecifies the name of the variable as anxsd:NMTOKEN. Required.typeOptionally specifies the type of the variable as an XML qualified nam, defaults toxsd:string.requiredOptionally specifies whether the variable is required to be present or not, defaults to false (not required).repeatingOptionnally specifies whether the variable is single valued or may have multiple values, defaults to false (variable is single valued).fixedOptionnally specifies a fixed value for the variable.
RDF
This file contain all localized information, lists of mimetypes handled by each method of the observer and
information about input parameter handle by the observer.
An example RDF file for the css observer can be found here.
This file has an ucn:Observer element which contains :
- A
rdf:IDattribute as reference to the WADL file. - Zero or more
ucn:nameelements as the name of the observer in different language. - Zero or more
ucn:descriptionelement to describe the observer in different language. - Zero or more
ucn:helpelement, link to a help page about the observer in different language. -
One or more
ucn:inputMethodcontaining the exactly oneucn:Parameteritself containing One or moreucn:mimetypeelements to define each mimetype handled by the method.
