The JMI module

UCL Logo
Sourceforge project page
UML 1.5 API Logo

UCL JMI Generator


The UCL JMI generator is similar to an implementation of the JMI specification. It is implemented using the velocity template engine. It has some quirks.

The first quirk is that it generates JMI from UML diagrams, rather than from MOF models as mandated by the JMI standard. This is not a really big deal, because UML class diagrams look like MOF models and are similarly expressive. However, it does mean that when you use the JMI reflective interfaces to query the meta-model of elements in the JMI repository, then you are dealing with UML types rather than the MOF types that you would expect. This reduces the compatibility of this code with generic code for using JMI repositories, and makes code written against generated interfaces less reusable.

The second quirk is that we didn't bother to implement live collections for association ends with an upper multiplicity bound greater than 1. Instead the instance interface features add and remove methods as well as the get method mandated by the specification. This means that our JMI implementations are not consistent with the specification.

Other quirks relate to further deviations from the specification. Our JMI implementation includes a publish/subscribe event model along the lines of the Javabeans specification. This may be accessed via extended reflective interfaces to model elements, which also support operations such as deep copies of parts of models, and compare by value.

The UCL JMI Generator is now largely obsolete, as it has been replaced by the JMI Generator that forms part of the EMOFOCL project, and which does not depend on the VTE. However, the EMOFOCL project still relies on the UCL JMI generator to produce its repository classes. This dependency will be removed in the EMOFOCL2 project. In summary we do not expect much further development of this part of the project.

The operation of the JMI generator may be depicted as follows:

View a comparison with the JMI generators in other modules here.

The UCL JMI Generator requires XMI of the type derived from the standard UML meta-model. The Posiedon UML Editor Community Edition certainly generates this type of XMI via its export option, and can be used to produce metamodels as input to the tool.

The generator loads the XMI using a DOM implementation and hand-written pre-processing code. It then uses the Velocity Template engine to generate a JMI implementation. The meta-model accessible via reflection contains types from the UML meta-model.

The project requires the following libraries to be placed in the lib directory of the source tree:

On build the project outputs the following jars in the build directory:

  • jmigen.jar - A JMI generator. Invoke using java -jar jmigen.jar for a list of command line arguments.
  • uclumljmi.jar - JMI interfaces and implementation for the static structure parts of the UML meta-model.

Read the file README.txt in the project root directory for more instructions.

Back home