Task: Create Transformation to Observer Implementation
Create a model-to-text transformation that transforms the observation model to an observer/controller implementation for the target system.
Disciplines: Development
Relationships
Main Description

This task defines a transformation from the previously extended observation model to the actual source code that implements the monitoring infrastructure. Since the implementation is highly specific for the specific system and target implementation platform (e.g., the used multi-agent system or middleware), these rules have to be tailored for the target platform and system. However, some of the basic principles remain the same, regardless of the transformation target.

The classes and sequence diagrams have to be translated into the target programming language and the target platform, i.e., the multi-agent platform or middleware the system will run on. Sequence diagrams become implementations of the methods of the classes. The flow of information from the agents to the observers and from there to the controllers has to be captured as defined in the observation model and adapted to the communication infrastructure provided. A decision has to be made, whether or not observers and controllers are independent
agents or become part of the agents defined in the domain model, whether properties of the agents can be accessed directly or only via message passing, etc.

Steps
Implement classes specified in generic observation model

The generic observation model contains a number of concepts and dynamics that are relatively stable and do not have to be re-generated in every iteration. Therefore, create a simple library that contains these generic classes and their interaction. The generic concepts in this library can then be used as the base classes for the specialised classes created by the transformation process. In successive iterations, the generic classes can be adapted if required by changes in the generic observation models.

Create transformation rules for class stubs
Each of the specialised classes from the specific observation model needs to be transformed into code for a class that is derived from the respective parent in the generic code library.
Create transformation rules for attributes and methods

The specialised classes can have attributes and methods that need to be transformed accordingly. Attributes marked as final are assigned their default values. Methods are generated from the activity charts.