Documente Academic
Documente Profesional
Documente Cultură
By Joel Kozikowski
The purpose of this document is to give a high level view of the entire AndroMDA
system so you can quickly get up to speed in using it. It is intended to be used
by an experienced developer (but new to AndroMDA) as a road map to find their
way around all of the components. It does not go into detail on any one aspect of
the system. Instead, it identifies common how does that work type questions,
and then points you to material for further study. A basic understanding of UML is
assumed. If you are completely new to UML, you may want to try one of the
numerous books on the subject before tackling AndroMDA. A good crash
course on UML can be found here:
http://bdn.borland.com/article/0,1410,31863,00.html
System overview
AndroMDA is a code generation tool that takes a UML model as input and
generates source code as output. Using a series of template files (which you can
customize if you wish), AndroMDA can produce source code from a UML model
in any programming language. Default templates exist to generate Java code
(and in particular J2EE code).
There are two primary components used in the AndroMDA system:
1. The AndroMDA code generation engine.
2. Apaches Maven project builder and management system.
The AndroMDA code generator is actually a generic code generation engine. The
engine is a platform that hosts code modules (called cartridges) that do the
actual code generation. An AndroMDA cartridge is a collection of source code
template files and Java helper classes (called Metafacades) packaged into a
.JAR file. There are a variety of pre-existing cartridges that you can plug in to
the engine to generate code a particular way. The pre-existing cartridges all
generate Java source code for various popular Open Source libraries (such as
Spring, Hibernate, and J2EE). The engine is not limited to these however. You
can write your own cartridges, and (at least in theory) generate code from UML
for any programming language.
An excellent explanation/demonstration of AndroMDAs capabilities can be found
in the HowTo guide explaining how to model using the Spring Cartridge. There,
you can see examples of a UML model, and the resulting Java source code (very
valuable to study). For more details, see http://www.andromda.org/andromdaspring-cartridge/howto1.html
AndroMDA configuration
The AndroMDA engine is ultimately driven by the configuration information found
in the file andromda.xml. If using a project generated by the Maven app
generator plug-in, this file is located in the <projectDir>/mda/conf sub-directory.
This file contains, among other things, the name of the UML model file to be used
by the engine, as well as configuration settings for the various AndroMDA
Cartridges used by your project (these settings are segregated from each other
in sections called namespaces).
For general information about the configuration information found in
andromda.xml, see http://www.andromda.org/configuration.html
For information about cartridge specific configuration options, first go to the
AndroMDA Cartridge page (http://www.andromda.org/andromdacartridges/index.html), select the desired cartridge from the Available Cartridges
menu on the left, then select the Namespace option under the Documentation
menu.
If you used the Maven app generator (and subsequently use Maven to actually
build your project), many of the configuration values found in andromda.xml are
actually delegated up to Maven build properties.
The file <projectDir>project.properties contains Maven properties that are
passed down to andromda.xml (and other parts of the build scripts) that are
project wide settings (regardless of which developer is currently building the
system, and which version is being built). These include things such as JDBC
configuration settings, which database dialect you want Hibernate to use (e.g.
Hypersonic, mySQL, etc.).
The file <projectDir>build.properties contains Maven properties that are
specific to the version being built.
Maven build properties can also be overridden on a workstation (and/or
developer) by workstation basis. For more information about Maven build
properties in general, see http://maven.apache.org/reference/properties.html
For information about cartridge specific stereotypes and tagged values, first go to
the AndroMDA Cartridge page (http://www.andromda.org/andromdacartridges/index.html), select the desired cartridge from the Available Cartridges
menu on the left, and then select the Profile option on the left hand menu.
For more information on the Model Driven Architecture methodology in general,
see http://www.omg.org/mda/
<properties>
<propertyname="mergeLocation">$
{maven.src.dir}/customTemplates/andromda
hibernate</property>
</properties>
</namespace>
When you specify a mergeLocation property, the AndroMDA engine will first
look in your mergeLocation directory when looking for a particular template file. If
it does not find it, it will fall back on the cartridges .JAR file.
See Overriding cartridge resources at http://www.andromda.org/andromdacartridges/index.html for more details.