PCM Profiles/Applying Stereotypes

Aus SDQ-Wiki

Profiles User Interface

The UI for the Profiles project is divided into two parts. First, there are entries for context menu, which are created dynamically based on the selected resources that reside in the active workbench and allow adding/removing Stereotypes to stereotypable objects. Second, there is the Profiles View, which is an extension of the Eclipse workbench and can be used to get more information about the applied Stereotypes and eventually alter them.

Context Menu for Profile and Stereotype Usage

Once you generated stereotypable model code you can apply stereotypes in the tree-based editors of Palladio and in the graphical editors. The listeners will look for Profile Applications in the registry (which should have already been registered via project nature and builders from the current workspace) and create the context menu entries accordingly. So the steps to apply a stereotype or remove all applications of stereotype from the object are as follows:

  1. Make sure that the Profiles View is active in the workbench!
  2. Perform a right-click on the model element which is stereotypable.
  3. Go to the entry of the corresponding Profile Application.
  4. Select the wanted action from the sub-menu:
    1. "Apply ... stereotype" for applying the stereotype
    2. "Remove all applications of ... stereotype" for removal of all instances of a stereotype

An example screenshot can be seen below.

Context menu of a stereotyable object

For changing the attribute values and reference links of a stereotype application use the Profiles View's table editor as explained in the following.

Using the Profiles View

Profiles View's first task is to show the stereotype applications of selected objects and it allows you to change the values of the features of already applied stereotypes. Also an extra function of this view is to remove a single stereotype application that from a stereotyped object, instead of cleaning all of them like from the context menu.

  • If you have already a stereotyped model instance, open it with an editor of your choice (Ecore Model Editor or Reflective Editor) and select an element from the resource while the PCM Profiles View is active on your workbench. The listeners will return the decorators, if any, and the Stereotype Applications (≈ applied Stereotypes) will show up in the left part of the view, the tree viewer.
  • After that, by selecting a Stereotype Application from the tree viewer, the features of the applied Stereotype and their values will be shown in the middle part of the view, the table editor. The first column contains the names of the Stereotypes, which are non-changeable through our UI and in the second column of the table editor, you can edit the values of the shown Stereotype features.
  • Also various information about the selected Stereotype will be shown in the right part of the view, in the text boxes. These are non-changeable.
  • With the menu entry [Remove Stereotype] on the right corner, you can delete a stereotype application, that is currently selected in the tree viewer.

An example screenshot can be seen below.

Profiles View in Action

Examples

There are two examples that can be used as an introduction into the PCM Profiles, which ease the two necessary steps of getting familiar with the project, defining Profile and Stereotype Applications and using them on stereotypable objects with the custom Profiles Registry and Profiles UI.

  • First one is the "Library" example, which is not based on the Palladio Component Model.
    • The meta-model: /edu.kit.ipd.sdq.mdsd.profiles.examples.library
    • The Profile Application: /edu.kit.ipd.sdq.mdsd.profiles.examples.library.profile
  • Second one is the trivial "PCM Media Store", that is based on the Palladio Component Model.
    • Model instances: /PCM3.3_MediaStoreExample (Allocation models are in this case stereotyped.)
    • The Profile Application: /edu.kit.ipd.sdq.mdsd.profiles.examples.palladio.allocatestrict.profile

Both examples along with corresponding datas can be found in our SVN repository in "Examples" folder or be installed from the Update Site as "Examples" feature category. Please note that for "PCM Media Store" example to work, you need to extend the Palladio's meta-model accordingly (as pointed out above and in Model Code Generation). For "Library" example to work you wouldn't need anything extra.

Cardinality of StereotypeApplications and Stereotypes

It is possible to apply the same stereotype multiple types on the same model element (EStereotyableObject). This leads to multiple StereotypeApplications. This means, that a StereotypeApplication does not represent a specific stereotype but one of its applications.