re 2003 xAltarica - mbsaw2012.labri.fr · ENSAE 10 Avenue Edouard Belin , BP 4032 31055 Toulouse...

Post on 11-Jul-2020

0 views 0 download

Transcript of re 2003 xAltarica - mbsaw2012.labri.fr · ENSAE 10 Avenue Edouard Belin , BP 4032 31055 Toulouse...

xAltarica

Christophe Mareschalmareschal@cert.fr

ENSAE10 Avenue Edouard Belin , BP 403231055 Toulouse cedex 4

C.M

ares

chal

Jou

nées

Alta

rica

Mar

seill

es 2

2 23

Oct

obre

200

3

2C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

De l'extension d'xADL à l'apport d'XML à Altarica

Extension d'xADL2.0 à la SdF– Export de la sémantique d'altarica vers xADL2.0

– Spécification du langage altarica en XML = xAltaric a

– Mapping xAltarica - xADL2.0

L'apport d'XML pour le langage altarica et pour ses o utils support– Process XML mis en œuvre

– Valeur ajoutée

• Extensibilité

• Interopérabilité

3C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

Des techniques normalisées et répandues …

… et des outils accessibles : Applications, Librairi es, API

Le monde XML

Quizx

SaxonSAX DOM

JDOM

JAXP

XalanxmlSpy

JAXB

XML Schema

XMLparsers

Xquery .

XSL XSLT

Data Binding

xmlSpy

4C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

Les process avec XML

Validation

Specification

Transformation

XML to Java

Parsing

Altarica

vueAlta.xml

vueAlta.xml vueADL.xml

altaToADL.xsl

xAltarica

utils.xsdaltarica.xsdtimedaltarica.xsd

xAltaricaPackage Utils Package altaricaPackage timedaltarica

In Memory Model

DataFlow

xAltarica

xaltaricalib

5C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

Specification : XML Schema

Validation

Specification

Transformation

XML to Java

Parsing

6C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

DTD, XML Schema : Méta langages XML

Spécification xAltarica : XML Schema

SpecificationAltaricautils.xsdaltarica.xsdtimedaltarica.xsd

xAltarica

DTD, XML schema

7C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

utils.xsd altarica.xsd

timedaltarica.xsd

Spécification xAltarica : XML Schema

<<uses>>

BooleanExpression,BooleanValue,

Variable, Pointer...

Component,ConfigurationAssert,

Flow, Transition...

TimedComponent,Clock ...

• Le langage est spécifié par une collection de "sché mas".

• Un schéma est un document xml conforme à la norme XML schema

• Chaque schéma définit une partie du langage = "name space".

• Un schéma peut utiliser les éléments d'un autre sch éma (import et include),

l'ensemble est cohérent.

8C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

<xsd:complexType name="Component">

node

name

[flow]

[state]

[event]

[transition]

[assert]

(attr) name

Altarica : node xAltarica/altarica.xsd : Component

9C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22 2

3 oc

tobr

e 20

03

Typage et Héritage : <xsd:complexType name="TimedComponent">

<xsd:complexType name="TimedComponent "><xsd:complexContent>

<xsd:extension base="altarica:Component ">

<xsd:sequence minOccurs="0">

<xsd:element name="clock " type="Clock " />

</xsd:sequence>

</xsd:extension>

</xsd:complexContent>

</xsd:complexType>

10C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

De Altarica à xAltarica

Ce qui ne change pas : La sémantiqueCe qui change peu : Le lexique et la syntaxe

Node

ArchitectureComplexComponentComponent

Assert ConfigurationAssertComputationAssert

11C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Parsing et validation

Validation

Specification

Transformation

XML to Java

Parsing

12C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

SAX = "Simple API for XML" : "Read Only", lecture s équentielleDOM = "Document Object Model" : "Read-Write", arbre syntaxique

Parsing et validation : SAX, DOM, JAXP, JDOM

Validation

ParsingvueAlta.xml

xAltarica In Memory Model

DataFlow

XML schema

Document XMLXML Parser

SAX

DOM

13C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Parsing et validation : SAX, DOM, JAXP, JDOM

Les parseurs communs sont génériques

• Lecture et écriture de documents xml

• Interface entre le document xml et l'application• Contrôle de conformité lexicale et syntaxique

Quel que soit le langage, quelles que soient ses év olutions

Avec XML Schema, la validation gagne en puissance

JAXP = "Java API for XML Parsing" (Sun) : SAX & DOM

14C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Transformation : XSL

Validation

Specification

Transformation

XML to Java

Parsing

15C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Transformation : XSL, XSLT

XSL = eXtensible Stylesheet LangageXSLT = XSL Transformation

XSL TransformationdocX.xml

page.htmlXSL

doc.pdf

docY.xml

16C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Le document XSL contient les règles de transformati on

Xalan : Processeur XSLT java (inclus dans JAXP)Saxon : un autre processeur XSLT

Transformation : XSL, XSLT

Xalan, SaxonvueAltarica.xml vueADL.xml

altaricaToADL.xslDocument XSL

XSLTDocument XMLValidé xAltarica

Document XMLValidé ADL

17C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

ComponentType | ConnectorType

Signature

SubArchitectureArchstructure

Component #ComponentType

LinkSignatureInterfaceMapping

Mapping : xAltaRica <=> xADL

ComplexComponent

ControlComponentFlowEvent

Sub

#Component| #ComplexComponent

ConfigurationAssertSync

xAltarica xADL

18C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Archstructure Component| Connector

DescriptionInterface

# ComponentType | # ConnectorType

Mapping : xAltaRica <=> xADL

Component

FlowEventStateTransitionComputationAssert

xAltarica xADL

19C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

XML Java Data Binding

Validation

Specification

Transformation

XML to Java

Parsing

20C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Binding Compiler

XML JAVA Data Binding

xaltaricalib

IArchitecture.java

utils

altarica

IComponent.java

ComponentImpl.java

timedaltarica

ArchitectureImpl.java

xAltarica

utils.xsd

timedaltarica.xsd

…< xsd:ComplexType

name = "Architecture" >….

</ComplexType>…………..

<xsd:ComplexType

name : "Component" >….

altarica.xsd

21C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

getParentNode()getChildsNode()createElement()getAttribute(String name)setAttributeNode(String name, String Value)getElementByTagName(String name)….

Component.getFlows()Component.getStates()

Flow.setName(String name)new Component

…JAXB = "Java API for XML Data Binding " (Sun)

XML JAVA Data Binding : JAXB

DOM

xaltarica + JAXB

22C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

altaricaAPIaltaricaAPI

JAXB Compiler = Automatisation du Data BindingJAXB Run Time = Parsing, validation

XML JAVA Data Binding : JAXB

JAXB CompilerxAltarica xaltaricalibSchémas XML

archi.xml

Document XML

JAXB Run Time

Modèle Objet Conforme

altaricaAPI

Altarica Application

Classes &InterfacesDérivées

23C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Valeur Ajoutée

Validation

Specification

Transformation

XML to Java

ParsingEvolutivité & Interopérabilité

24C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Evolutivité

• Extensions XML schema modulaires

• Non régressives sur le reste du langage

• Sans effet sur les outils xml génériques

• Adaptation DataBindingLibrary par simple recompilatio n

• Adaptation API "Syntax directed" : de facto

=> un langage extensible

=> des outils adaptables et pérennes

25C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Interopérabilité

• Utilisation modulaire de plusieurs schémas

• Transformation XSL : xml vers xml ou autre

• DataBindingLibrary + API spécifiques

• xQuery : A voir

=> des usages multiples et adaptés

=> des échanges facilités

26C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Synthèse

• Spécification d'altarica au format xml (XML Schema)

• Traitements XML

Parsing, Validation Syntaxique, Transformation, Accès aux données ...

• Intégration XML

API génériques (DOM, XSLT, JAXP)

Couple XML-Java (JAXP) Data Binding (JAXB)

• Bénéfice

Extensibilité

Interopérabilité

27C

hris

toph

e M

ares

chal

-Jo

unée

s A

ltaric

a M

arse

ille

22

23 o

ctob

re 2

003

Perspectives

• Développer la spécification : versions et variantes d' xAltarica

• Adapter et développer des outils compatibles xml/xA ltarica

• Etudier le mapping et l'interopérabilité avec xADL (et +)

A Suivre ...

http://www.cert.fr/francais/deri/mareschal/altarica /xaltarica.html