Command Line Support

Overview

Capella provides the capacity to launch actions from command line. Potential actions are Model Validation, HTML Production, XML Export, Export as ZIP and Migration.

The core mechanism provides the following parameters:

NameCategoryDescription
appidmandatorydefines the id of the command line application to launch. Command line applications are plugins that extend the core mechanism (e.g. model validation)
filepathmandatorydefines the path to your aird file
outputfoldermandatorydefines the path to the output folder
nosplashoptionallaunch Capella without the initial splash screen
consolelogoptionalallows to log messages into the console output
dataoptionaldefines the path to the workspace
importoptionaldefines a list of the path of the Eclipse projects to import into the workspace before doing the actual job. The list have to be placed into quotes "" and separated by a pipe character
forceimportoptionalunreference/delete exiting project from the workspace while importing projects using command line. Without this option, an error is logged if a project with the same name than the imported project exists already in the workspace
forceoutputfoldercreationoptionalautomatically create the output folder. If the folder already exists, this one is deleted and a new output folder is created
logfileoptionaldefines the path to the log file (if not specified, log file is created in the workspace directory)
helpoptionalprints the help message


  • Default behaviour of command line support checks that the workspace specified for validation result and HTML report generation is not in use by another instance of Eclipse.

  • Be careful to use a Capella version that is compatible with the Java Runtime Environment (i.e. run Capella 32 bits on a 32 bits JVM and Capella 64 bits on 64 bits JVM).

  • If the path to the aird file or the path to the workspace or the path to the log file contains white space, it should be in quotes (eg: -data “D: \Application Data\workspace”)

  • When Capella is run in command line, logs levels INFO, WARN, ERROR, FATAL are automatically activated for File and Console appender (regardless of the current log configuration stored in %USERPROFILE%\ReportConfiguration.xml)

  • Before running below commands make sure to not have newline between each parameters to avoid copy/paste errors.


Command Line Application Examples

Model Validation

Simple use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.core.validation.commandline

-data <workspacePath>

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/validation

-logfile D:\CommandLineLog\log.html


This command validates the model corresponding to the <workspacePath>/EOLE_AF/EOLE_AF.aird file and generates a report to the output folder <workspacePath>/DocProject/validation.

DocProject must be a general Eclipse project (not a directory) initially created into the specified workspace, with inside a folder named validation. As well, EOLE_AF must exist as Capella project inside the same workspace. A log file can be also specified with the parameter -logfile



Complex use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.core.validation.commandline

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/validation

-forceoutputfoldercreation

-validationruleset D:/EPF/exportall.epf

-validationcontext "EOLE_AF/EOLE_AF.melodymodeller#971d9934-9780-4e41-b02e-312d0eac3223 |

EOLE_AF EOLE_AF/fragments/OA-Operational%20Context-Operational%20Entity.melodyfragment#c6aebe52-c8a4-4d35-8105-177c87470bef "

-data <workspacePath>

-logfile D:\CommandLineLog\log.html

This new command uses a -validationruleset parameter to specify the path to an Eclipse Property File (epf file) and a -validationcontext parameter to specify the set of URIs of model elements to validate. The set of rule to validate against are stored into the exported epf file.

The parameter -forceoutputfoldercreation becomes necessary for the following cases :

A log file is also specified.


HTML Production

Prerequisites: XHTML Add-on has to be installed.



Simple use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <workspacePath>

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/HTML

-forceoutputfoldercreation

This command will generate HTML report from the EOLE-AF aird file specified to the output folder HTML present into Doc project.


Complex use cases:

</br>

Import Capella project and generate inside it

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <targetWorkspacePath>

-import <absolutePath>/EOLE_AF

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /EOLE_AF/HTML

-forceoutputfoldercreation

-logfile D:/CommandLineLog/log.html

This command will import the EOLE_AF project from <absolutePath> workspace into <targetWorkspacePath> workspace before generating the HTML report inside it.

</br>

Import Capella project and generate inside a new project

</br>

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <targetWorkspacePath>

-import <absolutePath>/EOLE_AF

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/HTML

-forceoutputfoldercreation

-logfile D:/CommandLineLog/log.html

This command will import the EOLE_AF project from <absolutePath> workspace into <targetWorkspacePath> workspace and create the DocProject to generate the HTML report inside it.


Import Capella project and a Doc project to generate inside it


<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.kitalpha.doc.gen.business.capella.commandline

-data <targetWorkspacePath>

-import "<absolutePath>/EOLE_AF | <absolutePath>/DocProject"

-filepath /EOLE_AF/EOLE_AF.aird

-outputfolder /DocProject/HTML

-forceoutputfoldercreation

-logfile D:/CommandLineLog/log.html

This command will import two projects (EOLE_AF and DocProject) from <absolutePath> workspace into <targetWorkspacePath> workspace before generating the HTML report inside the DocProject.

NOTE: The source and target workspaces have to be different.


XML Export

Prerequisites: XML Pivot Add-on has to be installed.



Another Capella headless commandline application is the XML export. The following command runs an export in headless mode:

<CapellaInstallationPath>/eclipse.exe -consoleLog -nosplash

-application org.polarsys.capella.core.commandline.core

-appid xmlpivot.export

-filepath <Path>

The filepath argument may either be a relative or an absolute path. If it is a relative path, it is interpreted relative to the workspace. To specify an explicit workspace, you can use the –data parameter.

Simple use cases:

<CapellaInstallationPath>/eclipse.exe -consoleLog –nosplash

-application org.polarsys.capella.core.commandline.core

-appid xmlpivot.export

-filepath C:/EOLE_AF/EOLE_AF.melodymodeller

This command exports a capella model into an xml file stored at filepath path.


Export as ZIP

This command will export selected project to the given zip filename

Mandatory parameters:


(usage of “qualifier” in the output file name will be replaced by current date/time)

Simple use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.core.commandline.core.exportZip

-data <workspacePath>

-export "EOLE_AF"

-exportZipName "/EOLE_AF/EOLE_qualifier.zip"

-filepath "/EOLE_AF/EOLE_AF.aird"

-outputfolder "/EOLE_AF/output"

-forceoutputfoldercreation

-logfile "D:\ CommandLineLog \log.html"


Migration

This command will migrate the project(s) given as input. A workspace folder is created and located where the command is triggered or in a specified path given by the -data parameter. It creates a log file located in the .metadata folder of the workspace. If the input project is a folder, it will be backed up and migrated inside this folder, otherwise if the input is a zip file it will be unzipped and project(s) inside it will be migrated into the workspace folder.

The parameter -import is mandatory, but parameters -filepath and -outputfolder are not.

Simple use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.migration

-import D:/Projects/EOLE_AF.zip

-data <workspacePath>

This command imports a .zip into the specified workspace and migrate all projects inside.

If you migrate a project using libraries, all dependent projects/libraries must be included and the sequence order matters.

Consider the example below:

The migration process must be done according to the following sequence:

  1. Library3
  2. Library1
  3. Library2
  4. Project1

In such a case, the migration sequence can be done either by launching several unary migration commands on each project/library or by giving the whole sequence through the -import parameter (using | separator).

Complex use case:

<CapellaInstallationPath>/eclipse.exe -nosplash

-application org.polarsys.capella.core.commandline.core

-appid org.polarsys.capella.migration

-import "D:/Projects/Library3 | D:/Projects/Library1 | D:/Projects/Library2 | D:/Projects/Project1"

-data <workspacePath>

-logfile D:\CommandLineLog\log.html

This command migrates the given project/libraries and creates a log.html at the specified location.