While launching the command line action, the single sign-on connection to the server is not supported. |
Implementation of command line launchers depends on the type of the batch mode program (Core related or Plugin related).
Both modes provide two ways of implementation:
CommandLine and CommandLineAction (for Core and Plugin respectively) are general launchers meant for developers that will not be opening projects or needs full control of argument parsing and opening of projects.ProjectCommandLine and ProjectCommandLineAction (for Core and Plugin respectively) are convenience launchers simplifying work with projects as they provide list of arguments that will be parsed and used to open one or more projects removing great deal of boilerplate code needed.To create command line launcher:
For general command line extend com.nomagic.magicdraw.commandline.CommandLine.
com.nomagic.magicdraw.commandline.CommandLine#parseArgs to parse your argumentscom.nomagic.magicdraw.commandline.CommandLine#execute to execute your actioncom.nomagic.magicdraw.commandline.ProjectCommandLinecom.nomagic.magicdraw.commandline.ProjectCommandLine#parseArguments to parse custom arguments you might be usingcom.nomagic.magicdraw.commandline.ProjectCommandLine#execute(java.util.Properties, com.nomagic.magicdraw.core.Project) to execute your action. This method will be called for every project opened using available project command line arguments.com.nomagic.magicdraw.commandline.CommandLineActioncom.nomagic.magicdraw.commandline.CommandLineAction#execute to parse your arguments and do your actionFor project command line action extend com.nomagic.magicdraw.commandline.ProjectCommandLineAction
Override com.nomagic.magicdraw.commandline.ProjectCommandLineAction#execute(java.lang.String[], java.util.Properties, com.nomagic.magicdraw.core.Project) to execute your action. This method will be called for every project opened using available project command line arguments. Full array of originally passed arguments and parsed project command line arguments specific to the project (default arguments that were parsed from the command line or project-specific properties file) are also passed along with opened project.
Available parameters for project command line launcher:
project - Project name or pathprojectDescriptor - Project descriptor. For a local project, it is a file URI in the format file:/<full encoded path>, for example file:/C:/Users/Public/Documents/activity%20diagram.mdzip. For Teamwork Cloud or 3DEXPERIENCE project, it is URI in format twcloud:/<project resource ID>/<project branch ID>, for example twcloud:/a8002c51-5e57-420e-9832-a0a54f600028/77cad478-cd51-4e4d-8666-b74a6ba95f9a. The descriptor of an already opened project can be found and copied from the menu File > Project Properties, or created manually.server - Server URL. For 3DEXPERIENCE, it is the URL of the server. For Teamwork Cloud, it can be only the name of the server or name:port, where the name is a host name, or full host name with domain, or IP address of the server, for example, myserver1, myserver1:3579, myserver1.mydomain.com, myserver1.mydomain.com:3579, 192.168.42.42, 192.168.42.42:3579.username - Username on serverpassword - Password for the provided usernamegenerateServerPassword=yourPassword or generateServerPassword without a password for the interactive prompt.encryptPassword needs to be provided and set to true. (Not needed for 3DEXPERIENCE projects)serverType - If launching a project stored in the 3DEXPERIENCE platform, must specify the platform deployment typeserverType=PLATFORM_ON_PREMISEserverType=PLATFORM_CLOUDenableSSL - To use SSLencryptPassword - Set to true if the provided password is in plain text (Not needed for 3DEXPERIENCE projects)properties - Path to a properties file containing properties. Multiple properties files can be provided "properties=prop1.properties;prop2.properties"projectPassword - Project passwordversion - Project versionbranch - Project branchAll parameters for project command line launchers, both in the command line and properties files, should be provided in the format "property1=value1 property2=value2".
To open multiple projects, you must define properties for each project (in case the project is local, path or name is enough) in separate properties files. These files are passed as "properties" arguments e.g. "properties=prop1.properties;prop2.properties".