Reverse-engineering a single iteration

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

  1. Create a model or open an existing one.
  2. Add a new component for the reverse engineered, external code.
  3. 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).
  4. Choose Tools > Reverse Engineering to open the Reverse Engineering window.
  5. Specify the files or folders you want to reverse engineer.
  6. Click the Advanced button to open the Reverse Engineering Options window.
  7. On the Mapping tab, specify the following settings:
    1. Select the Visualization Only (Import as External) check box.
      The following figure shows an example for IBM Rational Rhapsody Developer for C.
      Reverse Engineering window, Mapping tab
    2. 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.
  8. Set the other reverse engineering options as appropriate for your model.
  9. Click OK.
  10. 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.
      Browser showing external elements
  11. 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.
  12. Set the original component to active.
  13. For the original component, create a dependency with a «Usage» stereotype to the ExternalComponent.
  14. Check that the external elements are included only in the scope of the ExternalComponent.

Feedback