Customize Xmi toolkit for Statemate

Overview

In this tutorial, you will learn to customize Xmi toolkit ruleset for Statemate.

This tutorial shows:

Configure RulesComposer for Statemate

If you select the metamodel Statemate in the Models view and on click-right select command Open Model, choose connector: Read from Statemate with selection and then a message box displays the following error:

And or:

It is not necessary to re-install RulesComposer. This needs only to be configured to work with Statemate, and then it will be able to read some models from Statemate.

Please look at folder:
<RhapsodyInstallationDir>\Sodius\RulesComposer\bin
You will find several DOS script files in this folder, one concerns this tutorial:
rc4stm_ini_update.bat

Follow these instructions below:

  1. Close Rhapsody and RulesComposer applications, open a Command Prompt window and enter following commands to go in folder:

    <RhapsodyInstallationDir>\Sodius\RulesComposer\bin
  2. Example:
    C:¶
    CD C:\Program Files\IBM\Rational\Rhapsody\8.0¶
    CD Sodius\RulesComposer\bin¶
    
  3. Enter the DOS script mentioned above with only one argument: the path of Statemate Application folder.
  4. Example:
    rc4stm_ini_update C:\IBM\Rational\Statemate\4.6\bin¶
    
  5. Now restart Rhapsody, open a project and click on main menu Tool > RulesComposer for Statemate.
    Select the metamodel Statemate in the Models view and on click-right select command Open Model.
    Choose connector: Read from Statemate with selection, and answer to all questions displayed in small windows.
    After, that RulesComposer reports completion of reading in the Console view, and finally Statemate model is displayed in a model viewer tab.
Note:
it’s not required to keep the application Statemate opened, but the service NuTCRACKER Service must remain active (see chapter page 13).

Importing Rules

You can use the Import Wizard to import the Statemate to UML Rules Set into your RulesComposer workspace.

  1. From the main menu bar, select File > Import
    Then the Import wizard opens.
  2. Select General > Existing Project into Workspace and click Next.

  3. Choose Select archive file and click on the associated Browse button to locate the zip file:

    StatemateToolkitSRCForRulesComposer.zip
  4. Available under folder:
  5. Statemate_INSTAL_PATH\plugins\StatemateForXMIBridge\src

  6. Under Projects select com.sodius.toolkit.statemate.rules project.
  7. Click Finish to start the import.

Editing Rules

An Help is available in RulesComposer Help:
Select Help > Help Contents and book MDWorkbench Documentation,
Then Tasks > Developing Rules > Editing rules.

Testing Rules

To run rules you have to use a Rule Set launch configuration:

  1. From the main menu bar, select Run > Run Configurations
    Then the Run Configurations wizard opens.

  2. In RulesComposer browser four launch configurations imported with project appear: statemate2rhapsodyAda, statemate2rhapsodyCpp, statemate2rose, and statemate2uml13 .
  3. Choose the launch configuration corresponding to the main rule you want to test.

    In Parameters you can specify the input Statemate model and the output UML one.
    By default the input model is pointing to a sample XMI model pingpong.xmi imported with Rules Set project in the view Models. You can change this model by another model exported with the XMI Bridge in format: XMI Statemate.
  4. Click Run to execute the main rule.

For more details, select Help > Help Contents, and in book MDWorkbenchDocumentation, select Tasks > Developing Rules > Running and debugging.

Note:
when you click on parameter stm43(in), the following window wizard is opened:

Use only XMI connector, other connectors are not available under RulesComposer.

Deploying Rules

To integrate your new rules to the Statemate XMI Toolkit you have to deploy them. For that you can use the Export wizard from RulesComposer.

  1. In the projects browser, select the Rule Set project.
  2. From the main menu bar, select File > Export, then the Export wizard opens.
  3. Select Java > JAR file and click Next.

  4. In box Select the resources to export choose only src package,
    Check Export generated class files and resources.
  5. Save the jar file under folder:

    Statemate_INSTAL_PATH\plugins\StatemateForXMIBridge\rules

  6. With file statemate2uml.jar (replace the old jar) and click Finish.

Troubleshooting

Sometimes, if you get this error message box in RulesComposer :

Maybe the NuTCRACKER Service used by Statemate needs to restart, see in Windows menu: Control Panel > Administrative tools > Services.

If this is inefficient, please restart your session or your machine, this will be enough to solve this problem. If after trying all, this problem persists, please re-install Statemate.