MagicDraw 18.2 Documentation

Skip to end of metadata
Go to start of metadata

MagicDraw or other modeling tool run in OSGI Framework. This implies that batch mode programs or any applications that start MagicDraw or other modeling tool have to run in OSGI Framework as well.

In order to launch the program the launcher is started using java command line which then starts the program inside the framework. The initial classpath have to include only jars needed to start the framework launcher. Here is the list of required jars on the classpath:

  • lib/com.nomagic.osgi.launcher-<latest version>.jar
  • lib/bundles/org.eclipse.osgi_<latest version>.jar
  • lib/bundles/com.nomagic.magicdraw.osgi.fragment_<latest version>.jar
  • lib/md_api.jar
  • lib/md_common_api.jar
  • lib/md.jar

The rest of batch mode program is configured using system properties. MagicDraw or other modeling tool jars are specified using system property md.class.path. The preferred way to specify this classpath is as follows:

file:<absolute or relative URL to MagicDraw or other modeling tool configuration properties file>[?base=<path to MagidDraw or other modeling tool installation directory>]#<classpath property name>

In case the current directory is the MagicDraw or other modeling tool installation directory base parameter does not have to be specified. Classpath property name for MagicDraw or oher modeling tool property file is CLASSPATH.

The jar(s) constituting batch mode program specific classpath is specified using system property md.additional.class.path. The jar's are separated using platform specific path separator in the same way as for regular classpath.

The system property com.nomagic.magicdraw.launcher specifies the batch mode program you want to launch, eg. -Dcom.nomagic.magicdraw.launcher=com.nomagic.magicdraw.examples.imagegenerator.ExportDiagramImages

There are other mandatory properties that have to be specified as well:

  • -Dcom.nomagic.osgi.config.dir=configuration
  • -Desi.system.config=data/application.conf
  • -Dlogback.configurationFile=data/logback.xml

They here are specified as paths relative to <modeling tool installation directory> therefore you either have to make  your current directory before launching your program or to specify absolute paths for above listed properties.

The main class to run is com.nomagic.osgi.launcher.ProductionFrameworkLauncher which is the OSGI framework launcher that starts the program in OSGI Framework.

The example of complete bash command lines that launches batch mode program:

> cd MagicDraw_182_no_install
> java -Xmx1200M -Xss1024K -XX:PermSize=60M -XX:MaxPermSize=200M \
       -Dmd.class.path=file:bin/ \
       -Dcom.nomagic.osgi.config.dir=configuration \
       -Desi.system.config=data/application.conf \
       -Dlogback.configurationFile=data/logback.xml \
       -Dcom.nomagic.magicdraw.launcher=com.nomagic.magicdraw.examples.imagegenerator.ExportDiagramImages \
       -cp lib/com.nomagic.osgi.launcher-17.0.5-SNAPSHOT.jar:\
`         `lib/bundles/org.eclipse.osgi_3.10.1.v20140909-1633.jar:\
`         `lib/bundles/com.nomagic.magicdraw.osgi.fragment_1.0.0.201507222111.jar:\
`         `lib/md_api.jar:lib/md_common_api.jar:lib/md.jar \
       -Dmd.additional.class.path=openapi/examples/imagegenerator/imagegenerator.jar \
       com.nomagic.osgi.launcher.ProductionFrameworkLauncher project_file=project.mdzip destination_dir=out


  • No labels