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 a 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:
The rest of batch mode program is configured using system properties. MagicDraw or other modeling tool jars are specified using the 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 MagicDraw or other modeling tool installation directory>]#<classpath property name>
In case the current directory is the MagicDraw or other modeling tool installation directory, the
base parameter does not have to be specified. The classpath property name for MagicDraw or other modeling tool property file is
There are other mandatory properties that have to be specified as well:
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 following system properties depends on the type of the batch mode program.
- Core related batch program:
md.additional.class.path- the jar(s) constituting batch mode program specific classpath is specified using this system property. The jar's are separated using the platform specific path separator in the same way as for a regular classpath.
com.nomagic.magicdraw.launcher- specifies the batch mode program (implementation of com.nomagic.magicdraw.commandline.CommandLine) you want to launch, for example,
- Plugin related batch program:
com.nomagic.magicdraw.commandline.action- specifies the batch mode action (implementation of com.nomagic.magicdraw.commandline.CommandLineAction) you want to execute, for example,
The examples of complete command lines that launches the batch mode program:
In case the command line program is not started from MagicDraw, the command line becomes a little bit more complex. The exemplary scripts that can be used to start the command line program are shown in the following script examples. Additionally, the scripts can be used with multiple MagicDraw versions since they construct a startup class path dynamically. In order to use them, the MagicDraw installation location has to be specified by setting the
MAGICDRAW_HOME environment variable.
The shell script that starts a command line program on Mac OS-X, Linux, and Windows cygwin/msys:
A Windows batch file that starts a command line program on Windows:
- No labels