10 steps to write a cartridge

This article shows you how to write an AndroMDA cartridge in 10 distinct steps, using a sample cartridge which generates an Ant-like build script from a UML deployment model. This is why the tutorial cartridge is called "andromda-deployment".

Identifying the PSM metaclasses

When you have found the core concepts of your target platform, design them into classes, the PSM metaclasses. They will form the PSM metamodel.

  • Inside a PSM metaclass…

    • attributes capture target contents
    • associations define logical target structure
  • Later on, templates will transform PSM metaobjects to text format

    • PSM metaclass will need methods to return values which fill the placeholders in template scripts
    • Design those methods a little later when you know more about your PSM metaclass

For our deployment cartridge sample, the PSM metamodel looks like this:

With this metamodel, you have a clear understanding of what an Ant build file contains (at least for the scope of this tutorial):

  • A project can have a default target, a name and any number of targets.
  • A target can have a list of other targets it depends on, a name and any number of task calls.
  • A task call is a call to a named task which can be a compiler or a jar task