For legacy code or a library that does not change, it is
appropriate to model external code for referencing, without regenerating
it. You can use reverse engineering to create the external elements
a single time.
Procedure
- Create a model or open an existing one.
- Add a new component for the reverse engineered,
external code.
- Set your new component (created in the previous
step) to be the active component (right‑click it in the browser in IBM® Rational® Rhapsody® and
select Set as Active Component).
- Choose to open the
Reverse Engineering window.
- Specify the files or folders you want to
reverse engineer.
- Click the Advanced button
to open the Reverse Engineering Options window.
- On the Mapping tab,
specify the following settings:
- Select the Visualization Only (Import
as External) check box.
The following figure shows
an example for IBM Rational Rhapsody Developer for C.
- For Rational Rhapsody Developer
for C, select the Files radio button (default) in the Modeling
Policy area; for the other languages, select the appropriate option
for your situation. The availability of these radio buttons might
depend on whether you select the Visualization Only (Import as
External) check box.
- Set the other reverse engineering options
as appropriate for your model.
- Click OK.
- Click the Start button
on the Reverse Engineering window. The specified files are imported
into the product as external elements.
As a result of
the import: - The imported elements are added to the scope of
the configuration.
- All the imported packages have the CG::Package::UseAsExternal property
set to Checked.
- The Include Path or Directory of
the Features window for the configuration (in the example, ExternalComponent)
is set to the correct include path.
- In Rational Rhapsody Developer
for C, when the Directory is a Package radio button is selected,
the C_CG::Package::GenerateDirectory property is
set to Checked for the configuration.
External elements include a special icon in the upper, right corner
of the regular icon, as shown in this example.
- Verify the import to make sure that the
implementation and specification files are named correctly, the correct
folders were created, and so on. Make any necessary changes.
- Set the original component to active.
- For the original component, create a dependency
with a «Usage» stereotype to the ExternalComponent.
- Check that the external elements are included
only in the scope of the ExternalComponent.