Automatically Loading Helpers
Helpers
Helpers are typically loaded through one of two mechanisms:
- The Rhapsody.ini file. This is typically used by tools developed by partners that get installed as part of the Rhapsody installer, such as TestConductor or ReqXChanger.
- A helper (.hep) file.
Helper Files
The most common way for Rhapsody to read a helper file and load the helpers defined within it is to associate the helper file with a profile. Of course Rhapsody will only load those helpers when the user manually adds the profile to the model. So how can you have Rhapsody automatically load the helpers with the need to manually load a profile ? There are several possible solutions:
- Modify the Rhapsody ini file. Adding an entry to the [Helpers] section in your ini file will force Rhapsody to load the helpers the first time any new project is created (When Rhapsody loads a plugin-based helper its not unloaded until Rhapsody closes)
- Create a user site property file. This is the preferred approach as you are not messing with the Rhapsody install.
User Property Files
When Rhapsody loads a project, the first thing it does is read Properties - from the site based files first (those are in OMROOT/Properties), then from any user properties, then from the project itself (and any loaded profiles). User property files are located in USER_OMROOT/Properties. You can check your rhapsody.ini file [General] section for the exact location of this folder as it depends on the choices you made during the install process.
By creating / modifying the site.prp file in the user properties folder you can have Rhapsody load your helpers whenever it loads the first project - just as it does with the ini file. There are two options here as well:
1. Add a Property to Auto-Load a Profile
This is the best choice if your helper(s) depend on the application of custom stereotypes defined in a profile, or any other custom model elements for that matter. Of course your profile must load the helper file in the usual way. The property to use here is General.Profile.AutoReferences. The path may contain the usual Rhapsody environment variables if required, but this is still a property so either use forward slashes or escaped backslashes (Rhapsody will strip out single backslashes when it reads a property file so you must escape them) for example:
Subject General
Metaclass Profile
Property AutoReferences File "$OMROOT\\Profiles\\RhapsodyPowerPack\\RhapsodyPowerPack.sbsx"
end
end
end
2. Add a Property to Auto-Load Helpers
If your helpers don't need a profile then you can simply have Rhapsody read a .hep file directly. The property to use here is General.Model.HelpersFile, as in the example below (in my environment I want the option to add the Power Pack to any model but I dont necessarily want Rhapsody to auto load it for every model so I created a small helper to load it, which I do want available on all models):
Subject General
Metaclass Model
Property HelpersFile File "C:\\Workspaces\\Eclipse\\AddRhapsodyPowerPack\\AddRhapsodyPowerPack.hep"
end
end
end
Note that, as with all custom property files, the additional 'end' at the end of the text is required.
One last thing - as of Rhapsody 10, helpers may be defined as 'available even when a project is closed' ! Look out for a future tip on that one :)