diff options
Diffstat (limited to 'doc/org.eclipse.emf.teneo.doc/tutorials/jpox/ejb3_format.html')
-rw-r--r-- | doc/org.eclipse.emf.teneo.doc/tutorials/jpox/ejb3_format.html | 459 |
1 files changed, 459 insertions, 0 deletions
diff --git a/doc/org.eclipse.emf.teneo.doc/tutorials/jpox/ejb3_format.html b/doc/org.eclipse.emf.teneo.doc/tutorials/jpox/ejb3_format.html new file mode 100644 index 000000000..7b666883b --- /dev/null +++ b/doc/org.eclipse.emf.teneo.doc/tutorials/jpox/ejb3_format.html @@ -0,0 +1,459 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta content="Apache Forrest" name="Generator"> +<meta name="Forrest-version" content="0.7"> +<meta name="Forrest-skin-name" content="elver4"> +<style type="text/css"> + /* */ + @import "../skin/tigris.css"; + @import "../skin/quirks.css"; + @import "../skin/inst.css"; + /* */ + </style> +<link media="print" href="../skin/print.css" type="text/css" rel="stylesheet"> +<link href="../skin/forrest.css" type="text/css" rel="stylesheet"> +<link rel="shortcut icon" href="../"> +<script type="text/javascript" src="../skin/tigris.js"></script><script src="../skin/menu.js" language="javascript" type="text/javascript"></script> +<title>Format of EJB3 Annotations as EAnnotations</title> +<meta content="text/css" http-equiv="Content-style-type"> +</head> +<body class="composite" onload="focus()"> +<div id="banner"> +<table width="100%" cellpadding="8" cellspacing="0" border="0"> +<tr> +<td align="left"> +<div> +<a href="http://www.elver.org"><img class="logoImage" alt="Elver Store" src="../images/ELV2.gif"></a> +</div> +<span class="alt">Elver Store</span></td><td align="center"> +<div> +<a href="http://www.elver.org/"><img class="logoImage" alt="Elver" src="../images/empty.gif"></a> +</div> +</td><td valign="top" align="right"> +<div class="right" align="right" id="login"> +<form target="_blank" action="http://www.google.com/search" method="get"> +<select name="as_sitesearch"><option value="">Search...</option><option value="www.elver.org">The elver site</option><option value="">The web</option></select> for + <input size="15" name="as_q" id="query" type="text"><input name="Search" value="Go" type="submit"> +</form> +</div> +</td> +</tr> +</table> +</div> +<div id="toptabs" class="tabs"> +<table border="0" cellspacing="0" cellpadding="4"> +<tr> +<td><a class="base-selected" href="../index.html">Home</a></td><td><a class="base-selected" href="../hibernate/index.html">EMF Hibernate</a></td><th><a class="base-selected" href="../jpox/index.html">EMF JDO/JPOX</a></th><td><a class="base-selected" href="../services/index.html">Services</a></td> +</tr> +</table> +</div> +<table width="100%" border="0" cellpadding="0" cellspacing="0" id="breadcrumbs"> +<tr> +<td></td><td> +<div class="published" align="right"> +<script type="text/javascript" language="JavaScript"><!-- + document.write("Published: " + document.lastModified); + // --></script> +</div> +</td> +</tr> +</table> +<table id="main" width="100%" cellpadding="4" cellspacing="0" border="0"> +<tr valign="top"> +<td style="padding: 0px" width="20%" id="leftcol"> +<table width="100%" class="menuarea" cellspacing="0" cellpadding="0"> +<tr> +<td width="6px" valign="top"> +<table border="0" cellpadding="0" cellspacing="0" class="leftpagemargin"> +<tr> +<td class="subborder trail"> </td> +</tr> +</table> +</td><td class="dialog"> +<div class="menu"> +<div onclick="SwitchMenu('menu_1.1')" id="menu_1.1Title" class="menutitle">Home</div> +<div id="menu_1.1" class="menuitemgroup"> +<div class="menuitem"> +<a href="../jpox/index.html">Introduction</a> +</div> +<div class="menuitem"> +<a href="../jpox/features.html">Features</a> +</div> +<div class="menuitem"> +<a href="../jpox/status.html">Status</a> +</div> +<div class="menuitem"> +<a href="../jpox/overview.html">Overview</a> +</div> +<div class="menuitem"> +<a href="../jpox/changelog.html">Changelog</a> +</div> +<div class="menuitem"> +<a href="../jpox/installation.html">Download & Install</a> +</div> +<div class="menuitem"> +<a href="../jpox/knownissues.html">Known Issues</a> +</div> +<div class="menuitem"> +<a href="../jpox/quick_tutorial.html">Quick Start</a> +</div> +<div class="menuitem"> +<a href="../jpox/license.html">License</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.2')" id="menu_1.2Title" class="menutitle">Library Tutorial</div> +<div id="menu_1.2" class="menuitemgroup"> +<div class="menuitem"> +<a href="../jpox/tutorial1/tutorial1_intro.html">Introduction</a> +</div> +<div class="menuitem"> +<a href="../jpox/tutorial1/tutorial1_1.html">Generate OR Mapping File</a> +</div> +<div class="menuitem"> +<a href="../jpox/tutorial1/tutorial1_2.html">Create and Store EMF Object</a> +</div> +<div class="menuitem"> +<a href="../jpox/tutorial1/tutorial1_3.html">Retrieve EMF Objects</a> +</div> +<div class="menuitem"> +<a href="../jpox/tutorial1/tutorial1_4.html">Query EMF Objects</a> +</div> +<div class="menuitem"> +<a href="../jpox/tutorial1/tutorial1_5.html">Using EMF/JPOX Resources</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.3')" id="menu_1.3Title" class="menutitle">Library Editor tutorial</div> +<div id="menu_1.3" class="menuitemgroup"> +<div class="menuitem"> +<a href="../jpox/tutorial2/tutorial2_intro.html">Introduction</a> +</div> +<div class="menuitem"> +<a href="../jpox/tutorial2/tutorial2_1.html">Initialize the Library Editor</a> +</div> +<div class="menuitem"> +<a href="../jpox/tutorial2/tutorial2_2.html">Run the Library Editor</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.4')" id="menu_1.4Title" class="menutitle">Details</div> +<div id="menu_1.4" class="menuitemgroup"> +<div class="menuitem"> +<a href="../jpox/inheritance.html">Inheritance Mapping</a> +</div> +<div class="menuitem"> +<a href="../jpox/jpox_details.html">JPOX Details</a> +</div> +<div class="menuitem"> +<a href="../jpox/jpoxresources.html">EMF/JPOX Resources</a> +</div> +<div class="menuitem"> +<a href="../jpox/resource_utility.html">Resource Utility</a> +</div> +<div class="menuitem"> +<a href="../jpox/jpoxdatastore.html">JpoxDataStore</a> +</div> +</div> +<div onclick="SwitchMenu('menu_selected_1.5')" id="menu_selected_1.5Title" class="menutitle">Annotations (EJB3)</div> +<div id="menu_selected_1.5" class="selectedmenuitemgroup"> +<div class="menuitem"> +<a href="../jpox/ejb3_features.html">Supported Ann.</a> +</div> +<div class="menupage"> +<div class="menupagetitle">EAnn. Format</div> +</div> +<div class="menuitem"> +<a href="../jpox/ejb3_examples.html">EAnn. Examples</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.6')" id="menu_1.6Title" class="menutitle">XML Schema</div> +<div id="menu_1.6" class="menuitemgroup"> +<div class="menuitem"> +<a href="../jpox/features_details.html">XML Schema Features</a> +</div> +<div class="menuitem"> +<a href="../jpox/featuremap.html">Feature Map/Mixed Content</a> +</div> +<div class="menuitem"> +<a href="../jpox/substitution.html">Substitution Group</a> +</div> +<div class="menuitem"> +<a href="../jpox/anytype.html">xsd:any/xsd:anyType</a> +</div> +<div class="menuitem"> +<a href="../jpox/schema_list.html">XML Schema Examples</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.7')" id="menu_1.7Title" class="menutitle">Support</div> +<div id="menu_1.7" class="menuitemgroup"> +<div class="menuitem"> +<a href="../jpox/troubleshooting.html">Troubleshooting</a> +</div> +<div class="menuitem"> +<a href="../jpox/upgrading.html">Upgrading</a> +</div> +<div class="menuitem"> +<a href="../jpox/mailinglist.html">Mailinglist</a> +</div> +<div class="menuitem"> +<a href="../jpox/emfjpoxsupport.html">EMF/JPOX Support</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.8')" id="menu_1.8Title" class="menutitle">Developer</div> +<div id="menu_1.8" class="menuitemgroup"> +<div class="menuitem"> +<a href="../jpox/svn.html">Subversion</a> +</div> +<div class="menuitem"> +<a href="../jpox/testcases.html">Test cases</a> +</div> +</div> +</div> +</td> +</tr> +<tr> +<td></td><td> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr> +<td class="border bottom-left"></td><td class="border bottomborder"></td><td class="border bottom-right"></td> +</tr> +</table> +</td> +</tr> +<tr> +<td colspan="2" height="10"></td> +</tr> +</table> +<table></table> +<table></table> +<div class="strut"> </div> +</td><td> +<div class="content"> +<div id="bodycol"> +<div id="apphead"> +<h2> +<em>Format of EJB3 Annotations as EAnnotations</em> +</h2> +</div> +<div class="app" id="projecthome"> +<ul class="minitoc"> +<li> +<a href="#target">Introduction</a> +</li> +<li> +<a href="#simplenokeyvalye">Annotation without key-value</a> +</li> +<li> +<a href="#simple">Annotation with key-value</a> +</li> +<li> +<a href="#multi">Complex Annotation with multi-level structure</a> +</li> +<li> +<a href="#omondo">Where/how to specify annotations in Omondo</a> +</li> +<li> +<a href="#rr">Where to specify annotations in Rational Rose</a> +</li> +</ul> + +<p>EJB3 uses java annotations while Elver EJB3 is based on EMF EAnnotations. The main difference between java + annotations and EAnnotations is that the latter does not support multi-level structures. An example of a + multi-level annotation is the Columns annotation which contains Column annotations. + This can not be expressed directly in an EAnnotation. With Elver we use a slightly + different syntax to handle multi-level structures. + </p> + +<a name="N10010"></a><a name="target"></a> +<div class="h3"> +<h3>Introduction</h3> + + +<p>EJB3 EAnnotations in Elver always have the source: http://ejb.elver.org. Elver specific annotations which have + been added to support additional functionality have the source: http://annotation.elver.org.</p> + +<p>The name of the EJB3 annotation is appended to the source: http://ejb.elver.org/Basic.</p> + +<p>To make an annotation unique sometimes an extra identifying code needs to be appended to the source: + for example http://ejb.elver.org/Column/c1.</p> + +<p>The key of the annotation corresponds to the key in the EJB3 annotation.</p> + +<p>An EJB3 Annotation can have different targets: TYPE, METHOD and FIELD (see the EJB3 spec). Annotations + with a TYPE target can be used for EMF EClasses, annotations with METHOD and FIELD targets can be used for + EStructuralFeatures. <em>Note:</em> EJB3 annotations relevant for a non-reference type java member can also be set on + an EDataType (see <a href="ejb3_features.html#edatatype">here</a> for more information).</p> + +<p>Multiple values in a multi value annotation are separated by spaces, for example:</p> + +<pre class="code"><xsd:appinfo source="http://ejb.elver.org/OneToMany" ecore:key="cascade">MERGE PERSIST</xsd:appinfo> + </pre> + +</div> + +<a name="N10034"></a><a name="simplenokeyvalye"></a> +<div class="h3"> +<h3>Annotation without key-value</h3> + + +<p>An example of an EJB3 annotation without a key-value pair is the Embedded annotation.</p> + +<p>In a XML Schema model the Embedded annotation is specified as follows:</p> + +<pre class="code"> +<xsd:element name="secondEmbedded" type="this:Embeddable"> + <xsd:annotation> + <xsd:appinfo source="http://ejb.elver.org/Embedded">true</xsd:appinfo> + </xsd:annotation> +</xsd:element> + </pre> + +<p>In an UML model the Embedded annotation is specified as follows:</p> + +<pre class="code"> +http://ejb.elver.org/Embedded + </pre> + +</div> + +<a name="N1004C"></a><a name="simple"></a> +<div class="h3"> +<h3>Annotation with key-value</h3> + + +<p>An example of an EJB3 annotation with a key-value pair is the Basic annotation.</p> + +<p>In a XML Schema model the Basic annotation is specified as follows:</p> + +<pre class="code"> +<xsd:element name="myOptionalBasic" type="xsd:string"> + <xsd:annotation> + <xsd:appinfo source="http://ejb.elver.org/Basic" ecore:key="optional">true</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/Basic" ecore:key="fetch">EAGER</xsd:appinfo> + </xsd:annotation> +</xsd:element> + </pre> + +<p>In UML the annotation is specified as follows:</p> + +<pre class="code"> +http://ejb.elver.org/AttributeOverride name='name' column='c1' + </pre> + +<p>It is explained below what a column with value c1 means.</p> + +</div> + +<a name="N10067"></a><a name="multi"></a> +<div class="h3"> +<h3>Complex Annotation with multi-level structure</h3> + + +<p>An example of a more complex annotation is the + AttributeOverrides annotation which can contain multiple AttributeOverride annotations.</p> + +<p>The AttributeOverrides annotation can be expressed in XML Schema as follows:</p> + +<pre class="code"> +<xsd:element name="embedded" type="this:Embeddable"> + <xsd:annotation> + <xsd:appinfo source="http://ejb.elver.org/Embedded">true</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/AttributeOverrides" + ecore:key="value">a1 a2</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/AttributeOverride/a1" + ecore:key="name">myString</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/AttributeOverride/a1" + ecore:key="column">c1</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/Column/c1" + ecore:key="name">columnString1</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/AttributeOverride/a2" + ecore:key="name">myInteger</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/AttributeOverride/a2" + ecore:key="column">c2</xsd:appinfo> + <xsd:appinfo source="http://ejb.elver.org/Column/c2" + ecore:key="name">columnInteger1</xsd:appinfo> + </xsd:annotation> +</xsd:element> + </pre> + +<p>This annotation models an embedded type by tagging the element with an Embedded annotation. The AttributeOverrides define how the + properties of the embedded type are stored in the table. The AttributeOverrides consists of two AttributeOverride + annotations which + are named a1 and a2. The a1 is appended to the source to make it unique: http://ejb.elver.org/AttributeOverride/a1. + The AttributeOverride contains an column key with a value c1. This value c1 is used in the source of the + Column annotation to identify the Column annotation. + </p> + +<p>A multi-level annotation in uml is specified as follows:</p> + +<pre class="code"> +http://ejb.elver.org/Embedded +http://ejb.elver.org/AttributeOverride name='name' column='c1' +http://ejb.elver.org/Column/c1 name='bornNameColumn' + </pre> + +</div> + +<a name="N10082"></a><a name="omondo"></a> +<div class="h3"> +<h3>Where/how to specify annotations in Omondo</h3> + +<p>Double click on the element for which an annotation should be specified:</p> + +<div align="center"> +<img class="figure" alt="Omondo step 1" src="../images/omondo1.jpg"></div> + +<p>Press Add in Annotations:</p> + +<div align="center"> +<img class="figure" alt="Omondo step 2" src="../images/omondo2.jpg"></div> + +<p>Specify the full Elver name in the annotations field. The http://... prefix will be removed from the view when you press enter:</p> + +<div align="center"> +<img class="figure" alt="Omondo step 3" src="../images/omondo3.jpg"></div> + +<p>Press Add on the name/value attribute and specify one of the attributes for this annotation and press OK:</p> + +<div align="center"> +<img class="figure" alt="Omondo step 4" src="../images/omondo4.jpg"></div> + +<div align="center"> +<img class="figure" alt="Omondo step 5" src="../images/omondo5.jpg"></div> + +<p>and ready!</p> + +</div> + +<a name="N100AB"></a><a name="rr"></a> +<div class="h3"> +<h3>Where to specify annotations in Rational Rose</h3> + + +<p>The image below illustrates where to specify annotations in Rational Rose:</p> + +<p>The ecore model properties (ecore A, ecore B) are added to Rational Rose using the <a href="../examples/ecore.pty">ecore.pty</a> file.</p> + +<div align="center"> +<img class="figure" alt="Setting annotations in Rational Rose" src="../images/rose.jpg"></div> + +</div> + +</div> +</div> +</div> +</td> +</tr> +</table> +<div width="100%" id="footer"> +<table width="100%" cellpadding="4" cellspacing="0" border="0"> +<tr> +<td class="footer"><a href="license.html"> + Copyright © 2006 The Elver Project</a> + - All rights reserved. + </td> +</tr> +</table> +</div> +</body> +</html> |