Summary

The intent of this guide is to assist consumers in the process of migrating from the UML2 3.x API, based on the UML 2.2 specification, to the new UML2 4.0 API, based on the UML 2.4 specification, and to summarize any new features of the implementation that developers may want to take advantage of.

Kenn Hussey Last Updated: October 19, 2011

Introduction

The Eclipse UML2 (Unified Modeling Language 2.x) project is an EMF-based implementation of the UML 2.x metamodel for the Eclipse platform. This implementation was previously compliant with the 2.2 version of the UML specification, for which newer versions, namely 2.3 and 2.4 (and soon, 2.4.1), have been released by the Object Management Group (OMG) over the past couple of years. The source code for the UML2 project used to be stored in a CVS repository and its installable artifacts (update sites and downloads) were produced using an unsupported pre-Athena build system running on a machine that was at risk of being decommissioned in the near future.

The UML2 metamodel implementation has been enhanced so that it is compliant with the 2.4 and, implicitly, 2.3 version of the UML specification. This enhanced implementation has been delivered as a new version, 4.0, of the UML2 project, to be released as part of the Juno simultaneous release of Eclipse. The source code for this new version of the project is managed in an Eclipse git repository and built, using Buckminster, on the Hudson installation at Eclipse.

UML 2.4 was actually released by the OMG as part of a series of revisions, also known as the “2.4 series”, which includes updated versions of the Meta Object Facility (MOF) and MOF 2 XMI Mapping specifications as well. Based on a careful analysis of the delta between the previous UML2 implementation and the UML 2.4 and 2.3 specifications, described in more detail below, it was decided that the new version of UML2 would NOT be compatible with UML2 3.x. UML2 4.0 supersedes previous version(s) of the project (i.e., new major or minor versions of the 3.x stream will NOT be released) and is neither API contract nor binary compatible with UML2 3.x.

This migration guide has been provided to assist consumers in the process of migrating to the new UML2 4.0 API. An XMI-based (de)serialization mechanism (described herein) has also been provided to automatically migrate resources based on the UML2 3.x schema to the new 4.0 schema.

The changes in UML2 4.0 can be broken into functional areas, relating to various aspects of the EMF-based UML implementation provided by the UML2 project. The following sections describe each of these areas in detail.

API

The UML2 project provides a Java API that is generated using a (customized version of) the code generation facility in EMF. In the past, this API has been generated from a source model produced by merging models of Infrastructure, Superstructure, and L3 compliance level of UML with custom extensions introduced by the UML2 project. As of UML 2.4, however, a reference model of the merged L3 compliance level of UML, serialized in UML format, has been provided along with the specification by the OMG. As a result, the API is now generated from a source model produced by merging this merged L3 reference model with custom extensions introduced by the UML2 project.

The following subsections describe the changes to the classifiers, properties, operations, and constraints in the revised UML specifications which affected the API provided by UML2. It is worth noting that a number of the utilities and unit tests provided by UML2 were also modified in response to changes in the API.

Classifiers

Classifiers in UML are represented as Java interfaces, implementation classes, and enumerations in the UML2 API. These types are generated using the (customized) EMF code generator, along with associated factory and utility methods.

The following table lists the classifiers that were removed by the revised specifications. Removals that had a nontrivial impact on API compatibility and/or migration of legacy resources are highlighted in yellow.

The following table lists the classifiers that were modified by the revised specifications. Modifications that had a nontrivial impact on API compatibility and/or migration of legacy resources are highlighted in yellow.

Properties

Properties in UML are represented as Java fields with accessors (“getter” and “setter” methods) in the UML2 API. These members are generated using the (customized) EMF code generator and, in some cases (e.g., if a property is derived), implemented or customized by hand.

The following table lists the properties that were removed by the revised specifications. Removals that had a nontrivial impact on API compatibility and/or migration of legacy resources are highlighted in yellow.

The following table lists the properties that were modified by the revised specifications. Modifications that had a nontrivial impact on API compatibility and/or migration of legacy resources are highlighted in yellow.

Constraints

Constraints in UML are represented as Java methods in the UML2 API. The signatures for these methods are generated using the (customized) EMF code generator, along with an associated validator utility class, and their bodies are implemented by hand.

The following table lists the constraints that were removed by the revised specifications. Removals that had a nontrivial impact on API compatibility are highlighted in yellow.

Package Merge

The UML2 project provides an implementation of the package merge algorithm described in the UML specification. This utility is intended for use by clients but is also used to produce the source model for generating the API itself. Changes in the revised specifications (to resolve issues 10515, 12532, and 13330) required updates to this utility.

The following changes with respect to package merge are of particular note:

A new option, Empty Qualified Names, reports cases where the qualified name of a classifier is found to be empty.

Another new option, Indistinguishable Classifiers, reports cases where a classifier is indistinguishable from the other classifiers in a given package.

Profiles

The UML2 project provides an implementation of the profiles mechanism described in the UML specification. This implementation supports definition of “static” or “dynamic” profiles containing stereotypes to extend the UML metamodel with domain-specific tagged values. Changes in the revised specifications (to resolve issues 11160, 12833, 13306, 14092, 15006, and 15370) required updates to this mechanism.

The following changes with respect to profiles are of particular note:

The Standard profile that was provided by previous releases of UML2 has been split into two, corresponding to the L2 and L3 profiles defined in the UML specification.

Static (rather than dynamic) implementations of the L2 and L3 profiles have been provided by UML2, hence the introduction of new org.eclipse.uml2.uml.profile.l2 and org.eclipse.uml2.uml.profile.l3 bundles, respectively.

The profiles mechanism in UML2 now supports packages nested within profiles and stereotypes owned by packages; the Ecore definition for such profiles will have the corresponding structure (i.e., nested Ecore packages).

The new Package::URI property is now used to define the namespace URI of a profile (and nested packages), unless it is overridden by the nsURI tag from the Ecore profile.

The following changes with respect to resources are of particular note:

TBD

Legacy Interchange

The UML2 project supports interchange of legacy resources, i.e., artifacts that were created using older versions of the project. This XMI-based migration mechanism was enhanced to deal with the incompatibilities introduced by the new version of the UML2 API and schema. A mapping between the legacy UML2 3.x metamodel and the proposed new UML2 4.0 metamodel was created (using the Ecore2Ecore and Ecore2XML mechanisms provided by EMF) and existing mappings for older versions of the UML2 schema were updated. New resource handler and extended metadata implementations were also developed to cover transformations which could not be automated during deserialization.

The following changes with respect to legacy interchange are of particular note:

TBD

XMI Interchange

The UML2 project supports interchange of OMG-compliant XMI resources, i.e., artifacts that were created using other tools that conform to the UML specification. This XMI-based mechanism was enhanced to deal with XMI documents that conform to the 2.4 version of the UML specification. New resource handler and extended metadata implementations were also developed, and existing ones (supporting older versions of OMG-compliant XMI) were updated.

The following changes with respect to XMI interchange are of particular note:

The org.omg.xmi.nsURI and org.omg.xmi.nsPrefix CMOF tags now are serialized for profiles when saving them in OMG XMI format.

CMOF Interchange

The UML2 project supports interchange, and automatic conversion to and from UML, of Complete MOF (CMOF) resources. This XMI-based interchange mechanism was enhanced to deal with changes made in both UML 2.4 and MOF 2.4. A mapping between the CMOF 2.4 metamodel and the new UML2 4.0 metamodel was created (using the Ecore2Ecore mechanism provided by EMF) and existing mappings for older versions of the schemas were updated. New resource handler and extended metadata implementations were also developed to cover transformations which could not be automated during deserialization.

The following changes with respect to CMOF interchange are of particular note:

TBD

Ecore / UML Conversion

The UML2 project provides utilities for conversion of UML models to and from a corresponding Ecore representation. These utilities are intended for use by clients but an integral part of the process followed to produce source models, generate code for the UML2 project, and define profiles. Changes to the API, as described above, required updates to these utilities; in particular, they needed to take the new Package::URI and Property::isID properties into account when performing conversions.

The following changes with respect to Ecore / UML conversion are of particular note:

TBD

Examples

The UML2 project provides a number of examples, including editor actions which are in fact used by the UML2 project to produce some of the artifacts it publishes. These examples will were updated based on the changes that were made to the API and reference resources described above. More specifically, the actions to generate the standard profile and UML primitive types library were updated based on the XMI resources provided by the OMG and the actions to convert models to model libraries or metamodels were updated to make use of the new (static) standard profile implementations mentioned above.

The following changes with respect to source code are of particular note:

TBD

Source Code

As mentioned already, the UML2 project has(as other projects have) switched to git instead of CVS as its source code management system for the upcoming Juno release. In fact, all of the changes for UML2 4.0 have been committed (and pushed) to git (only).

The following changes with respect to source code are of particular note:

TBD

Builds

As mentioned above, the installable artifacts (update sites and downloads) for the UML2 project were previously produced using an unsupported pre-Athena build system running on a machine that was at risk of being decommissioned. Buckminster was used instead to develop a new build system which now runs on Hudson and extracts the UML2 source code from git. The resulting artifacts are published to a new set of UML2-specific p2 repositories (instead of the antiquated MDT one) and included in the top-level composite repositories for the Modeling project.