The Objecteering command line
Overview
The Objecteering command line can receive special arguments in its command line that allow for the following batch activities:
· creating a new project (.ofp)
· running a J script on an existing project
Creating a new project using the Objecteering command line
Objecteering 6.1 can create a new project file (.ofp) using a specific template in batch mode.
The syntax of the command line is as follows:
jobjing.exe –create projectfile –tpl templatename
where:
· "projectfile" is the full path of the project file to create ( .ofp file)
· "templatename" is the name of the template to use. This is the name that usually appears in the "template" field of the project creation dialog box.
For example:
jobjing.exe –create c:\work\MyProject.ofp –tpl MyTemplate
During the command line session execution, the full Objecteering GUI will appear on the screen but the end-user will not be able to carry out any actions in this GUI.
After the project has been created, Objecteering will exit.
Running a J script from the command line
With Objecteering 6.1, some J code script can be directly launched from the command line. When executed in this command line mode, Objecteering will open the specified project, run the J code contained in the script file, save the project and close.
During the command line session execution, the full Objecteering GUI will appear on the screen but the end-user will not be able to carry out any actions in this GUI.
However, if the script requires a user action (for example, popping a modal dialog box), the control will be passed to the GUI and the end-user.
For pure batch scripts that have to run without human intervention, the end-user should therefore be careful to write the script so that it will neither pop any modal box or message nor call any J method or command that could lead to a popped modal box.
The syntax of the command line is as follows:
jobjing.exe –ofp projectfile –jmf scriptfile
-- arg1 'arg2'…
where:
· "projectfile" is the full path of the project file to open ( .ofp file)
· "scriptfile" is the full path of the file (with its extension) containing the J code to execute (usually a .jmf file)
· "arg1", "arg2", and so on, are the arguments passed to the script. These arguments are then available in a "String[] parameters" variable.
For example:
jobjing.exe –ofp c:\work\MyProject.ofp –jmf c:\work\MyScript.jmf -- 'c:\genroot'
Note: The –ofp option can be used alone (without the –jmf option). In this case, Objecteering will start and automatically open the project file before passing the control to the GUI and the end-user. However, the –ofp option is mandatory when using the –jmf option.
After execution of a command line script session, a log file remains, containing all the messages that appeared in the Objecteering console during the session. This file is named from the script name (without its extension and with the .log extension). This log file is located in the "bin" sub-directory of the Objecteering installation directory.
Internal and external names of MDA components
MDA components are recognized by J through their internal name, which is different from the extenal name used.
|
The MDA component whose external name is… |
Has the following internal name… |
|
Documentation |
Documentation |
|
C++ |
CxxDeveloper |
|
Java |
JavaDeveloper |
Note: To obtain the internal name of MDA components, simply open the MDA removal window, by selecting the "Remove an MDAC" command in the "Tools" menu.
Example
The following command will update a complete project from its Multiuser repository (assuming that the "MyProject.ofp" project is properly configured in terms of its modules, parameters, and so on).
jobjing.exe –ofp c:\Myproject.ofp c:\updateFromMU
The contents of the "updateFromMU.jmf" script are as follows:
boolean import_confirm;
// for MU Module
parameter saved value
boolean import_hierarchic; // for MU Module parameter saved value
String temp;
StdOut.write("Full model update...", getCurrentTime(), NL);
// Save MU module
parameters to restore them after the import
import_confirm = default#MultiUser#ConfirmOperations();
import_hierarchic = default#MultiUser#HierarchicOperations();
// Temporary change MU
module parameters
default#MultiUser#setConfirmOperations(false);
default#MultiUser#setHierarchicOperations(true);
// Start the update from
repository
runModuleMethod ("MultiUser", "default#external#CommonServicesForMultiUser#MultiUser", "Cmd_CompleteImport");
// Restore the MU module
parameters
default#MultiUser#setConfirmOperations(import_confirm);
default#MultiUser#setHierarchicOperations(import_hierarchic);
StdOut.write("Terminated at ", getCurrentTime(), NL);
Note: The script saves the current values of some of the module's parameters before modifying them for the purposes of its operations. The script then restores the values before ending, in order to leave the project in its initial state.