blob: ccbba1f187980b9570987ad58c0afd2feed26d5a [file] [log] [blame]
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); $App = new App(); $Nav = new Nav(); $Menu = new Menu(); include($App->getProjectCommon()); # All on the same line to unclutter the user's desktop'
#*****************************************************************************
#
# template.php
#
# Author: Freddy Allilaire
# Date: 2005-12-07
#
# Description: Type your page comments here - these are not sent to the browser
#
#
#****************************************************************************
#
# Begin: page-specific settings. Change these.
$pageTitle = "AMW Use Case - Model annotation";
$pageKeywords = "annotation, model weaving, AMW, ATL, model transformation";
$pageAuthor = "Marcos Didonet Del Fabro";
# End: page-specific settings
#
# Paste your HTML content between the EOHTML markers!
$html = <<<EOHTML
<!-- Main part -->
<div id="midcolumn">
<h1><font color='#280882'>AMW</font> Use Case - Model annotations in Java 1.4</h1>
<a name="goals"></a>
<img align="right" src="../../resources/amwLogoSmall.png" valign="top" style="padding-left: 10px;" alt="AMW Logo" />
<blockquote>
<ul>
<li><a href="#overview"><b>Overview</b></a></li>
<li><a href="#download"><b>Download</b></a></li>
</ul>
</blockquote>
<hr class="clearer" />
<table>
<COLGROUP>
<COL width="2%">
<COL width="98%">
<tr>
<td></td>
This use case how AMW can be used to annotate a Java 1.4 metamodel.
<p/>
<h4 STYLE="font-size: 10pt; padding: 0; border-bottom: 2px solid #49457C; background-position: top left; background-repeat; repeat-x;">
<a name="overview">Overview</a></h4>
<p align="justify">
Models are annotated to add extra information that are not defined in the metamodel.
Consider we have a Java 1.4 model <i>Ma</i>. <i>Ma</i> conforms to a Java 1.4 metamodel <i>MMa</i>. The metamodel allows creating
the basic elements of Java, e.g., classes, properties, methods, if statements, and so on.
However, this metamodel does not supports annotations like in Java 5. The annotations are not defined in the metamodel,
and we do not want to extend the Java 1.4 metamodel.
<p/>
The annotations are created as a pair property-value. These annotations are linked with the Java model elements. These links and
annotations are defined in a weaving model <i>Mw</i> (see Figure below). This separation
between weaving model and Java model avoids polluting the model with additional information that is not relevant for the semantics.
<p align="center">
<img src="../resources/annotation.png"/>
<br /><br />
<b>Annotation weaving model</b>
</p>
This model conforms to an annotation extension to the core weaving metamodel (see below). It is important to note that the
<i>AnnotationModel</i> class has a single-valued reference to <i>AnnotatedModel</i>. This means the annotations are created (i.e., woven) only
in one model. The same analogy is true for the <i>Annotation</i> class, which is an extension to <i>WLink</i>. It contains a single-valued
reference to the model elements, plus a list of properties. The properties have an identification key and the corresponding value.
<p align="center">
<img src="../resources/ann_extension.png"/>
<br/><br/>
<b>Annotation metamodel extension</b>
</p>
The annotations may be created and edited in two ways. First, the annotation weaving models are created directly with the AMW plug-in,
as shown in the Figure below.
Second, the annotations can be created in an annotation DSL (Domain Specific Language), to be later injected into an annotation
weaving model. This model can also be edited in the AMW plug-in.
<p align="center">
<img src="../resources/annotation_amw.png"/>
<br /><br />
<b>Annotating a Java model in AMW</b>
</p>
</p>
<br>
<h4 STYLE="font-size: 10pt; padding: 0; border-bottom: 2px solid #49457C;
background-position: top left; background-repeat; repeat-x;">
<a name="download">Download</a></h4>
<table>
<COLGROUP>
<COL width="25%">
<COL width="75%">
<tr>
<td align="center">
<h3><a href="http://dev.eclipse.org/viewcvs/indextech.cgi/*checkout*/org.eclipse.gmt/AMW/org.eclipse.gmt.amw.zoo/extensions/mmw_annotation.km3">
Annotation extension</a></h3>
</td>
<td>
This file contains the annotation extension to the core weaving metamodel.
</td>
</tr>
<tr>
<td align="center">
<h3><a href="../../examples/JavaAnnotation/JavaAnnotation.zip">
Java annotation <br/>example</a></h3>
</td>
<td>
This example uses AMW to add annotations to a simple Java model.
</td>
</tr>
</table>
<p/>
</div><p/>
EOHTML;
# Generate the web page
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
?>