snowtam trial: rest interface. aixm xml developers' seminar 2 contents digital-snowtam trial...

30
SNOWTAM Trial: REST Interface

Upload: suzan-garrison

Post on 04-Jan-2016

235 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

SNOWTAM Trial: REST Interface

Page 2: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 2

Contents

• Digital-SNOWTAM Trial Introduction• REST Introduction

• REST in the Digital-SNOWTAM Trial• Why it is used• Architecture• How it is used

• Example

Page 3: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

Digital-SNOWTAM Trial Introduction

Page 4: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 4

Demo

Page 5: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

REST Introduction

Page 6: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 6

REST

• Representational State Transfer• An architectural style

Page 7: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 7

Main definitions

• Resources• Representations• Actions – Verbs• Type of data

Page 8: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 8

Resources

• A resource is a real thing that can be acted upon with a request

• Anything that can be named can be a resource e.g. PDF, XML, SVG, HTML page, today’s weather report.

• They are found using URIs (see www.purl.org)

Page 9: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 9

Resources and time

• Resources can vary over time.• The only thing that must be static is the

semantic of the mapping (name).

Page 10: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 10

Representations

• The data transmitted to and from the resource is called a representation

• Captures the current or intended state of the resource

• It can be a copy of the file or a description of it

Page 11: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 11

Transparency

• How the representation is found should be transparent to the user

• It could involve the server parsing the URL, constructing a database query and returning the result

Page 12: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 12

Actions - Verbs

• Once the representation of the resource has been returned, an action can be performed

• The interaction is determined by the HTTP verbs: GET, PUT, POST and DELETE

• The interaction is stateless

Page 13: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 13

Type of data

• When performing an action on a resource it is important to know what the resource is

• MIME types can help here (e.g. text/xml)• The format of the request/response can be

specified in a schema

Page 14: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 14

Actions

• GET• Used to read a resource or as a query• Should be side-effect free

• PUT• Replaces the target resource in its entirety

• DELETE• Removes the resource

• POST• Has a variety of meanings e.g. it can be used when

only a subset of a resource has to be modified

Page 15: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

REST in the Digital-SNOWTAM Trial

Page 16: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 16

Why it is used

• Support the provision of AIXM 5.1 data to end-user applications

• The REST interface shall enable digital users to:• Query the Digital SNOWTAM database for the list of airports

contained in the database and select one of these airports;• Get the list of airport’s features for a selected airport;• Get the surface contamination records for each such feature;• Get the feature related through xlink:href;• Get the SNOWTAM text and the free text translation

associated with an Airport.

Page 17: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 17

Architecture

• The REST implementation framework used is Struts 2 REST plug-in which in turn uses the Convention plug-in.

• See http://struts.apache.org/2.x/docs/rest-plugin.html for more information.

• Please note the REST plug-in is only available for Struts 2.1.1 or above.

Page 18: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 18

Implementation

• Only GET is need for the trial.

Page 19: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 19

Workflow

• In order to interrogate the database:• request the list of airports• select one airport and use the xlink:href to get the details

about this airport• select a runway and use the corresponding xlink:href to get

the details about this feature

• The xlink:href is a URL compliant to the Digital SNOWTAM REST request structure

Page 20: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 20

Base URL

• Base:

• http://<server>/<app>• E.g. http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept

• Then add a Suffix:

• /<REST suffix>

Page 21: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 21

Find Airports

• Suffix:• /airportheliports[?designator=<pattern>]

• There are about 15000 airports/heliports in the database so…

• Optional Parameter:• The pattern is of the form [A-Z*]{1,4} where * is the wildcard

character.• Pattern samples:

• EB* matches any designator beginning with EB• *BBR matches any designator ending in BBR• E*R matches any designator beginning with E and

ending with R

Page 22: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 22

Query an Airport

• Suffix:• /airportheliports/<gml:identifier>[?features=yes/

no&contaminations=yes/no&date=<date&time>]

• Mandatory parameter:• gml:identifier – UUID

• Optional parameters:• date - <date&time> is the search date&time • features - specify if xlink:href pointing to related features must

be included in the results, e.g. runways, taxiways, etc• contaminations - specify if contaminations must be included

or not in the result

Page 23: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

Examples

Page 24: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 24

1 – Create Contamination

• Use Bromma to create a contamination

Page 25: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 25

2 – Use REST to find the airport

• http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept/airportheliports?designator=ESSB

<ResultList> <AirportHeliportFeature designator="ESSB" id="77a0de0e-277a-4824-a561-2ba779a3658c" href="http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept/airportheliports/77a0de0e-277a-4824-a561-2ba779a3658c"/></ResultList>

Page 26: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 26

3 – Find SNOWTAM Text

• http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept/airportheliports/77a0de0e-277a-4824-a561-2ba779a3658c?features=yes&contaminations=yes

<aixm:annotation> <aixm:Note> <aixm:definition>snowtam-icao</aixm:definition> <aixm:translatedNote>

<aixm:LinguisticNote> <aixm:note lang="eng">SW** ESSB 10090900 (SNOWTAM A)ESSB B)10090900 C)12 F)3/2/2 G)1/1/1 H)2/3/3 BRD ) </aixm:note>

</aixm:LinguisticNote> </aixm:translatedNote> </aixm:Note>

</aixm:annotation>

Page 27: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 27

4 – Get Airport data

• http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept/airportheliports/77a0de0e-277a-4824-a561-2ba779a3658c?features=yes

… <aixm:associatedRunways> <aixm:associatedRunway id="12/30" xlink:href="http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept/runways/58ea128d-1bbe-47f6-92fe-a8961b4bf5ee"/> </aixm:associatedRunways>…

Page 28: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 28

5- Get Runway contamination

• http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept/runways/58ea128d-1bbe-47f6-92fe-a8961b4bf5ee?contaminations=yes

<aixm:areaContaminant> <aixm:RunwaySectionContamination>

<aixm:observationTime>2009-10-09T09:00:00Z</aixm:observationTime> <aixm:depth uom="MM">1</aixm:depth> <aixm:frictionEstimation>MEDIUM</aixm:frictionEstimation> <aixm:frictionDevice>BRD</aixm:frictionDevice> <aixm:obscuredLights>NO</aixm:obscuredLights> <aixm:layer>

<aixm:SurfaceContaminationLayer> <aixm:layerOrder>1</aixm:layerOrder> <aixm:type>WATER</aixm:type> </aixm:SurfaceContaminationLayer>

</aixm:layer> <aixm:section>2_THIRD</aixm:section>

</aixm:RunwaySectionContamination></aixm:areaContaminant>

Page 29: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 29

6 - Time based

• http://l-accept-04.pulsar.be/ec-xsnowtam-rest-accept/runways/58ea128d-1bbe-47f6-92fe-a8961b4bf5ee?date=9/10/2009%2009:00&contaminations=yes

Page 30: SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM

AIXM XML Developers' Seminar 30

AIXM 5.1

• TEMPDELTA and a BASELINE