ITWissen.info - Tech know how online

AndroMDA

AndroMDA (pronounced Andromeda) is a framework for generating program code based on Model Driven Architecture( MDA). MDA is the basic standard for generative development of software, which was specified by the Object Management Group( OMG) in June 2003. MDA implements a specification that is independent of specific technologies and can be used for the automatic generation of program code on various platforms such as J2EE, . NET or CORBA can be used.

In addition to AndroMDA, the OpenArchitecture-Ware framework, which is also available as open source, implements the OMG's MDA specification. AndroMDA was developed on the basis of the code generator UML2EJB by Matthias Bohlen and a large open source community - also called the AndroMDA team. The background to the development of AndroMDA was to be able to generate the corresponding program code directly on the basis of static and dynamic UML models. Cartridges are used to process the elements of the AndroMDA meta-models and then generate the program code fragments from them. Cartridges are currently available for Java, C#, JSF (JavaServer Faces), XmlSchema and Hibernate, among others. The framework also supports the realization of application-specific cartridges. The generation of program code for different target languages is controlled via templates, so that, for example, implementations for HTML or PHP can also be realized. For the creation of the UML models, AndroMDA is dependent on an external tool for modeling. However, from AndroMDA's point of view, the necessary requirements are met by a number of available modeling tools. Thus, redundant standard tasks - which are often a significant part of specific applications - can be automated with AndroMDA. Users report code generation rates of over 50% in this context.

Construction kit with different tools

AndroMDA is implemented as a comprehensive construction kit with different tools for generating program code within a complex framework.

Components of AndroMDA

Components of AndroMDA

The illustration shows therefore first of all the different components of AndroMDA, of which the most important ones are explained in the following briefly.

For the employment of AndroMDA an external UML modeling tool is needed, which must support the export of XML MetaData Interchange(XMI) files - in this format the created UML models are stored - in any case. Furthermore, it should be possible to create class diagrams, activity diagrams, UML Tagged Values and UML Constraints( OCL). One such example for the implementation of the mentioned requirements is the modeling tool MagicDraw, which is freely available in limited functionality at the link below.

As the figure shows, the entire framework is controlled via the Mavenplug-in, the foundations of which were created in the ApacheAntproject. Maven is a build management tool implemented in Java that takes a model-based, declarative approach to implementing the build process. This also significantly simplifies the implementation process.

Central components of AndroMDA

The MetaData Repository takes care of reading in the XMI file and mapping the UML model as an instantiated metamodel in memory. A separate Java object is instantiated for each model element. These objects are accessed via the JMI API (Java Metadata Interface). This provides the basis for further transformations.

Cartridges are the central component of code generation and consist of JAR archives with templates, metafacades and descriptors. Cartridges permit the processing of model elements, which are marked with stereotypes or whose dependence results from certain conditions. Cartridges are available for BPM4Struts, jBPM, JSF, EJB, Hibernate, Java, Meta, Spring, Webservice or XmlSchema. The creation of additional cartridges for individual needs is possible. The code to be generated is specified by the templates, which can be defined in the cartridge descriptor.

Metafacades (derived from: Metamodel Facades) provide access to the model objects of the MetaData repository and are based on the software design pattern Facades. This hides the complexity of the JMI behind simple interface classes. In addition, the metafacades perform other tasks such as validating the metamodel or implementing the translationlibraries and datatype mappings. The access to methods of the metafacade classes is realized via the templates.

The template engine supports the processing of the templates, whereby AndroMDA offers the use of two possible engines - Freemarker and Velocity.

Functionality of the Velocity Template Engine

Functionality of the Velocity Template Engine

The basic functionality of a template engine is demonstrated by the Velocity template engine shown in the figure. More information about the mentioned template engines is available at the link below.

The translation libraries enable the processing of expressions in Object Constraint Language (OCL) for queries to a database, for example. Finally, the Datatype Mappings translate the data types of the model into the target language specified in the descriptor.

In summary, the functionality of AndroMDA results from the following steps:

  • Transferring a UML model in XMI format,
  • Reading in the XMI file from the repository component,
  • Mapping in memory as an instantiated UML metamodel based on Java objects,
  • Access via metafacades and templates of a cartridge,
  • Control of code generation by template engine.
Informations:
Englisch: AndroMDA
Updated at: 28.10.2013
#Words: 810
Links: framework, program, code, monochrome display adapter (MDA), standard (STD)
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024