Model publication using a shared Profile

During a publication using the Publisher for Rhapsody, it is possible to reference an external Profile.
An external Profile is meant to be shared and used by several projects. This external Profile will become a used shared Package in the transformed Cameo model.

The option rhp2md.resources.mapping.file in the publisher.properties allows switching to the shared Profile by providing the path of the mapping configuration file.

Creation of the Profile

The shared Profile can be created by transformation or manually directly in Cameo. It can also be edited in Cameo.

When the Profile is ready to be used, the Package containing it must be shared, so that it can be used by other projects. To do this, select the Package from Cameo, right-click, and select the menu Project Usage > Share Packages…


By clicking the OK button, the Package becomes shared and can be used by other projects. A hand icon appears on the Package.

Note:
To avoid any loss of information, the Cameo Profile must be synchronized regularly with the Rhapsody Profile, especially if the Rhapsody Profile changes.
Indeed, if the Rhapsody and Cameo Profiles are different (deletion, addition, or modification of a Stereotype/Tagged Value between Rhapsody and Cameo), the application of the Stereotypes will not be completed correctly in the Cameo model.

Using the External Profile

A transformation configuration is required to use an external profile.
The rhp2md.resources.mapping.file option in the publisher.ini file allows you to declare a path to an XML mapping file. Here is the minimum configuration necessary:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MAPPING>
  <resources url="D:\mapping\ExternalProfile.mdzip">
    <mappingProfiles>
      <mappingProfile source="ProjectUsageTest::ExternalProfile" target="ExternalProfile">
      </mappingProfile>
    </mappingProfiles>
  </resources>
</MAPPING>

In the minimal configuration, the Publisher will try to map all the elements of the Rhapsody profile, to the Cameo profile.
In our example, the Rhapsody profile is named "ExternalProfile", as well as the Cameo profile.
Either simple names, qualified names of Profiles or Profile elements (Stereotype, Property...) can be used in the configuration, for example:

    <mappingProfile source="ProjectUsageTest::ExternalProfile" target="ProjectUsageTest::ExternalProfile">

When name changes have been made in the shared profile, it is possible to configure the mapping, in the XML file, accordingly.
For example, when a Stereotype "StereotypeA" is renamed in the Cameo profile "StereotypeA_renamed", the following line will be added to the configuration file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MAPPING>
  <resources url="D:\mapping\ExternalProfile.mdzip">
    <mappingProfiles>
      <mappingProfile source="ProjectUsageTest::ExternalProfile" target="ExternalProfile">
          <mappings>
            <mapping source="StereotypeA" target="StereotypeA_renamed" type="Stereotype">
            </mapping>
          </mappings>  
      </mappingProfile>
    </mappingProfiles>
  </resources>
</MAPPING>

Also, if a Property of this Stereotype is renamed, we will add a mapping line such as:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MAPPING>
  <resources url="D:\mapping\ExternalProfile.mdzip">
    <mappingProfiles>
      <mappingProfile source="ProjectUsageTest::ExternalProfile" target="ExternalProfile">
          <mappings>
            <mapping source="StereotypeA" target="StereotypeA_renamed" type="Stereotype">
               <mappings>
                 <mapping source="TagValue1" target="TagValue1_renamed" type="Property">
                 </mapping>
               </mappings>
            </mapping>
          </mappings>  
      </mappingProfile>
    </mappingProfiles>
  </resources>
</MAPPING>

Stereotypes or Properties not appearing in the configuration file are mapped by name.
Multiple Cameo Resources (Cameo mdzip files) can be declared in the mapping file.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MAPPING>
  <resources url="D:\mapping\ExternalProfile.mdzip">
    <mappingProfiles>
      <mappingProfile source="ProjectUsageTest::ExternalProfile" target="ExternalProfile">
          <mappings>
            <mapping source="StereotypeA" target="StereotypeA_renamed" type="Stereotype">
               <mappings>
                 <mapping source="TagValue1" target="TagValue1_renamed" type="Property">
                 </mapping>
               </mappings>
            </mapping>
          </mappings>  
      </mappingProfile>
    </mappingProfiles>
  </resources>
  <resources url="D:\mapping\ExternalProfile.mdzip">
    <mappingProfiles>
      <mappingProfile source="EA_Model::thecustomprofile" target="EA_Model::Custom Profile">
    </mappingProfiles>
  </resources>
</MAPPING>

Similarly, multiple Profiles can be mapped to the same Cameo Resource (mdzip file).

The following table describes all the characteristics of the configuration file:
Tag Name Attribute Name Description
resources url Absolute path of the mdzip resources containing the target profiles
MappingProfile source The Rhapsody Profile name or qualified name to map
target The Cameo Profile name or qualified name to map
mapping source The Rhapsody element name or qualified name to map
target The Cameo Element name or qualified name to map
type The Element type to map.
Supported types:
  • Profile
  • Package
  • Stereotype
  • Enumeration
  • Type
  • DataType
  • Property
  • EnumerationLiteral

Note:

  1. Stereotypes may be still transformed, even if they do not have the same name.
    This can happen because the Stereotype IDs are the same between the profile, and the transformed Cameo model.
    To avoid this, you need to change the IDs in the Profile file. Don't do this operation on a shared Profile already used.
    In Cameo:

  2. The mdzip file containing the Shared Profile must be located in the same location as the transformed Cameo model, or it must be copied to the profiles directory of the Cameo installation.
    Otherwise, when opening the transformed model, Cameo will ask to select the shared project:

    Note:
    The best recommendation is to place it in the profiles directory of the Cameo installation, the profile can then be used by all models.

Limitations

Here are the limitations of Profile switching:

To initiate Profile switching, please set the rhp2md.resources.mapping.file option in the publisher.ini file, such as:
# Provide the path of the resources mapping configuration file for external Resource mapping. For example C:\\Publisher_Installation_Path\\mapping\\Profile_Mapping.xml
rhp2md.resources.mapping.file=d:\\temp\\ExternalProfile_config.xml

Note: You need to use double back slashes "\\" in the path.