Java Reference
In-Depth Information
Annotations
Sometimes it's important to add information to a model element for documenta-
tion purposes, or to provide parameters to be considered during transformation
or generation. EAnnotations provide these for all model elements in EMF. An
EAnnotation has a Source field, which serves as a key, and a list of References .
An EAnnotation may have zero or more Details Entry children, which have Key
and Value properties. This simple capability of annotating models is quite flexi-
ble and turns out to be useful for many purposes, including XSD support.
Another particularly useful application of annotations is to declare OCL
constraints, method bodies, and derived feature implementation, as discussed in
Section 3.2.4, “Applying OCL.”
3.2.2 Runtime Features
The EMF runtime includes facilities for working with instances of your models.
No strict dependencies exist on the Eclipse platform for the runtime and gener-
ated model and edit code, so these bundles can be used outside of the Eclipse
workbench. As bundles, they can be deployed in any Equinox OSGi container,
even within a server environment.
The generated code for your model has a dependency on the underlying EMF
runtime components. A significant benefit is gained from the generated Appli-
cation Programming Interface (API) and model implementation working with
the provided runtime features. An efficient observer pattern implementation is
provided to alert listeners to model change events. A generated reflective API
provides an efficient means of working with models dynamically. In fact, EMF
can be used in a purely dynamic fashion, requiring neither an . ecore model nor
code generation. Finally, it's possible to have static registration of a dynamic
package, but that's an advanced use case left to the EMF documentation.
When working with model instances, changes can be recorded in a change
model that provides a reverse delta and allows for transaction support. A vali-
dation framework provides for invariant and constraint support with batch pro-
cessing. The Model Transaction and Validation Framework components provide
enhanced transaction and validation support, respectively.
For persistence of models, the EMF runtime provides a default XML seriali-
zation. The persistence layer is flexible, allowing for XMI, Universally Unique
Identifiers (UUIDs), and even a zip option. A resource set consists of one or more
resources, making it possible to persist objects in multiple files, including cross-
containment references. Proxy resolution and demand loading improve perform-
ance when working with large models across resources. Additionally, use of EMF
Technology (EMFT) components Teneo and CDO allow for the persistence of
models to a relational database.
Search WWH ::




Custom Search