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
andCommandLineAction
(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
andProjectCommandLineAction
(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:
- Core related batch program:
For general command line extend
com.nomagic.magicdraw.commandline.CommandLine
.- Override
com.nomagic.magicdraw.commandline.CommandLine#parseArgs
to parse your arguments - Override
com.nomagic.magicdraw.commandline.CommandLine#execute
to execute your action
- Override
- For project command line action extend
com.nomagic.magicdraw.commandline.ProjectCommandLine
- Override
com.nomagic.magicdraw.commandline.ProjectCommandLine#parseArguments
to parse custom arguments you might be using - Override
com.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.
- Override
- Plugin related batch program:
- For general command line implement
com.nomagic.magicdraw.commandline.CommandLineAction
- Override
com.nomagic.magicdraw.commandline.CommandLineAction#execute
to parse your arguments and do your action
- Override
For 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.
- For general command line implement
Available parameters for project command line launcher:
project
- Project name or pathprojectDescriptor
- Project descriptorserver
- Server URLusername
- Username on serverpassword
- Password for the provided username- By default provided password should be encrypted. (3DEXPERIENCE projects accept only plain text passwords)
- To generate an encrypted password, run any command line launcher with a single argument
generateServerPassword=yourPassword
orgenerateServerPassword
without a password for the interactive prompt.
- To generate an encrypted password, run any command line launcher with a single argument
- In order to use the password in plain text form argument
encryptPassword
needs to be provided and set totrue
. (Not needed for 3DEXPERIENCE projects)
- By default provided password should be encrypted. (3DEXPERIENCE projects accept only plain text passwords)
serverType
- If launching a project stored in the 3DEXPERIENCE platform, must specify the platform deployment type- OnPremise deployment
serverType=PLATFORM_ON_PREMISE
- Cloud deployment
serverType=PLATFORM_CLOUD
- OnPremise deployment
enableSSL
- 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 branch
All 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".