public class CommandRunner
extends com.sodius.mdw.internal.metamodel.doors.io.commands.InternalCommandRunner
CommandRunner
can be used to execute multiple commands.
The DOORS client is instantiated through a DoorsApplication
instance and given as a parameter to the CommandRunner
constructor. Commands are usually executed on a DOORS batch client.
Below is a snippet illustrating how to use commands:
MDWorkbench workbench = null; DoorsApplication application = null; try { // create a DOORS batch application PropertySet properties = new DefaultPropertySet(); properties.setProperty(Common.PREFERENCE_DOORS_IS_SILENT, true); properties.setProperty(Common.PREFERENCE_DOORS_PATH, "C:\\Program Files (x86)\\IBM\\Rational\\DOORS\\9.6\\bin\\doors.exe"); properties.setProperty(Common.PREFERENCE_DOORS_PORTSERVER, "36677@myServer"); properties.setProperty(Common.PREFERENCE_DOORS_USER, "myUser"); properties.setProperty(Common.PREFERENCE_DOORS_PASSWORD, "myPassword"); application = DoorsUtils.createApplication(properties); // create an MDWorkbench instance workbench = MDWorkbenchFactory.create(); // create a command Command command = ... // e.g. new CreateFolderCommand(FolderRef.qualifiedName("/MyFolder")); // execute the command CommandRunner runner = new CommandRunner(workbench, application); runner.run(command); // additional commands might be executed here using the same CommandRunner instance } finally { // dispose application (on both success and failure) if (application != null) { application.dispose(); } if (workbench != null) { workbench.shutdown(); } }
Refer to each command documentation for details on using specific commands.
This class is not intended to be subclassed by clients but may be instantiated.
Command
,
DoorsApplication
,
DoorsUtils.createApplication(com.sodius.mdw.core.util.PropertySet)
Constructor and Description |
---|
CommandRunner(MDWorkbench workbench,
DoorsApplication application)
Creates an instance of a
CommandRunner that will execute commands
on the specified DOORS client application. |
CommandRunner(MDWorkbench workbench,
DoorsApplication application,
Map<String,?> options)
Creates an instance of a
CommandRunner that will execute commands
on the specified DOORS client application. |
public CommandRunner(MDWorkbench workbench, DoorsApplication application)
CommandRunner
that will execute commands
on the specified DOORS client application.workbench
- an MDWorkbench
instance.application
- a DOORS client application on which commands are to be executed.DoorsUtils.createApplication(com.sodius.mdw.core.util.PropertySet)
public CommandRunner(MDWorkbench workbench, DoorsApplication application, Map<String,?> options)
CommandRunner
that will execute commands
on the specified DOORS client application.workbench
- an MDWorkbench
instance.application
- a DOORS client application on which commands are to be executed.options
- properties to configure the command executions. Properties are defined in the classcommon
.DoorsUtils.createApplication(com.sodius.mdw.core.util.PropertySet)
,
Common
public void run(Command command) throws org.eclipse.core.runtime.CoreException
command
- the command to be executed on the DOORS client.org.eclipse.core.runtime.CoreException
- if the command was not successfully executed.
Details on the cause might be found using the DoorsStatusCode
class on the exception status code.DoorsStatusCode