Appearance
Profile reference
This page is a compact syntax reference for the profile DSL (.profil), which describes platforms and their behaviour.
For concepts and examples of how platforms are used with CMN models, see the Modeling section.
Profiles are typically provided by facilities (e.g. the Base facility, Java facility, Spring Boot facility). Application projects usually only use profiles, they rarely define their own platforms from scratch.
1. Stereotypes
Stereotypes are reusable annotations that can be attached to model elements.
profil
stereotype entity applicable for complextype not propagated by specialization
stereotype key applicable for field propagated by specialization, including
stereotype number applicable for simpletype
stereotype integer applicable for simpletype specialization of numberapplicable for– allowed model element types (e.g.simpletype,complextype,field,service,operation,association,component…).specialization of– inheritance between stereotypes.propagated by/not propagated by– control how stereotypes are inherited along relationships (specialisation, referencing, including).
Usage in CMN: type<entity> Customer { ... }, id: Id<key> etc.
2. Strategies
Strategies compute derived property values during generation.
profil
strategy JavaNamingStrategy implementation="org.joinedworkz.common.java.Strategy"
strategy JavaTypeStrategy implementation="org.joinedworkz.common.java.JavaTypeStrategy"Strategies are referenced from property contributions:
profil
contribute to field {
property javaName: STRING strategy=JavaNamingStrategy
}
contribute to type {
property javaType: STRING strategy=JavaTypeStrategy
}The strategy implementation is called during model processing to compute the property value from the model context.
3. Outlets
Outlets define where generated artifacts are written and with which behaviour.
profil
abstract outlet StandardOutput
createNotExistingDirectory = true
overwriteExistingFiles = true
markAsDerived = true
deleteFilesOnCleanBuild = true
cleanWholdDirectoryOnCleanBuild = false
keepLocalHistory = true
outlet generatedOpenApi specialization of StandardOutput
directory = "./src/generated/resources/openapi"
outlet generatedOpenApiHtml specialization of StandardOutput
directory = "./diagram/api"abstract outlet– base outlet configuration that cannot be used directly.specialization of– outlet inherits all settings from the base outlet.directory– default output directory (can be overridden per project viajoinedworkz.properties).- Flags control how files are created, overwritten and cleaned.
Projects can override outlet directories in a joinedworkz.properties file in the project root, optionally per layer:
properties
# global override
outlet.generatedJavaSource.directory=../my-service-module/src/generated/java
# specific overrides per layer
outlet.generatedJavaSource.commons.directory=../my-commons-module/src/generated/java
outlet.generatedJavaSource.webapp.directory=../my-webapp-module/src/generated/java4. Cartridges
Cartridges bundle generators and connect them to outlets.
profil
cartridge DiagramCartridge implementation="org.joinedworkz.common.DiagramCartridge"
outlets=generatedDiagram
cartridge SchemaCartridge implementation="org.joinedworkz.common.SchemaCartridge"
outlets=generatedSchema
cartridge OpenApiCartridge implementation="org.joinedworkz.common.OpenApiCartridge"
outlets=generatedOpenApi, generatedOpenApiHtmlimplementation– Java/Xtend class that implements the cartridge.outlets– one or more outlets used by this cartridge.
Platforms decide which cartridges are applied (see below).
In CMN you can disable individual cartridges for a model with:
text
platform SpringBoot exclude DtoCartridgeThis keeps the platform but skips the specified cartridge(s) for that model.
5. Settings
Settings connect platforms to dependency-injection configuration classes.
profil
setting CommonSetting implementation="org.joinedworkz.common.CommonSetting"Settings are used internally by facilities to register cartridges, strategies and other services. For most application projects it is enough to know that the setting provides the implementation side of a platform.
6. Platforms
Platforms define how a canonical model is interpreted for a given stack.
Example: simplified Base platform:
profil
platform Base setting=CommonSetting {
apply cartridge DiagramCartridge
apply cartridge SchemaCartridge
apply cartridge OpenApiCartridge
contribute to simpletype<string> {
property minLength: INTEGER
property maxLength: INTEGER
property pattern: STRING
property javaType: STRING
property format: STRING
}
contribute to complextype<entity> {
property tableName: STRING not propagated by specialization
}
contribute to complextype<entity>.field {
property columnName: STRING
}
}Key points:
setting=...– DI configuration for implementations.apply cartridge– which cartridges run for this platform.contribute to– properties supported or overridden by the platform.
6.1 Platform inheritance
Platforms can inherit from other platforms:
profil
platform Java specialization of Base {
apply cartridge JavaCodeCartridge
contribute to simpletype<decimal> {
override javaType value="java.math.BigDecimal"
}
}Derived platforms can:
- apply additional cartridges,
- override or extend property definitions,
- change defaults for existing properties.
6.2 Platform contributions and propagation
Property contributions control which properties exist and how they behave.
profil
contribute to simpletype<number> {
property min: INTEGER
property max: INTEGER
property maxDigits: INTEGER
property unit: STRING
}
contribute to complextype<entity> {
property tableName: STRING not propagated by specialization
}contribute to simpletype<number>– attaches properties to all simple types with stereotypenumber.contribute to complextype<entity>– attaches properties to all complex types with stereotypeentity.not propagated by specialization– property is not inherited to subtypes; they must define their own value.
Platforms can also contribute to nested elements, e.g. fields of entities:
profil
contribute to complextype<entity>.field {
property columnName: STRING
}7. Keywords (profile DSL)
Important profile keywords at a glance:
stereotype,applicable for,specialization ofpropagated by,not propagated bystrategyoutlet,abstract outlet,specialization ofcartridge,implementation,outletssettingplatform,specialization of,setting,apply cartridgecontribute to,override,property
