Giter VIP home page Giter VIP logo

lemma-visualizer's Introduction

LEMMA Visualizer

The LEMMA Visualizer is a tool to create a coherent visualization from multiple LEMMA intermediate service models. The visualization is based on the UML component diagram type and is implemented using GraphViz and LEMMA's own model processing framework.

For further information on LEMMA as a modeling ecosystem for engineering microservices, visit here.

Usage

Requirements

The following software must be installed on your machine.

  • Java >=11
  • GraphViz

Instructions

The LEMMA Visualizer ships as a standalone runnable jar-file with a command line interface. That is, it can be run using the terminal in the following manner.

java -jar de.fhdo.lemma.model_processing.visualizer-0.8.6-SNAPSHOT-standalone.jar
-i="path/to/initialservicemodel/model.xmi"
-t="path/to/output"
code_generation ServicesToGraphVizGenerator
-height=1000
-lvl=SIGNATURES
-aim="path/to/additionalmodels"
"Restaurant.xmi"
"AnotherServiceModel.xmi"

In the following, we explain the (admitted) long command.

As the application is based on LEMMA's model processing framework, it uses the same parameters and extends them as described in the following.

(...)
-i="path/to/initialservicemodel/model.xmi"
-t="path/to/output"
code_generation ServicesToGraphVizGenerator
(...)

-i is the relative path to the initial LEMMA intermediate service model. This parameter is mandatory, otherwise LEMMA's model processor will not execute the generation phase for service models.

-t is the relative path for the output that is created, that is, a .dot as well as a .png file.

code_generation ServicesToGraphVizGenerator tells the framework, that the code_generation phase with the given generator should be executed.

Afterwards, the CLI takes special parameters for the visualizer.

(...)
-height=1000
-lvl=SIGNATURES
-aim="path/to/additionalmodels"
"Restaurant.xmi"
"AnotherServiceModel.xmi"
"AThirdServiceModel.xmi"

-height describes the height of the image that is generated as an output. If not set, the value is 2000 px.

-lvl allows the configuration of the detail level each service should be depicted. Possible values are SERVICES (least information displayed), INTERFACES (default value), OPERATIONS, SIGNATURES (most information displayed).

-aim finally allows the addition of more than the initial intermediate service model. It takes a relative folder path where the model files should be located. Afterwards, as many additional intermediate service models as desired can be added with there file name.

Behind the Curtain

The Visualizer is currently in a prototypical stage as a research tool. Therefore, the CLI feels kind of clumsy. In the future we plan to at least combine some parameters making the usage easier.

How it works?

The Visualizer basically works by having the LEMMA model processor deserialize the initial xmi intermediate model and, thus, make it accessible. In essence, for each service found in the intermediate model, a node is created in a directed graph. The JGraphT framework is used for this purpose. Subsequently, any additional intermediate models are read in and also added to the graph as vertices. Require relationships in the respective microservices are transferred as edges in the graph. The graph is then exported to the .dot format and the graph is generated from the .dot representation using GraphViz. To display the microservice information within the nodes, the ability to style GraphViz vertices with HTML is used.

Example

Image

The following images shows an example graph. Its generation is build in and can be triggered using the following command.

java -jar de.fhdo.lemma.model_processing.visualizer-0.8.6-SNAPSHOT-standalone.jar
-i="exampleModels/intermediate/service models/Order.xmi"
-t="exampleOutput"
code_generation ServicesToGraphVizGenerator
--example=true

--example=true is a special build-in toggle that basically skips all generation and uses a hard coded service example inspired by the sock shop microservice example application.

.dot file

# see exampleModels/sockshop-example.dot

strict digraph G {
  "sockshop.orders" [ label=<<table bgcolor='#87cefa' border='1' cellborder='0'><tr><td><i>&laquo;Functional Service&raquo;</i></td></tr><tr><td> <b>orders</b></td></tr><tr><td>service technology {Java}</td></tr></table>> type="FUNCTIONAL" shape="plaintext" color="black" fontname="Helvetica" ];
  "sockshop.catalogue" [ label=<<table bgcolor='#87cefa' border='1' cellborder='0'><tr><td><i>&laquo;Functional Service&raquo;</i></td></tr><tr><td> <b>catalogue</b></td></tr><tr><td>service technology {Go}</td></tr></table>> type="FUNCTIONAL" shape="plaintext" color="black" fontname="Helvetica" ];
  "sockshop.shipping" [ label=<<table bgcolor='#87cefa' border='1' cellborder='0'><tr><td><i>&laquo;Functional Service&raquo;</i></td></tr><tr><td> <b>shipping</b></td></tr><tr><td>service technology {Java}</td></tr></table>> type="FUNCTIONAL" shape="plaintext" color="black" fontname="Helvetica" ];
  "sockshop.carts" [ label=<<table bgcolor='#87cefa' border='1' cellborder='0'><tr><td><i>&laquo;Functional Service&raquo;</i></td></tr><tr><td> <b>carts</b></td></tr><tr><td>service technology {Java}</td></tr></table>> type="FUNCTIONAL" shape="plaintext" color="black" fontname="Helvetica" ];
  "sockshop.user" [ label=<<table bgcolor='#87cefa' border='1' cellborder='0'><tr><td><i>&laquo;Functional Service&raquo;</i></td></tr><tr><td> <b>user</b></td></tr><tr><td>service technology {Go}</td></tr></table>> type="FUNCTIONAL" shape="plaintext" color="black" fontname="Helvetica" ];
  "sockshop.queue-master" [ label=<<table bgcolor='#c1005d' border='1' cellborder='0'><tr><td><i>&laquo;Infrastructure Service&raquo;</i></td></tr><tr><td> <b>queue-master</b></td></tr><tr><td>service technology {Java}</td></tr></table>> type="INFRASTRUCTURE" shape="plaintext" color="black" fontname="Helvetica" ];
  "sockshop.queue-master" -> "sockshop.shipping" [ label="simulates" fontname="Helvetica" ];
  "sockshop.shipping" -> "sockshop.orders" [ label="requires" fontname="Helvetica" ];
}

Generation output for the .dot graph (sockshop)

For further experimentation this repository contains two pre-generated LEMMA service models located in exampleModels/intermediate/service models. For example, you can use both models to generate the following .dot graph description and visualization (generated with -height=250 -lvl=OPERATIONS).

# see exampleModels/order-restaurant-example.dot

strict digraph G {
  "Order::org.example.OrderService" [ label=<<table bgcolor='#87cefa' border='1' cellborder='0'><tr><td><i>&laquo;Functional Service&raquo;</i></td></tr><tr><td>+ <b>OrderService</b></td></tr><tr><td><table bgcolor='white' cellspacing='0'><tr><td>&laquo;Interface&raquo;<br/>+Orders</td></tr><tr><td>+create(...)<br/>+getOrder(...)<br/>+cancel(...)<br/></td></tr></table></td></tr><tr><td><table bgcolor='white' cellspacing='0'><tr><td>&laquo;Interface&raquo;<br/>+OrderEventConsumer</td></tr><tr><td>+listenCreateMenu(...)<br/></td></tr></table></td></tr></table>> type="FUNCTIONAL" shape="plaintext" color="black" fontname="Helvetica" ];
  "Restaurant::org.example.RestaurantService" [ label=<<table bgcolor='#87cefa' border='1' cellborder='0'><tr><td><i>&laquo;Functional Service&raquo;</i></td></tr><tr><td># <b>RestaurantService</b></td></tr><tr><td><table bgcolor='white' cellspacing='0'><tr><td>&laquo;Interface&raquo;<br/>#Restaurants</td></tr><tr><td>#create(...)<br/></td></tr></table></td></tr></table>> type="FUNCTIONAL" shape="plaintext" color="black" fontname="Helvetica" ];
}

Generation output for the .dot graph (order and restaurant)

Building Instructions

To build the visualizer from scratch, you can import the sources as a gradle project in your IDE. You need the LEMMA maven packages in your repository. To do so, you can build LEMMA locally on your machine.

Disclaimer

This research tool was created by Jonas Sorgalla as part of his research concerning the empowerment of collaboration in microservice engineering. It is not meant to be used in production.

The LEMMA Visualizer is licensed under MIT.

lemma-visualizer's People

Contributors

josor001 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.