blob: fd39b4722c499215e8cb20d96e6035b1ee30ec75 [file] [log] [blame]
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Creating Metamodel Bindings</title>
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="OCL Documentation">
<link rel="up" href="ProgrammersGuide.html" title="Classic Ecore/UML Programmers Guide">
<link rel="prev" href="Persistence.html" title="OCL Persistence">
<link rel="next" href="ImpactAnalyzer.html" title="Incrementally Re-Evaluating OCL Expressions Using the Impact Analyzer">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Creating Metamodel Bindings</h1>
<div class="section" title="Creating Metamodel Bindings">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="AdvancedMetamodelBindings"></a>Creating Metamodel Bindings</h2>
</div>
</div>
</div>
<p>The Eclipse OCL component provides a generic specification of the OCL Abstract Syntax Model
plus bindings for two popular Eclipse metamodels: Ecore and UML. Users of the OCL API
can likewise create bindings for their metamodels, to integrate OCL with their modeling
languages.</p>
<p>The
<a class="ulink" href="http://download.eclipse.org/ocl/javadoc/6.3.0/org/eclipse/ocl/Environment.html" target="_new">
<code class="code">Environment</code>
</a> interface has a generic type signature with several parameters, representing the metamodeling
constructs required by OCL, that it borrows from UML, EMOF, and the other metamodels that
it targets. The Javadoc for that interface defines the mappings, and the same type parameter
names are used consistently throughout the OCL API.
</p>
<p>
</p>
<div class="mediaobject">
<img src="images/5180-bindings.png"></div>
<p>
</p>
<p>To provide a metamodel binding, a client must provide implementations of the following interfaces:</p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
<code class="code">Environment</code> and
<code class="code">EnvironmentFactory</code>, supplying suitable substitutions for the generic type parameters. Note that not all of these are actually required; for example, Ecore does not have the concept of
<code class="code">State</code>, so it just substitutes
<code class="code">EObject</code>
</p>
</li>
<li class="listitem">
<p>
<code class="code">EvaluationEnvironment</code> for accessing properties of run-time instances of models
</p>
</li>
<li class="listitem">
<p>
<code class="code">UMLReflection</code> for introspecting models (instances of thetarget metamodel)
</p>
</li>
<li class="listitem">
<p>
<code class="code">OCLStandardLibrary</code>, providing the instances of the metamodel&rsquo;s
<code class="code">Classifier</code> metaclass that implement the OCL Standard Library types
</p>
</li>
<li class="listitem">
<p>
<code class="code">OCLFactory</code>, providing a factory for all of the metaclasses of the Abstract Syntax Model
</p>
</li>
</ul>
</div>
<p>This last item, above, necessitates furthermore that the metamodel binding provide a
concrete specialization of the Abstract Syntax Model (in its entirety) that mixes in the
target metamodel&rsquo;s correspondents of the UML
<code class="code">Classifier</code> and
<code class="code">TypedElement</code> metaclasses. The former is required to provide
compatibility of the metaclasses in the OCL
<code class="code">Types</code> with the
target metamodel&rsquo;s type system. The latter is required for compatibility of the metaclasses
in the OCL
<code class="code">Expressions</code> package with the target metamodel&rsquo;s
typed elements.
</p>
<div class="section" title="The OCL Abstract Syntax Model">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="TheOCLAbstractSyntaxModel"></a>The OCL Abstract Syntax Model</h3>
</div>
</div>
</div>
<p>The following diagram summarizes the metaclasses of the OCL
<code class="code">Types</code> package:
</p>
<p>
</p>
<div class="mediaobject">
<img src="images/5180-ocltypes.png"></div>
<p>
</p>
<p>The following diagram summarizes the call expression metaclasses of the OCL
<code class="code">Expressions</code> package:
</p>
<p>
</p>
<div class="mediaobject">
<img src="images/5180-callexp.png"></div>
<p>
</p>
<p>The following diagram summarizes the literal expression metaclasses of the OCL
<code class="code">Expressions</code> package:
</p>
<p>
</p>
<div class="mediaobject">
<img src="images/5180-literalexp.png"></div>
<p>
</p>
<p>The following diagram summarizes the remaining metaclasses of the OCL
<code class="code">Expressions</code> package:
</p>
<p>
</p>
<div class="mediaobject">
<img src="images/5180-miscexp.png"></div>
<p>
</p>
</div>
</div>
</body>
</html>