Skip to content

Commit 787b858

Browse files
authored
Feature/v4.x.x doc update (ContextMapper#14)
* Improve alert style * Add some notes regarding uniqueness and AR-7 * First MDSL generator doc
1 parent 07578cc commit 787b858

17 files changed

+247
-26
lines changed

Diff for: _data/docs.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
- ar-merge-aggregates
3737
- ar-merge-bounded-contexts
3838

39-
- title: User Guides
39+
- title: Generators
4040
docs:
41-
- service-cutter
41+
- mdsl
4242
- plant-uml
43+
- service-cutter

Diff for: _docs/architectural-refactorings/ar-merge-bounded-contexts.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ This Architectural Refactoring (AR) merges two bounded contexts together. The re
1616
of the two input bounded contexts. It can be applied if two bounded context are tightly coupled and the aggregates somehow
1717
belong together. This may improve the cohesion within the resulting bounded context.
1818

19+
**Notes:**
20+
* By applying this AR multiple times you may end with one single Bounded Context and an empty Context Map (no relationships).
21+
1922
**Inverse AR's:**
2023
* [AR-4: Extract Aggregates by Volatility](/docs/ar-extract-aggregates-by-volatility/)
2124
* [AR-5: Extract Aggregates by Cohesion](/docs/ar-extract-aggregates-by-cohesion/)
2225
* [AR-2: Split Bounded Context by Use Cases](/docs/ar-split-bounded-context-by-use-cases/) (may need multiple merges to completely revert)
2326
* [AR-3: Split Bounded Context by Owner](/docs/ar-split-bounded-context-by-owners/) (may need multiple merges to completely revert)
24-
27+
2528
## Preconditions
2629
* Your model needs **at least two bounded contexts** to merge.
2730

Diff for: _docs/architectural-refactorings/architectural-refactorings.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ support you with evolving and improving the architecture of your system.
1616

1717
We currently provide the following ARs:
1818

19-
| Name | Subject | Description | Input | Output |
20-
|-----------------------------------------------------------------------------------------------------|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|--------------------|
19+
| Name | Subject | Description | Input | Output |
20+
|---------------------------------------------------------------------------------------------------------|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|--------------------|
2121
| [**AR-1: Split Aggregate by Entities**](/docs/ar-split-aggregate-by-entities) | Aggregate | Splits an aggregate which contains multiple entities and produces one aggregate per entity. | 1 Aggregate | n Aggregates |
2222
| [**AR-2: Split Bounded Context by Use Cases**<sup>1</sup>](/docs/ar-split-bounded-context-by-use-cases) | Bounded Context | Splits a bounded context by grouping those aggregates together into one bounded context which are used by the same use case(s). | 1 Bounded Context | n Bounded Contexts |
2323
| [**AR-3: Split Bounded Context by Owner**<sup>1</sup>](/docs/ar-split-bounded-context-by-owners) | Bounded Context | Splits a bounded context by grouping those aggregates together into one bounded context which belong to the same team. | 1 Bounded Context | n Bounded Contexts |

Diff for: _docs/faqs.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ Have a look at our [CML Reference - Introduction](/docs/language-reference/) pag
2020
Have a look at the page [Language Semantic Model](/docs/language-model/) which introduces the semantic model of our DSL and lists the implemented semantic checkers.
2121

2222
### Which transformations can I apply to my CML model?
23-
Currently you can generate Service Cutter input to get suggestion for service cuts or new bounded context, and you can generate UML (plantUML) diagrams out of your CML. The following pages explain how you can do that:
23+
Currently you can generate [MDSL](https://socadk.github.io/MDSL/) (micro-)service contracts providing assistance regarding how your
24+
system can be implemented in an (micro-)service-oriented architectural style, [Service Cutter](http://servicecutter.github.io/) input
25+
to get suggestions for service cuts or new bounded context, and you can generate UML ([PlantUML](http://plantuml.com/)) diagrams
26+
out of your CML. The following pages explain the generators in detail:
2427

28+
* [Generate MDSL (Micro-)Service Contracts](/docs/mdsl/)
29+
* [Generate PlantUML Diagrams](/docs/plant-uml/)
2530
* [Generate Service Cutter Input Files](/docs/service-cutter/)
26-
* [Generate plantUML Diagrams](/docs/plant-uml/)
2731

2832
### How can I refactor my CML model?
2933
The Context Mapper tool provides a set of architectural refactorings which you can apply to your model. Find more information and all

Diff for: _docs/generators/mdsl.md

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
title: MDSL (Micro-)Service Contracts Generator
3+
permalink: /docs/mdsl/
4+
---
5+
6+
## Introduction and Motivation
7+
The [Microservices Domain Specific Language (MDSL)](https://socadk.github.io/MDSL/) is a DSL to specify (micro-)service contracts
8+
and data representations realizing API Description patterns from [Microservice API Patterns (MAP)](https://microservice-api-patterns.org/).
9+
10+
With our [MDSL](https://socadk.github.io/MDSL/) generator you can automatically produce (micro-)service contracts out of you strategic
11+
DDD context map written in CML. The generator creates the contracts according to the following mapping, which reflects our proposal
12+
how we would derive (micro-)services from models based on strategic DDD. The generator aims for providing assistance regarding how your
13+
system can be implemented in an (micro-)service-oriented architectural style.
14+
15+
### Generator Mapping
16+
17+
| CML Input | MDSL Output | Description |
18+
|----------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
19+
| Upstream Bounded Contexts from upstream-downstream [relationships](/docs/context-map/#relationships) | Service Specification (API description) | We create one service specification for each upstream Bounded Context of your Context Map. |
20+
| [Exposed Aggregates](/docs/context-map/#exposed-aggregates) | Endpoint | Every exposed Aggregate of your upstream Bounded Context results in one endpoint. |
21+
| Public methods/operations of the [aggregate root entity](/docs/tactic-ddd/#entity) or of [Services](/docs/tactic-ddd/#services). | Operation | Your exposed Aggregates should contain methods/operations, either on the [aggregate root entity](/docs/tactic-ddd/#entity) or in [Services](/docs/tactic-ddd/#services). For every method/operation in those objects we generate an operation in MDSL. |
22+
| Parameters & return values of methods/operations | Base types or data type specifications if possible | If you use primitive data types in CML, they are mapped to the base types of MDSL. If you refer to objects (such as entities) in CML, we produce a corresponding parameter tree. Types which are not further declared are mapped to abstract, unspecified elements (P). |
23+
| Upstream Bounded Contexts from upstream-downstream [relationships](/docs/context-map/#relationships) | API provider | For the upstream Bounded Context we also generate an API provider. |
24+
| Downstream Bounded Contexts from upstream-downstream [relationships](/docs/context-map/#relationships) | API client | Downstream Bounded Contexts are mapped to corresponding API clients. |
25+
26+
### Data Type Mapping
27+
The base/primitive types are mapped as follows:
28+
29+
| CML type | MDSL type |
30+
|------------------|---------------------------------------------|
31+
| String | V&lt;string&gt; |
32+
| int or Integer | V&lt;int&gt; |
33+
| long or Long | V&lt;long&gt; |
34+
| double or Double | V&lt;double&gt; |
35+
| boolean | V&lt;bool&gt; |
36+
| Blob | V&lt;blob&gt; |
37+
| Date | V&lt;string&gt; (no date available in MDSL) |
38+
39+
<div class="alert alert-custom">
40+
<strong>Note:</strong> Types in CML are case sensitive. For example: If you write "string" instead of "String", you create a new abstract
41+
data type instead of using the primitive type "String".
42+
</div>
43+
44+
If you declare a method with multiple parameters or refer to an object (such as entity or value object) in CML, we generate a corresponding
45+
parameter tree. For example the following entity would be mapped to the parameter tree below:
46+
47+
CML input:
48+
```
49+
Entity Address {
50+
String street
51+
int postalCode
52+
String city
53+
}
54+
```
55+
MDSL data type result:
56+
```
57+
data type Address { "street":V<string>, "postalCode":V<int>, "city":V<string> }
58+
```
59+
60+
All abstract data types which are not base types and not specified in CML (no references to objects) will produce an abstract,
61+
unspecified element in [MDSL](https://socadk.github.io/MDSL/), as the following example illustrates:
62+
```
63+
data type JustAnUnspecifiedParameterType P
64+
```
65+
66+
### Example
67+
An example [MDSL](https://socadk.github.io/MDSL/) API description looks as follows:
68+
```
69+
API description CustomerManagementContextAPI
70+
71+
data type Address { "street":V<string>, "postalCode":V<int>, "city":V<string> }
72+
data type AddressId P
73+
data type changeCustomerParameter { "firstname":V<string>, "lastname":V<string> }
74+
75+
endpoint type CustomersAggregate
76+
exposes
77+
operation createAddress
78+
expecting
79+
payload Address
80+
delivering
81+
payload AddressId
82+
operation changeCustomer
83+
expecting
84+
payload changeCustomerParameter
85+
86+
API provider CustomerManagementContextProvider
87+
offers CustomersAggregate
88+
at endpoint location "http://localhost:8001"
89+
via protocol "RESTful HTTP"
90+
91+
API client PolicyManagementContextClient
92+
consumes CustomersAggregate
93+
API client CustomerSelfServiceContextClient
94+
consumes CustomersAggregate
95+
96+
IPA
97+
```
98+
**Note:** This example has been generated from our [insurance example](https://github.com/ContextMapper/context-mapper-examples/tree/master/src/main/resources/insurance-example)
99+
which you can find in our [examples repository](https://github.com/ContextMapper/context-mapper-examples).
100+
101+
### Know Limitations
102+
We are aware of the following generator issues, which may lead to [MDSL](https://socadk.github.io/MDSL/) results which do not compile:
103+
* If you use reserved keywords of the MDSL language as _Aggregate name_, _Bounded Context name_, _operation name_ or _data type name_
104+
in CML, the result may not be valid MDSL.
105+
* Workaround: Do not use MDSL keywords within your CML model.
106+
107+
## User Guide
108+
You can generate [MDSL](https://socadk.github.io/MDSL/) (micro-)service contracts from your CML model as follows.
109+
110+
With a right-click to your CML-file in Eclipse you will find a **Context Mapper** context menu. With the action **MDSL:
111+
Generate Service Contracts** you generate the contracts for all upstreams in your Context Map:
112+
113+
<a href="/img/mdsl-generator-1.png">![MDSL Generator](/img/mdsl-generator-1.png)</a>
114+
115+
<div class="alert alert-custom">
116+
<strong>Note</strong> that the <strong>Context Mapper</strong> menu entry is also available within the context menu uf the CML editor.
117+
(right-click anywhere in the editor)
118+
</div>
119+
120+
All [MDSL](https://socadk.github.io/MDSL/) files will be generated into the **src-gen** folder of your project:
121+
122+
<a href="/img/mdsl-generator-2.png">![MDSL Generator Result](/img/mdsl-generator-2.png)</a>
123+
124+
<div class="alert alert-custom">
125+
<strong>Note:</strong> The MDSL Eclipse plugin is not yet available for download (update site). At the moment you can open the *.mdsl
126+
files with a text editor only (no syntax highlighting and editor support available yet).
127+
</div>
128+
129+
## MDSL Support
130+
For further questions regarding [MDSL](https://socadk.github.io/MDSL/) please visit the website [https://socadk.github.io/MDSL](https://socadk.github.io/MDSL)
131+
or contact Olaf Zimmermann.

Diff for: _docs/transformations/plant-uml.md renamed to _docs/generators/plant-uml.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,36 @@ title: plantUML Generator
33
permalink: /docs/plant-uml/
44
---
55

6-
## Generating plantUML Diagrams
6+
## Introduction and Motivation
7+
The [PlantUML](http://plantuml.com/) tool allows to quickly write UML diagrams. With our PlantUML generator you can generate a UML component
8+
diagram and class diagrams for every Bounded Context of your model. Thereby we offer a transformation from our DSL into a graphical
9+
representation of the system. The component diagram illustrates all Bounded Contexts and their relationships. The generator further
10+
produces one class diagram for every Bounded Context, if you use the [Tactic DDD Syntax](/docs/tactic-ddd/) to model them.
711

12+
## User Guide
13+
The following section describes how you use the PlantUML generators to create the
14+
UML component and class diagrams of your modeled system.
15+
16+
### Generating plantUML Diagrams
817
We assume you have a CML file with your model in Eclipse (with our plugin installed). With a right-click to the CML-file you will find a **Context Mapper** context menu. With the action **PlantUML: Generate Diagrams** you generate all the plantUML diagrams for your context map:
918

1019
<a href="/img/plantuml-generation-1.png">![plantUML Generator](/img/plantuml-generation-1.png)</a>
1120

21+
<div class="alert alert-custom">
22+
<strong>Note</strong> that the <strong>Context Mapper</strong> menu entry is also available within the context menu uf the CML editor.
23+
(right-click anywhere in the editor)
24+
</div>
25+
1226
All the diagrams will be generated into the **src-gen** folder. If you have installed one of the recommended plantUML Eclipse plugins (see recommendations [here](/docs/home/)), you can directly open and view the diagrams in eclipse:
1327

1428
<a href="/img/plantuml-generation-2.png">![plantUML View in Eclipse](/img/plantuml-generation-2.png)</a>
1529

16-
### UML Component Diagram
30+
#### UML Component Diagram
1731
The transformation will generate one component diagram for your context map, showing the bounded contexts and its relationships. The component diagram for our insurance example:
1832

1933
<a href="/img/plantuml-insurance-example-component-diagram.png">![plantUML Component Diagram](/img/plantuml-insurance-example-component-diagram.png)</a>
2034

21-
### UML Class Diagram
35+
#### UML Class Diagram
2236
Further, the transformation generates a class diagram for every bounded context. An example from the insurance scenario:
2337

2438
<a href="/img/plantuml-insurance-example-class-diagram.png">![plantUML Class Diagram](/img/plantuml-insurance-example-class-diagram.png)</a>

0 commit comments

Comments
 (0)