AndroMDA Server Howto

In order to get the best performance out of AndroMDA some improvements have been implemented that will significantly speed-up the generation process, one of these improvements is the AndroMDA server.

The server has been designed to (re)load the UML model in the background thereby minimizing the resources needed to keep track of the latest changes. There are at least two advantages:

  1. Since the model is kept in memory all the time, the initialization routines required to load it need only to be executed once. Especially in the case where you're regenerating multiple times per day the performance gain is tremendous.
  2. Changes to the model are loaded in the background, in a separate process, and this is done automatically when the server detects the model has been changed. That way the new model will already have been reloaded by the time you want to generate code from it.

Configuration

In order to properly launch the server you'll need to configure it in the andromda.xml configuration file. Assuming you have generated your project using andromdapp:generate this file will be located in /mda/conf/andromda.xml.

Since AndroMDA 3.2 the server will be configured by default, to fine-tune please see Configuring AndroMDA.

Just make sure the server is listening on a port which isn't in use. Typically the configuration will look like this:

    <server>
        <host>localhost</host>
        <port>4446</port>
    </server>

Starting/Stopping the server

So you know how to configure the server, but you're wondering how to launch it. It's very easy if you have generated your project using andromdapp:generate, just type maven start-andromda-server in the root of your project. Mind you, this will block the console so you'll need to open another one to call your project's maven goals. Call maven stop-andromda-server to stop the server process.

Starting and stopping the server has been included in the Maven andromda plugin, please see the corresponding goals documentation.

Example

Here is a step-by-step example on how to make sure things are properly working, we'll assume you have generated your project using at least AndroMDA version 3.2 as described in the Getting Started page.

  1. Open a console and go to the root of your project
  2. Open another console and go to the root of your project
  3. In the first console type maven start-andromda-server
  4. Watch the server initializing and loading the model
  5. In the second console type maven mda to generate code from the model (most of the time you'll want to build the entire project by simply typing maven, in this example we're performing the code generation part only)
  6. Open the UML model with your favorite UML editor, apply a change and save it
  7. Watch the server instance in the first console reloading the model
  8. Regenerate the code
  9. You can keep doing this until you are done modeling...

Don't forget Maven allows the -o flag which will instruct it not to download any dependencies, you should use it once you are certain all dependencies have been downloaded into your local Maven repository.