Skip to content

How to use this

Niklas Rentz edited this page Aug 16, 2024 · 13 revisions

1. Generate the visualization Plug-Ins

You can start developing your model and visualization with our DSLs to define your project. You can find examples on how such configurations can look like in the SPViz Examples Repository.

Via the CLI

Download the CLI from the latest release. When you execute the CLI, you have to pass your .spviz and/or your .spvizmodel files and it will generate (and if configured also build) a few projects to visualize any project following your architectural description.

Via the Eclipse Plug-Ins

When you create or open the example .spvizmodel and .spviz files in Eclipse, confirm to convert the project to an XText project and it will automatically start generating some Plug-Ins with model files following your defined SPViz model at the root of your Eclipse workspace. You can import the generated projects and Eclipse will start building these new Plug-Ins and will most likely show some errors. To fix these you have to also load the target platform generated into the spviz.build/de.cau.cs.kieler.spviz.targetplatform/de.cau.cs.kieler.spviz.targetplatform.target file into your Eclipse and let it build.

Run the visualization from your Eclipse

Start a runtime Eclipse from your Eclipse with the new Plug Ins enabled and you are good to visualize your project model files! To do this, first open the "Java Perspective" (Window->Perspective->Open Perspective->Java Browsing). There, click the little down arrow next to the Play button, and on "Run configurations". Double click "Eclipse Application" to create a new launch configuration. Name that as you wish and make sure that your new Plug Ins are checked in the "Plug-Ins" tab of the run configuration. In the runtime Eclipse, open your generated model file (see below) via Open with->other...->Sample Ecore Model Editor and open the KLighD Diagram View via Window->Show View->Other...->KIELER Lightweight Diagrams->Diagram. The diagram view should now show the start point of a visualization for your project! (If not, see the FAQ).

2. Generate the model file for your project

To generate a model file, you have to write a model generator yourself to show SPViz the location the artifacts of your software project. For your new project, we already generate a working set-up for a project that you can complete to extract information of your software project into a format readable for SPViz. You can find this project in <your model name>.generate. See the ReadProjectFiles.java file for further instructions on how to use and extend this initial generator framework and have a look at the other example generators.

You can build and execute this generator from the command line as described in the next section below, or if you generated it in Eclipse, you can execute the generator directly by executing its ConfigAndExecuteCli file as a Java Application with these arguments (fill in the specifics for what you want to generate): -N <project Name>=<project Name> -P <project Name>=<path to the project to be analyzed> -S <path to where the generated model file should be placed>

3. Distribute and use your visualization anywhere!

Build artifacts

While generating the Plug-Ins for your project you may have noticed one of the generated Plug-Ins having your visualization name with a .build suffix. This contains the starting point of a Maven build, capable of producing artifacts for three use cases:

  • a standalone jar file containing a language server with an extension to serve diagrams using KLighD and KLighD-VSCode in VS Code Extensions or in standalone websites
  • a P2 repository to provide the diagrams for your projects directly in Eclipse using KLighD
  • a standalone jar file containing the model generator.

You can build the language server and repository by calling mvn clean package and to build the generator by calling mvn clean package -P generator. The artifacts can be found in the subfolders [your visualizaition ID].language.server/target/, [your visualization ID].repository/target/repository/, or [your model id].generate/target, respectively.

Usage of the build artifacts

You can start the language server jar via java -jar -Dport=5007 [your visualization name].jar and directly use it. The easier way to use it though is in combination with the klighd-cli for local documentation. Have a look into the local documentation example for klighd-cli to see how to utilize that. Another example use case can be found in the OSGi example. Here you can find a docker container showing all steps necessary to build and start a visualization for the KLighD project using the SPViz CLI.

The repository may be hosted locally and used as a P2 update site to install the visualization Plug-Ins directly into Eclipse. Don't forget to also install the KLighD Diagram view via its P2 update site in Eclipse to be able to use the Plug-Ins.

The model generator can be executed by calling (fill in the specifics for what you want to generate): java -jar <name of the generated generator .jar file> -N <project Name>=<project Name> -P <project Name>=<path to the project to be analyzed> -S <path to where the generated model file should be placed>