reuseLogostLogotudLogorewerseLogo modelplexLogo
gearsBG
Reuseware Composition Framework
Components, Modules, Aspects or something new?
Introduce new Composition Techniques into your Language of Choice with Reuseware!

Contents

Reuse Extension Language Reference

The Reuse Extension Language provides means to bind composition systems defined in the Composition System Specification Language to a concrete language that is defined by an Ecore metamodel. They are specified in files with the extension rex.

Examples

Several examples can be found in the Applications section. Here are some direct links to rex files:

REX File Structure

Header

The header of a reuse extension has the following schema:

 componentmodel ID
 implements     compositionSystemID
 epackages      <epackage> +
 rootclass      rootelementMetaclass     
 { fragmentRoleBindings + }

Fragment Role Bindings

A reuse extension consists of a set of fragment role bindings which again consist of a set of port type bindings which define the addressable point derivation rules.

 fragment role roleName {
    portTypeBinding +
 }
 port portTypeName {
    addressablePointDerivationRule +
 }

Addressable Point Derivation Rules

Addressable point derivation rules define how addressable points (i.e, Hooks, Slots, Prototypes and Anchors) that lay behind each port are found in a fragment. They are defined using the following schema:

 metaclass.feature? is addressablePointType if $OCLExpression$? {
   point expr = $OCLExpression$ ?
   port  expr = $OCLExpression$ ?
 
   value expr = $OCLExpression$ ?
 
   begin expr = $OCLExpression$ ?
   end   expr = $OCLExpression$ ?
 }


Advanced Topics

OCL: Operations on Strings

In addition to the standard OCL String API, the flavor of OCL in reuse extensions supports the complete Java String API. This means that operations like startsWith() or indexOf() can be used on Strings. Refer to the Javadoc for Strings to learn about the supported methods: Java String API

OCL: Refer to Container

Sometimes one needs to navigate from an element to its container in an OCL expression. The OCL flavor used in reuse extensions supports the eContainer() method to obtain a container. After using that method, the container needs to be manually casted to the correct type using oclAsType(). The following could be used to obtain the UML Package that contains the UML Class myClass:

 myClass.eContainer().oclAsType(UML::Package)

OCL: Metamodel Packages

Inside OCL expressions, you can refer to a class defined in a different EPackage than the one identified in the header. This might be required when using oclIsTypeOf() or oclIsKindOf().

 EPackageNsPrefix :: EClassName

For example...

 myElement.oclIsTypeOf(uml::Class)

...checks if myElement is an UML Class.

OCL: Handle Enumerations

To refer to a Literal of an Enumeration, use the following schema:

 EPackageNsPrefix :: EEnumName :: EEnumLiteralName

Retrieved from "http://www.reuseware.org/index.php/Reuse_Extension_Language"

This page has been accessed 826 times. This page was last modified 09:09, 7 May 2010.