Generators Overview

The Context Mapper generators provide transformations to derive graphical Context Maps, PlantUML diagrams, Microservice Domain-Specific Langauge (MDSL) (micro-)service contracts, and Service Cutter input files from your CML context map. We also provide a generic, template-based generator based on Freemarker which allows to generate arbitrary textual files.


Using the Generators

Visual Studio Code

The generators are implemented as commands in VS Code. You can find them in the context menu of the CML editor:

Generators Context Menu in VS Code

Alternatively you find them in the command palette (Ctrl+Shift+P):

Generators in the VS Code Command Palette


The generators can be accessed through the Context Menu in the project explorer (right-click to *.cml file) or directly in the CML editor as the following screenshot shows:

Generators Context Menu in Eclipse

Note: In the CML editor, you can also access all generators with the keybinding Shift+Alt+G quickly.

Graphical Context Maps

The Context Map generator allows you to transform the CML Context Map into graphical representation inspired by the illustrations of Vernon and Brandolini. You can find out how to generate them here.

A sample Context Map produced with our generator is: Insurance Company Example Context Map

PlantUML Diagrams

You can generate plantUML component diagrams out of CML context maps. Additionally, the transformation generates UML class diagrams for all bounded contexts. If the implemented subdomains contain entities, the generator produces class diagrams for these subdomains as well. This page describes how to generate them.

Example component diagram (DDD sample): DDD Sample Component Diagram

Example class diagram (Cargo booking context): Cargo Booking Context

MDSL (Micro-)Service Contracts

With our MDSL generator you can generate (micro-)service contracts from your Context Maps (or, more precisely, from upstream bounded contexts that expose at least one aggregate that contains at least one operation in a service or entity). The resulting contracts illustrate how you can derive (micro-)services from strategic DDD context maps and provide assistance regarding how to implement your system as a (micro-)service-oriented architecture.

This is an examplary MDSL service contract for our insurance example:

// Generated from DDD Context Map 'Insurance-Example_Context-Map.cml' at 21.10.2019 17:48:52 CEST.
API description CustomerManagementContextAPI

data type Address { "street":V<string>, "postalCode":V<int>, "city":V<string> }
data type AddressId P
data type changeCustomerParameter { "firstname":V<string>, "lastname":V<string> }

endpoint type CustomersAggregate
    operation createAddress
      with responsibility "Creates new address for customer"
        payload Address
        payload AddressId
    operation changeCustomer
      with responsibility "Changes existing customer address"
        payload changeCustomerParameter
        payload V<bool>

// Generated from DDD upstream Bounded Context 'CustomerManagementContext' implementing OPEN_HOST_SERVICE (OHS) and PUBLISHED_LANGUAGE (PL).
API provider CustomerManagementContextProvider
  // The customer management context is responsible for managing all the data of the insurance companies customers.
  offers CustomersAggregate
  at endpoint location "http://localhost:8001"
    via protocol "RESTfulHTTP"

// Generated from DDD upstream Bounded Context 'CustomerManagementContext' implementing OPEN_HOST_SERVICE (OHS) and PUBLISHED_LANGUAGE (PL).
API client PolicyManagementContextClient
  // This bounded context manages the contracts and policies of the customers.
  consumes CustomersAggregate
API client CustomerSelfServiceContextClient
  // This context represents a web application which allows the customer to login and change basic data records like the address.
  consumes CustomersAggregate


Learn more about the MDSL generator here.

Service Cutter Input Files

Find out how to produce Service Cutter input to calculate possible service cuts or new bounded contexts here:

Service Cutter DDD Sample

Generic Textual Generator (Freemarker)

The generic, template-based generator allows you to generate arbitrary text files from CML Context Maps. It uses Freemarker as its template engine and exposes the entire CML content as an object tree whose elements can be injected into the template.

Learn more about this generator here.