| <?xml version="1.0" encoding="UTF-8"?> |
| <cheatsheet |
| title="Creation of component model"> |
| <intro> |
| <description> |
| A component model consists of a set of component definitions. Each component may be either a |
| primitive (or monolithic) component or a composite component. Whereas the latter contains one |
| or more <i>parts</i> typed with other components, the former does not contain other components. |
| Typically, a composite component delegates services provided by some of its ports to inner |
| components while a primitive component implements the services itself. |
| There are different strategies, in which order components are implemented, e.g. starting |
| with the composite components and then defining the sub-components (top-down) or vice-versa |
| (bottom-up). Both strategies could be mixed. |
| </description> |
| </intro> |
| <item |
| title="(Top-down) Step1: Create your system"> |
| <description> |
| <b>In this step, you start by modeling your system in a composite diagram.</b> |
| <br> </br>Start modeling the system type and implementation. |
| <br> </br>A component defines a type when it has more that one implementation, |
| or when the evolution of the component envisions to group a set of implementations using a type definition. |
| Optionally, a component may be abstract, i.e. does not provide an implementation. |
| <br> </br>As a good practice, we recommend to define component type only when necessary. |
| <br> </br>In the following, we will define a component type for the components that we will create. |
| </description> |
| <subitem |
| label="Open the "Model explorer" view: Window > Show View > Papyrus > Model Explorer (alternative: select Papyrus perspective): The explorer shows a tree-view of your model." skip="true"> |
| <command |
| required="false" |
| serialization="org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.papyrus.modelexplorer.modelexplorer)"/> |
| </subitem> |
| <subitem |
| label="Expand your model, you will find under it three packages from the template: "ComponentModel", "Platform", and "DeploymentPlans". To organize you models, each package will include the appropriate diagrams." |
| skip="true"> |
| </subitem> |
| <subitem |
| label="As a good practice, we recommend to create a package for each component (monolithic or composite) under the package "ComponentModel". The package will group all the component-related elements (i.e., type, implementation(s), port(s)). Nevertheless, you can model all your components in the same diagram. This may only affect the clarity of your model. Under "ComponentModel", you create a package related to each monolithic component your system will include, as well as a package for modeling your system: Outline > Right-click on your "ComponentModel" package > Add an element > Package. Select your package and name it according to your application needs from the "Properties" view. In the following, we will use the name "System" to denote the component that models your system." |
| skip="true"> |
| </subitem> |
| <subitem |
| label="If the "Properties" view is not shown: Window > Show Perspective > Select Properties" |
| skip="true"> |
| <command |
| required="false" |
| serialization="org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.ui.views.PropertySheet)"/> |
| </subitem> |
| <subitem |
| label="In your package "System", create a composite diagram and open it. Outline > Right-click on your package > Add a diagram > Create a new Composite Diagram. Double click on your newly created composite diagram to open it." skip="true"> |
| </subitem> |
| <subitem |
| label="From the "Palette" view, drag-and-drop a new component type (ComponentType), and name it according to your application needs. Herein, we will call it "System". In addition, drag and drop a new component implementation (ComponentImpl), and name it. In this tutorial, we will call it "System_Impl"." |
| skip="true" > |
| </subitem> |
| <subitem |
| label="The component implementation(s) inherit(s) from the component type. The inheritance relation is useful in order to remove redundancy when generating the code from the model. Drag and drop a "Generalization" link from the "Palette", under "UML Links". |
| The link has as origin the component implementation (i.e., "System_Impl") and, the component type (i.e. "System") as destination." skip="true"> |
| </subitem> |
| <subitem |
| label="In your "System_Impl", add as many properties as parts you require in your system. The properties represent the instances of the primitive components you will create in the next step. To this aim: From the "Palette" view, drag-and-drop "Property" provided under "UML Elements". Name each property: Select the property in your composite diagram then, from the "Properties" view, under "General", you can give a name to your part (property). Later on, you will select the type of your part. Furthermore, in the "Properties" view, under "General", you can select the "aggregation kind": "Aggregation" when the part is shared by more than one subcomponent, or "Composition" when the property is not shared. "Composition" is the most commonly used "aggregation kind"." |
| > |
| <command |
| required="false" |
| serialization="org.eclipse.team.svn.ui.command.EditPropertiesCommand"/> |
| </subitem> |
| |
| </item> |
| <item |
| title="Enter component modeling"> |
| <description> |
| <b>In this step, you model the monolithic components that your system includes (i.e., the internal parts of your system). </b> |
| <br> </br>Start by modeling the components type, implementation, and their ports in a "component diagram" then model their interfaces in "class diagrams". |
| </description> |
| </item> |
| </cheatsheet> |